listBoxBrowser.il #1

  • //
  • guest/
  • robert_yu/
  • perforce/
  • cdsp4/
  • release/
  • 2.2/
  • Skill/
  • ListBoxBrowser/
  • listBoxBrowser.il
  • View
  • Commits
  • Open Download .zip Download (85 KB)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Copyright (c) 2000, Perforce Software, All rights reserved.
; 
; This software was originally developed by Silicon Graphics, Inc (SGI).
; 
; Redistribution and use in source and binary forms, with or
; without modification, are permitted provided that the following
; conditions are met:
; 
; Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer.
; 
; Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; 
; Neither name of Perforce Software nor SGI nor the names of its
; contributors may be used to endorse or promote products derived from
; this software without specific prior written permission.
; 
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


;edit/read mode setting - default is read  - user may override this in their cdsuser file.
CDS_lbbdblClickMode="read"

;the length of the history list before entries roll off
CDS_LBBhistListLength=25

;file to keep opened cell history list in
CDS_LBBhistoryFile="./.CDS_LBBcellOpenHistory"
load("cdsp4_lib.il")


procedure(CDS_LBBAddWindowBanner()		  ;_Jul 17 00 sikand 411
;add banner items for the floorplanner
  CDS_LBBwindowMenu=hiCreatePulldownMenu('CDS_LBBwindowMenu "Window"
					 list( 
					    hiCreateMenuItem(?name     'CDS_LBBwindowClose
							     ?itemText "Close"
							     ?callback "CDS_lbbCloseDownForms(CDS_LBBwid)"
					    )
					 )
		    ); hiCreatePulldownMenu
  hiInsertBannerMenu(CDS_LBBwid CDS_LBBwindowMenu 0)
) ; ** procedure CDS_LBBAddWindowBanner **


procedure(CDS_lbbevalLibCommand()		  ;_Oct  3 02 sikand 0
  prog((doWhat srcLib destLib)
    doWhat=CDS_listBoxBrowserForm->libCommands->value
    cond(
					;reset button text to "Library Commands"  Just a 
					;kludgy way of getting the ;cyclic box to act like a command button 
					;but with choices.  This way we don't have to use a middle-button 
					;activated popup.

       (doWhat == "Find"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	CDS_findNameInListBox("Lib")
       )
       
       (doWhat == "Library File Manager"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	foreach(lib CDS_listBoxBrowserForm->libraryListBox->value
	   CDS_P4LibFileManager(lib)
	)
       )
       
       ;;(doWhat == "Make local client"
       ;;CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
       ;;foreach(lib CDS_listBoxBrowserForm->libraryListBox->value
       ;;   CDS_lbbMakeLocal(ddGetObj(lib))
       ;;)
       ;;)
       (doWhat == "New"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	;;CDS_lbbCreateNew("Lib")
	ddsHiCreateLibrary()
	
       )

       (doWhat == "Revision"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	foreach(lib CDS_listBoxBrowserForm->libraryListBox->value
	   CDS_lbbRevision(ddGetObj(lib))
	)
       )
       (doWhat == "Refresh"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	CDS_lbbrefreshTheLibList(t)
       )
       (doWhat == "Synchronize"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	foreach(lib CDS_listBoxBrowserForm->libraryListBox->value
	   CDS_P4SyncLib(ddGetObj(lib))
	)
       )
       (doWhat == "Update Access Lists"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	CDS_P4Permissions()
       )
       
       (doWhat == "Copy"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	CDS_lbbCopyLib()
       )
       (doWhat == "Delete"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	CDS_lbbDelete("Lib")
       )
       (doWhat == "Delete Empty Cells"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	CDS_lbbDelete("EmptyCells")
       )
       (doWhat == "Delete Views"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	CDS_lbbDelete("Views")
       )
       (doWhat == "Rename"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	srcLib=car(CDS_listBoxBrowserForm->libraryListBox->value)
	destLib=CDS_lbbCopyLib()
	unless(destLib
	   return()
	)
	CDS_lbbDelete("Lib" srcLib)
	CDS_listBoxBrowserForm->libraryListBox->value=list(destLib)
	printf("Rename Complete:  %s renamed to %s\n" srcLib destLib)
       )
       (doWhat == "Properties"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	if(CDS_listBoxBrowserForm->libraryListBox->value then
	   foreach(lib CDS_listBoxBrowserForm->libraryListBox->value
	      ddsViewDDProp(lib)
	   )
	else
	   println("No Library selected!  Select lib(s) before choosing Properties command.")
	) ; ** if CDS_listBoxBrowserForm **
       )
       (doWhat == "Purge"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	CDS_FFpurgeCells(CDS_listBoxBrowserForm->libraryListBox->value)
       )
       (doWhat == "Show Changes"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button

	if(CDS_listBoxBrowserForm->libraryListBox->value then
	   foreach(lib CDS_listBoxBrowserForm->libraryListBox->value
	      CDS_lbbDisplayChanges(lib)
	   )
	else
	   println("No Library selected!  Select lib before choosing show-checkouts command.")
	) ; ** if CDS_listBoxBrowserForm **
       )
       
       (doWhat == "Show Checkouts"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button

	if(CDS_listBoxBrowserForm->libraryListBox->value then
	   foreach(lib CDS_listBoxBrowserForm->libraryListBox->value
	      CDS_lbbShowCheckouts(lib)
	   )
	else
	   println("No Library selected!  Select lib before choosing show-checkouts command.")
	) ; ** if CDS_listBoxBrowserForm **
       )
       (doWhat == "Options"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands" ;reset button
	CDS_lbbLibOptions()
       )

       (doWhat == "Integration Wizard"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands"
	CDS_P4IntWiz()
       )


       (doWhat == "Clean Catalog"
	CDS_listBoxBrowserForm->libCommands->value = "Library Commands"
	if(CDS_listBoxBrowserForm->libraryListBox->value then
	   foreach(lib CDS_listBoxBrowserForm->libraryListBox->value
	      CDS_P4CleanEmpty(ddGetObj(lib))
	   )
	else
	   println("No Library selected!")
	) ; ** if CDS_listBoxBrowserForm **
       )
    );cond
  ); ** prog **
  nil
) ; ** procedure CDS_lbbevalLibCommand **



procedure(CDS_lbbevalCatCommand()		  ;_Jul 17 00 sikand 848
  prog((doWhat currentLib)
    doWhat=CDS_listBoxBrowserForm->catCommands->value
    cond(
					;reset button text to "Category Commands"  Just a 
					;kludgy way of getting the ;cyclic box to act like a command button 
					;but with choices.  This way we don't have to use a middle-button 
					;activated popup.

       (doWhat == "Find"
	CDS_listBoxBrowserForm->catCommands->value = "Category Commands" ;reset button
	CDS_findNameInListBox("Cat")
       )

       (doWhat == "Toggle Flatten"
	CDS_listBoxBrowserForm->catCommands->value = "Category Commands" ;reset button
	CDS_lbbFlattenCats = !CDS_lbbFlattenCats
	currentLib=CDS_listBoxBrowserForm->libraryListBox->value
	CDS_lbbopenLibraryUpdateCat(car(currentLib) "open")
       )
       
       (doWhat == "Delete"
	CDS_listBoxBrowserForm->catCommands->value = "Category Commands" ;reset button
	CDS_lbbDelete("Cat")
       )
       (doWhat == "Open"
	CDS_listBoxBrowserForm->catCommands->value = "Category Commands" ;reset button
	if(CDS_listBoxBrowserForm->categoryListBox->value then
	   CDS_lbbmoveToCatUpdateCell(car(CDS_listBoxBrowserForm->categoryListBox->value))
	else
	   println("No Category selected!  Select one before choosing Open command.")
	)
       )
    );cond
  );let
  nil
) ; ** procedure CDS_lbbevalCatCommand **



procedure(CDS_lbbevalCellCommand()		  ;_May  2 02 sikand 1313
  prog((doWhat)
    doWhat=CDS_listBoxBrowserForm->cellCommands->value
					;reset button text to "Cell Commands"  Just a 
					;kludgy way of getting the ;cyclic box to act like a command button 
					;but with choices.  This way we don't have to use a middle-button 
					;activated popup.
    cond(
       (doWhat == "Properties"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	if(CDS_listBoxBrowserForm->cellListBox->value then
	   foreach(cell CDS_listBoxBrowserForm->cellListBox->value
	      ddsViewDDProp(car(CDS_lbbselectedLibIDs)~>name cell)
	   )
	else
	   println("No cells selected!  Select one before choosing Properties command.")
	); ** if CDS_listBoxBrowserForm **
       )
       (doWhat == "Find"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_findNameInListBox("Cell")
       )
       (doWhat == "Copy"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_lbbCopyCell()
       )
       (doWhat == "Delete"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_lbbDelete("Cell")
       )
       (doWhat == "New"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_lbbCreateNew("Cell")
       )
       (doWhat == "Read"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_lbbOpenCell("r")
       )
       (doWhat == "Edit"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_lbbOpenCell("a")
       )
       (doWhat == "Move"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_lbbMove()
       )
       (doWhat == "Purge"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_FFpurgeCells(CDS_listBoxBrowserForm->libraryListBox->value
			 ?cellList CDS_listBoxBrowserForm->cellListBox->value)
       )
       (doWhat == "CDS_lbbUserFunc"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_lbbUserFuncLoop()
       )
       (doWhat == "Options"
	CDS_listBoxBrowserForm->cellCommands->value= "Cell Commands" ;reset button
	CDS_lbbCellOptions()
       )
    );cond
  );prog
  nil
) ; ** procedure CDS_lbbevalCellCommand **




procedure(CDS_lbbevalCellViewCommand()		  ;_Jul 17 00 sikand 3624
  prog((doWhat cdbId )
    doWhat=CDS_listBoxBrowserForm->cellViewCommands->value
    cond(
					;reset button text to "CellView Commands"  Just a 
					;kludgy way of getting the ;cyclic box to act like a command button 
					;but with choices.  This way we don't have to use a middle-button 
					;activated popup.

       (doWhat == "Properties"
	CDS_listBoxBrowserForm->cellViewCommands->value= "CellView Commands" ;reset button
	if(CDS_listBoxBrowserForm->cellViewListBox->value then
	   foreach(view CDS_listBoxBrowserForm->cellViewListBox->value
	      ddsViewDDProp(car(CDS_lbbselectedLibIDs)~>name 
			    car(CDS_listBoxBrowserForm->cellListBox->value) view)
	   )
	else
	   println("No cellView selected!  Select one before choosing Properties command.")
	) ; ** if CDS_listBoxBrowserForm **
       )
       (doWhat == "New"
	CDS_listBoxBrowserForm->cellViewCommands->value= "CellView Commands" ;reset button
	CDS_lbbCreateNew("CellView")
       )
       (doWhat == "Copy"
	CDS_listBoxBrowserForm->cellViewCommands->value= "CellView Commands" ;reset button
	CDS_lbbCopyCellView()
       )
       (doWhat == "Delete"
	CDS_listBoxBrowserForm->cellViewCommands->value= "CellView Commands" ;reset button
	CDS_lbbDelete("CellView")
       )
       (doWhat == "Read"
	CDS_listBoxBrowserForm->cellViewCommands->value= "CellView Commands" ;reset button
	CDS_lbbOpenCell("r")
       )
       (doWhat == "Edit"
	CDS_listBoxBrowserForm->cellViewCommands->value= "CellView Commands" ;reset button
	CDS_lbbOpenCell("a")
       )
       (doWhat == "Show Versions"
	CDS_listBoxBrowserForm->cellViewCommands->value = "CellView Commands" ;reset button
	CDS_lbbShowVersions()
       )
       (doWhat == "Check-In" 
	CDS_listBoxBrowserForm->cellViewCommands->value = "CellView Commands" ;reset button
	unless(car(CDS_listBoxBrowserForm->cellViewListBox->value)
	   if(length(CDS_listBoxBrowserForm->cellViewListBox->choices) == 1 then
	      CDS_listBoxBrowserForm->cellViewListBox->value=CDS_listBoxBrowserForm->cellViewListBox->choices
	   else
	      CDS_lbbChooseCellView()
	   )
	   unless(CDS_listBoxBrowserForm->cellViewListBox->value
	      printf("You must choose a view to checkin...\n")
	      return()
	   )
	) ; ** unless car **
	foreach(view CDS_listBoxBrowserForm->cellViewListBox->value
	   printf("Checking in: %s %s %s\n" car(CDS_lbbselectedLibIDs)~>name
		  car(CDS_listBoxBrowserForm->cellListBox->value) view)
	   
	   cdbId=CDS_lbbGetMasterId(car(CDS_lbbselectedLibIDs)~>name 
				    car(CDS_listBoxBrowserForm->cellListBox->value) view)
	   ;; added the f flag so it will work for unrevisioned
	   ;; objects
	   ddCheckin(list(cdbId) "" "f") 
	) ; ** foreach view **
       )
       (doWhat == "Cancel-Checkout"
	CDS_listBoxBrowserForm->cellViewCommands->value = "CellView Commands" ;reset button
	unless(car(CDS_listBoxBrowserForm->cellViewListBox->value)
	   if(length(CDS_listBoxBrowserForm->cellViewListBox->choices) == 1 then
	      CDS_listBoxBrowserForm->cellViewListBox->value=CDS_listBoxBrowserForm->cellViewListBox->choices
	   else
	      CDS_lbbChooseCellView()
	   )
	   unless(CDS_listBoxBrowserForm->cellViewListBox->value
	      printf("Error: You must choose a view to cancel checkout on...\n")
	      return()
	   )
	) ; ** unless car **
	foreach(view CDS_listBoxBrowserForm->cellViewListBox->value
	   printf("Cancelling checkout for: %s %s %s\n" car(CDS_lbbselectedLibIDs)~>name
		  car(CDS_listBoxBrowserForm->cellListBox->value) view)
	   
	   cdbId=CDS_lbbGetMasterId(car(CDS_lbbselectedLibIDs)~>name 
				    car(CDS_listBoxBrowserForm->cellListBox->value) view)
	   ddCheckin(list(cdbId) "Cancel" "c")
	) ; ** foreach view **
       )
    );cond
  );prog
  nil
) ; ** procedure CDS_lbbevalCellViewCommand **


procedure(CDS_lbbrefreshTheLibList(@optional (update nil)) ;_Jul 17 00 sikand 1514
					;procedure to go re-read and display the lib list
					;"update" mode forces updating the liblist
  prog((currentLib cdsLibName)

    currentLib=CDS_listBoxBrowserForm->libraryListBox->value

    when(update
					;go reread the cds.lib to get the most up to data path info
					;see if a new lib path was forced in by the user (at the CIW)
					;if so, use it, else get the default one.
       cdsLibName=ddGetForcedLib()
       unless(cdsLibName == ""
	  cdsLibName=ddGetUpdatedLib()
       )
       ddSetForcedLib(cdsLibName)
       ddUpdateLibList()
    ) ; ** when update **

    CDS_lbblibraryList=CDS_lbbsortTheList("Lib" ddGetLibList()~>name)

    if(length(currentLib) == 1 && ddGetObj(car(currentLib)) && !update then

       CDS_lbbopenLibraryUpdateCat(car(currentLib) "open")
       CDS_listBoxBrowserForm->libraryListBox->value=currentLib
    else
					;go get the initial lib,cat,cell lists then open and read the lib cells
       CDS_lbblibraryList=CDS_lbbsortTheList("Lib" ddGetLibList()~>name)
       CDS_lbbupdateListDisplay(CDS_lbblibraryList "update" "Lib")
       CDS_lbbClearListBox(list("Cat" "Cell" "CellView"))

					;refresh the cell/cellview fields if a single lib was selected
       when(length(currentLib) == 1 && ddGetObj(car(currentLib))
	  CDS_lbbopenLibraryUpdateCat(car(currentLib) "open")
	  CDS_listBoxBrowserForm->libraryListBox->value=currentLib
       )
    ) ; ** if length **

    CDS_lbbupdateClientField()

  ) ; ** prog **
  nil
) ; ** procedure CDS_lbbrefreshTheLibList **

procedure(CDS_lbbcheckOtherForms(cellname)	  ;_Oct  3 02 sikand 0
  prog((cellId)

					;update the cellview list box
    cellId=ddGetObj(car(CDS_lbbselectedLibIDs)~>name cellname)
    ;; use a mapping function Shiv
    ;; this is just sloppy
    CDS_lbbviewList=cellId~>views~>name

    ;; prune empty views
    foreach(view cellId~>views
       unless(view~>files
	  CDS_lbbviewList=remove(view~>name  CDS_lbbviewList)
       ) 
    )

    CDS_listBoxBrowserForm->cellViewListBox->choices=CDS_lbbviewList

					;check if the instantiate cell form is displayed, if so fill in the info
    when(boundp('leCreateInstForm)
       when(hiIsFormDisplayed(leCreateInstForm)
	  leCreateInstForm->libName->value = car(CDS_lbbselectedLibIDs)~>name
	  leCreateInstForm->cellName->value = cellname
	  if(member(car(CDS_listBoxBrowserForm->cellViewListBox->value) 
		    CDS_listBoxBrowserForm->cellViewListBox->choices) then
	     leCreateInstForm->viewName->value = car(CDS_listBoxBrowserForm->cellViewListBox->value)
	  else
	     leCreateInstForm->viewName->value = ""
	  ) ; ** if member **
       ) ; ** when hiIsFormDisplayed **
    ) ; ** when boundp **
    when(boundp('deOpenForm)
       when(hiIsFormDisplayed(deOpenForm)
	  deOpenForm->deLibName->value = car(CDS_lbbselectedLibIDs)~>name
	  deOpenForm->deCellName->value = cellname
	  if(member(car(CDS_listBoxBrowserForm->cellViewListBox->value) 
		    CDS_listBoxBrowserForm->cellViewListBox->choices) then
	     deOpenForm->deViewName->value = car(CDS_listBoxBrowserForm->cellViewListBox->value)
	  else
	     deOpenForm->deViewName->value = ""
	  ) ; ** if member **
       ) ; ** when hiIsFormDisplayed **
    ) ; ** when boundp **
  ) ; ** prog **
) ; ** procedure CDS_lbbcheckOtherForms **




procedure(CDS_lbbDefineLibOptionsForm()		  ;_Jul 17 00 sikand 852
					;Set options to be used for lib actions
  prog((sortType sortOrder)

    when(!(boundp('CDS_lbbLibOptionsForm) && CDS_lbbLibOptionsForm) || CDS_lbbformDebug 

       sortType=hiCreateRadioField(
		   ?name  'sortType
		   ?prompt "List Names:"
		   ?choices list("Alphabetic" "By Date")
		   ?itemsPerRow 1
		   ?value   "Alphabetic"
		   ?callback '("")
		)

       sortOrder=hiCreateBooleanButton(
		    ?name 'sortOrder
		    ?buttonText "Reverse Sort?"
		    ?value nil
		    ?defValue nil
		 )
					;go display the form
       hiCreateAppForm(
	  ?name 'CDS_lbbLibOptionsForm
	  ?buttonLayout 'OKCancel
	  ?fields list(
		     list(sortType              5:5  150:25 90)
		     list(sortOrder            5:60 150:25 100)
		  )
	  ?formTitle "Library Options"
	  ?callback "CDS_lbbrefreshTheLibList(t)"
	  ?help "Layout" ;Look at Layout.HRF file for help
	  ?initialSize 220:150
       );hiCreateAppForm
    );when not defined before
    return(t)
  ) ; ** prog **
) ; ** procedure CDS_lbbDefineLibOptionsForm **



procedure(CDS_lbbLibOptions()			  ;_Jul 17 00 sikand 288
					;Set options to be used for lib actions
  prog((mainXY LROffset)

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(car(mainXY) < 500 then
       LROffset=0
    else
       LROffset=-290
    )
    hiDisplayForm(CDS_lbbLibOptionsForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+40)
  ) ; ** prog **
) ; ** procedure CDS_lbbLibOptions **



procedure(CDS_lbbDefineCellOptionsForm()	  ;_Jul 17 00 sikand 854
					;Set options to be used for cell actions
  prog((sortOrder sortType)

    when(!(boundp('CDS_lbbCellOptionsForm) && CDS_lbbCellOptionsForm) || CDS_lbbformDebug 

       sortType=hiCreateRadioField(
		   ?name  'sortType
		   ?prompt "List Names:"
		   ?choices list("Alphabetic" "By Date")
		   ?itemsPerRow 1
		   ?value   "Alphabetic"
		   ?callback '("")
		)

       sortOrder=hiCreateBooleanButton(
		    ?name 'sortOrder
		    ?buttonText "Reverse Sort?"
		    ?value nil
		    ?defValue nil
		 )

					;go display the form
       hiCreateAppForm(
	  ?name 'CDS_lbbCellOptionsForm
	  ?buttonLayout 'OKCancel
	  ?fields list(
		     list(sortType              5:5  150:25 90)
		     list(sortOrder            5:60 150:25 100)
		  )
	  ?formTitle "Cell Options"
	  ?callback "CDS_lbbcellOptionsCB()"
	  ?help "Layout" ;Look at Layout.HRF file for help
	  ?initialSize 220:150
       );hiCreateAppForm
    );unless not defined before
    return(t)
  ) ; ** prog **
) ; ** procedure CDS_lbbDefineCellOptionsForm **



procedure(CDS_lbbcellOptionsCB()      ;_Jun 26 98 sikand 0
  prog(()
    CDS_lbbcellList=CDS_lbbsortTheList("Cell" CDS_lbbcellList)
    CDS_lbbupdateListDisplay(CDS_lbbcellList "update" "Cell")
    CDS_lbbClearListBox(list("CellView"))
  )
) ; ** procedure CDS_lbbcellOptionsCB **



procedure(CDS_lbbCellOptions()			  ;_Jul 17 00 sikand 290
					;Set options to be used for cell actions
  prog((mainXY LROffset)

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(car(mainXY) < 500 then
       LROffset=0
    else
       LROffset=-290
    )
    hiDisplayForm(CDS_lbbCellOptionsForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+440)
  ) ; ** prog **
) ; ** procedure CDS_lbbCellOptions **



procedure(CDS_lbbGetLibCats(libId)		  ;_Jul 17 00 sikand 385
					;wrote our own equivalent of ddCatGetLibCats to check relative speed
  prog((libPath fileId aLine childCatNames)
    libPath=libId~>readpath
    fileId=infile(strcat(libPath "/" libId~>name ".TopCat"))

					;if file does not exist, then there are no cats
    unless(fileId
       return(nil)
    )
    while(aLine=CDS_FFreadLine(fileId)

					;ignor blank lines
       unless(strlen(aLine) < 1
	  when(rexMatchp("\"category\"" aLine)
	     childCatNames=cons(car(parseString(nth(1 parseString(aLine " /")) ".")) childCatNames)
	  )
       )
    );while lines
    close(fileId)
    return(childCatNames)
  ) ; ** prog **
) ; ** procedure CDS_lbbGetLibCats **



procedure(CDS_LBBopenHistory()			  ;_Jul 17 00 sikand 489
					;read the history file: CDS_LBBhistoryFile and display a form
					;with the last n file opens.  User can select from list to 
					;open that lib/cell/view.
  prog((mainXY LROffset)

    CDS_LBBhistList=CDS_LBBaccessHistFile("read")
    CDS_LBBdefineHistForm()

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(car(mainXY) < 500 then
       LROffset=-200
    else
       LROffset=-295
    )
    hiDisplayForm(CDS_LBBhistForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+440)
  ) ; ** prog **
) ; ** procedure CDS_LBBopenHistory **


procedure(CDS_LBBdefineHistForm()		  ;_Jul 17 00 sikand 868
  let((lbbhistViewBox lbbOpenMode)

    when(!(boundp('CDS_LBBhistForm) && CDS_LBBhistForm) || CDS_lbbformDebug

       lbbOpenMode=hiCreateRadioField(
		      ?name  'lbbOpenMode
		      ?prompt "Open File In "
		      ?choices list("Read" "Edit")
		      ?itemsPerRow 2
		      ?value   "Read"
		      ?callback '("")
		   )

       lbbhistViewBox= hiCreateListBoxField(
			  ?name 'lbbhistViewBox
			  ?choices CDS_LBBhistList
			  ?multipleSelect nil
			  ?doubleClickCB "CDS_LBBopenHistCell()"
			  ?callback ""
		       )

					;go display the form
       hiCreateAppForm(
	  ?name 'CDS_LBBhistForm
	  ?buttonLayout 'OKCancelApply
	  ?fields list(
		     list(lbbOpenMode        5:0   250:20  85)
		     list(lbbhistViewBox     5:20  290:78)
		  )
	  ?formTitle "Cell Opened History"
	  ?callback "CDS_LBBopenHistCell()"
	  ?help "Layout" ;Look at Layout.HRF file for help
	  ?initialSize 300:250
       );hiCreateAppForm
    );if not defined before
  );let
) ; ** procedure CDS_LBBdefineHistForm **


procedure(CDS_LBBupdateHistList(newEntry)	  ;_Jul 17 00 sikand 810
  prog((tmpList)
					;update the cell-open history list

					;blow off old entry
    when(member(newEntry CDS_LBBhistList)
       CDS_LBBhistList=remove(newEntry CDS_LBBhistList)
    )
    CDS_LBBhistList=cons(newEntry CDS_LBBhistList)

					;only keep around a set number of entries before rolling them off
    tmpList='()
    for(i 0 CDS_LBBhistListLength-1
					;don't write nils
       when(nth(i CDS_LBBhistList)
	  tmpList=cons(nth(i CDS_LBBhistList) tmpList)
       )
    ) ; ** for i **
    CDS_LBBhistList=reverse(tmpList)
    CDS_LBBaccessHistFile("write" CDS_LBBhistList)
    when(boundp('CDS_LBBhistForm) 
       CDS_LBBhistForm->lbbhistViewBox->choices=CDS_LBBhistList
       CDS_LBBhistForm->lbbhistViewBox->value=list(car(CDS_LBBhistList))
    )
  ) ; ** prog **
) ; ** procedure CDS_LBBupdateHistList **


procedure(CDS_LBBopenHistCell()			  ;_Jul 17 00 sikand 487
  prog((lib cell view strList openMode)
					;open one of the cells in the history list box

    when(car(CDS_LBBhistForm->lbbhistViewBox->value)
       if(CDS_LBBhistForm->lbbOpenMode->value  == "Edit" then
	  openMode="a"
       else
	  openMode="r"
       )
       strList=parseString(car(CDS_LBBhistForm->lbbhistViewBox->value) " ")
       lib=nth(0 strList)
       cell=nth(1 strList)
       view=nth(2 strList)
       CDS_LBBupdateHistList(strcat(lib "  " cell "  " view))

       if(ddGetObj(lib cell view) then
	  printf("Opening: %s %s %s...\n" lib cell view)
	  geOpen(?lib  lib
		 ?cell cell
		 ?view view
		 ?mode openMode)
       else
	  printf("Can't find %s %s %s...\n" lib cell view)
       ) ; ** if ddGetObj **
    ) ; ** when car **
  );prog
) ; ** procedure CDS_LBBopenHistCell **


procedure(CDS_LBBaccessHistFile(mode @optional curList)	;_Jul 17 00 sikand 1001
					;open/create/read the history file
  prog((histFileId nextline histList)

    cond(
       (mode == "read"
	if(histFileId=infile(CDS_LBBhistoryFile) then
	   
	   CDS_LBBhistList='()
					;read the file into a list
	   while(nextline=lineread(histFileId)   
	      
					;check for blank line or a comment
	      unless(nextline == t || rexMatchp("^;" nth(0 nextline))
		 histList=append(histList nextline)
	      )
	   ) ; ** while nextline **
	   close(histFileId)
	   return(histList)
	else
					;no existing hist file, just create a blank list
	   histList=list("")
	   return(histList)
	) ; ** if histFileId **
       )
       (mode == "write"
	if(histFileId=outfile(CDS_LBBhistoryFile "w") then
	   foreach(line curList
	      fprintf(histFileId "\"%s\"\n" line) 

					;limit the size of the history list
	   )
	   close(histFileId)
	   return()
	else
	   printf("Error: Could not open history file: %s\n" CDS_LBBhistoryFile)
	   return()
	) ; ** if histFileId **
       )
    );cond
  );prog
) ; ** procedure CDS_LBBaccessHistFile **

procedure(CDS_lbbGetMasterId(libName cellName viewName)	;_Jul 17 00 sikand 16

					;Get the ddId of the master cell.  The following rules apply:
					;- If the master.tag file exists, the file specified by the master.tag file 
					;  is the master representation.
					;- If there is only one file in the directory, it is the master.
					;- If a file named vhdl.vhd or verilog.v (but not both) is present in the 
					;  directory, it is the master.

  prog((ddId)

					;commented out to keep lint happy (some code below is commented out...)
 ;;;prog((tagFile tagPort masterFile masterPort master ddId line masterId)


    ddId=ddGetObj(libName cellName viewName "*")
    unless( ddId
       error("Empty directory!")
    )
    
    return(ddId)
    
    

    
					; ddId=ddGetObj(libName cellName viewName)
;     tagFile = strcat(ddId~>writePath "/master.tag")
;     tagPort = infile(tagFile)
;     if(tagPort then
;         while(gets(line tagPort)
;             ;skip the first line
;             gets(line tagPort)
;             master = car(parseString(line "\n"))
;             masterId=ddGetObj(libName cellName viewName master)
;         )  ; ** while gets **
;         close(tagPort)
;     else
;         ;no master.tag file so check if there is a verilog.v
;         masterFile = strcat(ddId~>writePath "/verilog.v")
;         masterPort=infile(masterFile)
;         if(masterPort then
;             masterId=ddGetObj(libName cellName viewName "verilog.v")
;         else
;             ;just get the cdb file
;             masterId=ddGetObj(libName cellName viewName strcat(viewName ".cdb"))
;         ) ; ** if masterPort **
;        close(masterPort)
;     )  ; ** if tagPort **
;     return(masterId)
  ) ; ** prog **
) ; ** procedure CDS_lbbGetMasterId **


procedure(CDS_lbbGetCatMembers(libId catName )	  ;_Jul 17 00 sikand 433

					;wrote our own equivalent of ddCatGetCatMembers to check relative speed
  prog((libPath fileId aLine catItems fileLines)
    libPath=libId~>readpath
    fileId=infile(strcat(libPath "/" catName ".Cat"))
    catItems='()

					;if file does not exist, then there are no cats
    unless(fileId
       return(nil)
    )
    fileLines='()
    while(aLine=CDS_FFreadLine(fileId)
       fileLines=cons(aLine fileLines)

					;ignore blank lines
       unless(strlen(aLine) < 1
	  when(rexMatchp("\"category\"" aLine)
	     catItems=cons(list(car(parseString(nth(1 parseString(aLine " /")) ".")) "category") catItems)
	  )
	  when(rexMatchp("\"cell\"" aLine) 
	     catItems=cons(list(car(parseString(nth(1 parseString(aLine " /")) ".")) "cell") catItems)
	  )
       ) ; ** unless strlen **
    );while lines
    close(fileId)
    return(catItems)
  ) ; ** prog **
) ; ** procedure CDS_lbbGetCatMembers **



procedure(CDS_lbbopenLibraryUpdateCat(libToOpen mode) ;_Feb 24 03 jdao 2543
						  ;open a library and then update the category
					;and cell list.  
  prog(()
					;leave as a list since multiple cell commands assume a list structure
    when(mode == "open"
       CDS_lbbselectedLibIDs=list(ddGetObj(libToOpen))
       unless(car(CDS_lbbselectedLibIDs)
	  printf("Error: Could not Open the Lib: %s\n" libToOpen)
	  return()
       )
    ) ; ** when mode **

					;be sure no cell name have "." in them as this breaks p4 
    ;;(cadence maps "." to #2e under the hood...)
    when(rexMatchList("[.]" car(CDS_lbbselectedLibIDs)~>cells~>name)
       CDS_FFpopDialogBox(sprintf(nil "Can't have \".\" in cell names.  Please rename these:\n %L" 
				  setof(x car(CDS_lbbselectedLibIDs)~>cells~>name rexMatchp("[.]" x))))
    )

					;create a table indexed by category name.  Values are the parent and children cat names
    CDS_lbbCatTable=makeTable(gensym('CDS_lbbCatTable) nil)
    unless( CDS_lbbFlattenCats
       CDS_lbbcategoryList=CDS_lbbGetLibCats(car(CDS_lbbselectedLibIDs))

					;build a category table with parent/child nodes
       CDS_lbbCatTable["Top Level"]=append(list(nil) CDS_lbbcategoryList)

       if(CDS_lbbcategoryList then
	  CDS_lbbcategoryList=sort(CDS_lbbcategoryList 'alphalessp)
	  CDS_lbbCurCat= "Top Level"
	  CDS_listBoxBrowserForm->currentCatName->value=CDS_lbbCurCat
       else
	  CDS_lbbCurCat= "Top Level"
	  CDS_listBoxBrowserForm->currentCatName->value=CDS_lbbCurCat
	  CDS_lbbcategoryList=list("No Categories")
       ) ; ** if CDS_lbbcategoryList **
       CDS_lbbupdateListDisplay(CDS_lbbcategoryList "update" "Cat")
    ) ; ** unless CDS_lbbFlattenCats **
					;this is the list of cells that are at the same level as the top categories
					;ddCatGetCellsNotInCat only works if there are categories in the lib...

    if( CDS_lbbFlattenCats then
       CDS_lbbcategoryList=list("Categories Flattened")
       CDS_lbbCurCat= "Top Level"
       CDS_listBoxBrowserForm->currentCatName->value=CDS_lbbCurCat
       CDS_lbbupdateListDisplay(CDS_lbbcategoryList "update" "Cat")
       CDS_lbbcellList=car(CDS_lbbselectedLibIDs)~>cells
       ;;CDS_lbbcellList=CDS_lbbPrune(CDS_lbbcellList)~>name
       CDS_lbbcellList = CDS_lbbcellList~>name
    else
       if(CDS_lbbGetLibCats(car(CDS_lbbselectedLibIDs)) then
	  CDS_lbbcellList=CDS_CatGetCellsNotInCat(car(CDS_lbbselectedLibIDs))
       else
	  CDS_lbbcellList=car(CDS_lbbselectedLibIDs)~>cells
	 ;; CDS_lbbcellList=CDS_lbbPrune(CDS_lbbcellList)~>name
	  CDS_lbbcellList = CDS_lbbcellList~>name
       ) ; ** if CDS_lbbGetLibCats **
    ) ; ** if CDS_lbbFlattenCats **
					;in case there were just categories at the top level
    unless(CDS_lbbcellList
       CDS_lbbcellList='("No Cells")
    )
    CDS_lbbcellList=CDS_lbbsortTheList("Cell" CDS_lbbcellList)
    CDS_lbbupdateListDisplay(CDS_lbbcellList "update" "Cell")
    CDS_lbbClearListBox(list("CellView"))
    return(t)
  ) ; ** prog **
) ; ** procedure CDS_lbbopenLibraryUpdateCat **

procedure(CDS_lbbPrune(clist)			  ;_Oct  3 02 sikand 75
;; prune empty dirs
  prog((clist2 empty)

    clist2=clist
    ;; reject empty views and cells with no views
    foreach(cell clist
       empty=0
       if(cell~>views == nil then
	  ;;printf("cell Pruning %s\n" cell~>name)
	  clist2=remove(cell clist2)
       else
	  ;; now reject the cell if all views are empty
	  foreach(el cell~>views~>files
	     when(el
		empty++
	     )
	  )
       ) ; ** if cell **
       when(empty == 0
	  ;;printf("view Pruning %s\n" cell~>name)
	  clist2=remove(cell clist2)
       )
    ) ; ** foreach cell **
    return(clist2)
  ) ; ** prog **
) ; ** procedure CDS_lbbPrune **


procedure(CDS_lbbsortTheList(type theList)	  ;_Jul 17 00 sikand 965
					;procedure sort the lists based on the options set
  prog((reversed sortType sortedList timeList)

    case(type
       ("Lib"
	reversed=CDS_lbbLibOptionsForm->sortOrder->value
	sortType=CDS_lbbLibOptionsForm->sortType->value
       )
       ("Cell"
	reversed=CDS_lbbCellOptionsForm->sortOrder->value
	sortType=CDS_lbbCellOptionsForm->sortType->value
       )
    );case
    cond(
       (sortType == "Alphabetic"
	sortedList=sort(theList 'alphalessp)
	when(reversed
	   sortedList=reverse(sortedList)
	)
       )
       (sortType == "By Date"
	case(type
	   ("Lib"
	    foreach(lib theList
	       timeList=cons(list(lib ddGetObj(lib)~>lastModify) timeList) 
	    )
	   )
	   ("Cell"
	    foreach(cell theList
	       timeList=cons(list(cell ddGetObj(car(CDS_listBoxBrowserForm->libraryListBox->value)
						cell)~>lastModify) timeList) 
	    )
	   )   
	);case
	timeList=sort(timeList 'CDS_lbbsortTime)
	sortedList=foreach(mapcar lib timeList car(lib))
	when(reversed
	   sortedList=reverse(sortedList)
	)
       )
    ) ; ** cond sortType **
    return(sortedList)
  );prog
) ; ** procedure CDS_lbbsortTheList **






procedure(CDS_lbbmoveToCatUpdateCell(catToMoveTo @optional (pop nil)) ;_Jul 17 00 sikand 2187
					;read the cells in the category, update the cell list box and category list
  prog((currentCatID new_lbbcategoryList new_lbbcellList )
    
    if(catToMoveTo == "No Sub-Categories" || catToMoveTo == "No Categories" ||  catToMoveTo == "Categories Flattened" then
       hiGetAttention()
       printf("No category to push into...\n")
    else
       new_lbbcategoryList='()
       new_lbbcellList='()
       if(catToMoveTo == "Top Level" then
	  currentCatID=nil
       else
	  currentCatID=ddCatOpen(car(CDS_lbbselectedLibIDs) catToMoveTo "r")

					;if pushing down into a category, add to the parent/child to the table
	  unless(pop
	     CDS_lbbReadCatFile( CDS_lbbCurCat catToMoveTo)
	  )
       ) ; ** if catToMoveTo **
       CDS_lbbCurCat= catToMoveTo
       CDS_listBoxBrowserForm->currentCatName->value=CDS_lbbCurCat

					;if we are returning to the top, go get the current lib categories and cells
					;also, if there are no categories, then currentCatID would be nil.  Check...
       if(!currentCatID || currentCatID~>name == "Top Level" then
	  CDS_lbbopenLibraryUpdateCat(car(CDS_listBoxBrowserForm->libraryListBox->value) "update")
       else
					;now go separate the members into categories and cells. Update list boxs
	  foreach(catMember CDS_lbbGetCatMembers(car(CDS_lbbselectedLibIDs) catToMoveTo)
	     cond(
		(cadr(catMember) == "cell"
		 new_lbbcellList=cons(car(catMember) new_lbbcellList)
		)
		(cadr(catMember) == "category"
		 new_lbbcategoryList=cons(car(catMember) new_lbbcategoryList)
		)
	     ) ; ** cond cadr **
	  ) ; ** foreach catMember **
	  if(new_lbbcategoryList then
	     CDS_lbbcategoryList=sort(new_lbbcategoryList 'alphalessp)
	  else
	     CDS_lbbcategoryList=list("No Sub-Categories")
	  )
	  if(new_lbbcellList then
	     CDS_lbbcellList=CDS_lbbsortTheList("Cell" new_lbbcellList)
	     unless(CDS_lbbcellList
                CDS_lbbcellList=list("No Cells")
	     )
	  else
	     CDS_lbbcellList=list("No Cells")
	  ) ; ** if new_lbbcellList **
	  CDS_lbbupdateListDisplay(CDS_lbbcategoryList "update" "Cat")
	  CDS_lbbupdateListDisplay(CDS_lbbcellList "update" "Cell")
	  CDS_lbbClearListBox(list("CellView"))
       ) ; ** if currentCatID **
    );unless no categories
  ) ; ** prog **
) ; ** procedure CDS_lbbmoveToCatUpdateCell **


procedure(CDS_lbbpopOneCategoryLevel()		  ;_Jul 11 01 sikand 121
  prog((parentCatID parentCatName)
    parentCatID = nil
    ;;check to see if we are at the top.  If not, then pop up one
    if(CDS_lbbCurCat == "Top Level" then
       ;;we are back to the top, so just go refresh the contents.
       CDS_lbbopenLibraryUpdateCat(car(CDS_listBoxBrowserForm->libraryListBox->value) "update")
       return()
    else
       parentCatName=car(CDS_lbbCatTable[CDS_lbbCurCat])

       ;;just in case there is a problem in the table, this will get us out of the recursion...
       unless(parentCatName parentCatName = "Top Level")  

       ;;check that the cat was not empty, and thus deleted by opus after a ddCatClose
       ;;if so, we need to remove it from the parents cat file, then pop to the parent
       ;;if the cat did still have some contents, then just move the the parent normally

       if(ddCatOpen(car(CDS_lbbselectedLibIDs) CDS_lbbCurCat "r") then
	  CDS_lbbCurCat=parentCatName
	  CDS_lbbmoveToCatUpdateCell(parentCatName "pop")
       else
	  unless(parentCatName == "Top Level"
	     parentCatID=ddCatOpen(car(CDS_lbbselectedLibIDs) car(CDS_lbbCatTable[CDS_lbbCurCat]) "a")
	     unless( parentCatID
		error("Could not open category!")
	     )
	     
	     ddCatSubItem(parentCatID CDS_lbbCurCat)
	     ddCatSave(parentCatID)
	     ddCatClose(parentCatID)
	  ) ; ** unless parentCatName **
	  CDS_lbbcategoryList=remove(CDS_lbbCurCat CDS_lbbcategoryList)
	  remove(CDS_lbbCurCat CDS_lbbCatTable)
	  CDS_lbbCurCat=parentCatName
	  CDS_lbbpopOneCategoryLevel()
       ) ; ** if ddCatOpen **
    ) ; ** if CDS_lbbCurCat **
  ) ; ** prog **
) ; ** procedure CDS_lbbpopOneCategoryLevel **


procedure(CDS_lbbReadCatFile( parentName catName) ;_Jul 17 00 sikand 530
  prog((libPath fileId aLine childCatNames )
    childCatNames='()
    libPath=car(CDS_lbbselectedLibIDs)~>readpath
    fileId=infile(strcat(libPath "/" catName ".Cat"))
    while(aLine=CDS_FFreadLine(fileId)

					;ignor blank lines
       unless(strlen(aLine) < 1
	  when(rexMatchp("\"category\"" aLine)
	     childCatNames=cons(car(parseString(nth(1 parseString(aLine " /")) ".")) childCatNames)
	  )
       )
    );while lines
    close(fileId)
    CDS_lbbCatTable[catName]=append(list(parentName) childCatNames)
  ) ; ** prog **
) ; ** procedure CDS_lbbReadCatFile **


procedure(CDS_findNameInListBox(type)		  ;_Jul 17 00 sikand 2048
					;find a name(s) in the list box
					;pop a form to ask for the search string
  prog((searchString mainXY LROffset)

    when(!(boundp('CDS_lbbFindNameForm) && CDS_lbbFindNameForm) || CDS_lbbformDebug 
       searchString= hiCreateStringField(
			?name 'searchString
			?prompt "Find:"
			?value ""
			?callback ""
			?format "%s"
		     )

					;go display the form
       hiCreateAppForm(
	  ?name 'CDS_lbbFindNameForm
	  ?buttonLayout 'OKCancel
	  ?fields list(
		     list(searchString                     5:5 200:25  40)
		  )
	  ?formTitle "Find Name"
	  ?callback "CDS_lbbfindTheNames(CDS_lbbFindNameForm->searchString->value 
                                     CDS_lbbgetTheCurrentList(type) type)"
	  ?help "Layout" ;Look at Layout.HRF file for help
	  ?initialSize 225:75
       );hiCreateAppForm
    );unless not defined before

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(cadr(mainXY) < 500 then
       LROffset=0
    else
       LROffset=-210
    )
    case(type
       ("Lib"
	CDS_lbbFindNameForm->searchString->value=CDS_lbb_libFindString
	hiDisplayForm(CDS_lbbFindNameForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+40)
	CDS_lbb_libFindString= CDS_lbbFindNameForm->searchString->value
       )
       ("Cat"
	CDS_lbbFindNameForm->searchString->value=CDS_lbb_catFindString
	hiDisplayForm(CDS_lbbFindNameForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+240)
	CDS_lbb_catFindString= CDS_lbbFindNameForm->searchString->value
       )
       ("Cell"
	CDS_lbbFindNameForm->searchString->value=CDS_lbb_cellFindString
	hiDisplayForm(CDS_lbbFindNameForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+390)
	CDS_lbb_cellFindString= CDS_lbbFindNameForm->searchString->value
       )
       ("CellView"
	CDS_lbbFindNameForm->searchString->value=CDS_lbb_cellFindString
	hiDisplayForm(CDS_lbbFindNameForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+790)
	CDS_lbb_cellFindString= CDS_lbbFindNameForm->searchString->value
       )
    ) ; ** case type **
  ) ; ** prog **
) ; ** procedure CDS_findNameInListBox **


procedure(CDS_lbbChooseCellView()		  ;_Jul 17 00 sikand 1282
					;No view was selected, so have the user choose one (or multiple)
					;pop a form to ask for the search string
  prog((mainXY LROffset lbbChooseViewBox lbbChooseViewLabel)

    lbbChooseViewLabel=hiCreateLabel(
			  ?name 'lbbChooseViewLabel
			  ?labelText "Choose View(s)"
			  ?justification 'center
		       )
    lbbChooseViewBox= hiCreateListBoxField(
			 ?name 'lbbChooseViewBox
			 ?choices CDS_listBoxBrowserForm->cellViewListBox->choices
			 ?multipleSelect t
			 ?doubleClickCB "CDS_lbbUpdateAndClose()"
			 ?callback ""
		      )

					;go display the form
    hiCreateAppForm(
       ?name 'CDS_lbbChooseViewForm
       ?buttonLayout 'OKCancel
       ?fields list(
		  list(lbbChooseViewLabel         0:10  180:20    )
		  list(lbbChooseViewBox         0:40  180:75   0)
	       )
       ?formTitle "Select View Name"
       ?callback "CDS_lbbupdateListDisplay(CDS_lbbChooseViewForm->lbbChooseViewBox->value \"select\" \"CellView\")"
       ?help "Layout" ;Look at Layout.HRF file for help
       ?initialSize 190:175
    );hiCreateAppForm

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(car(mainXY) < 500 then
       LROffset=-50
    else
       LROffset=-230
    )
    hiDisplayForm(CDS_lbbChooseViewForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+600)
  ) ; ** prog **
) ; ** procedure CDS_lbbChooseCellView **



procedure(CDS_lbbCopyCell()			  ;_Mar  5 03 jdao 1992
  prog((destLibName srclib destlib srcell destcell)
    if(CDS_listBoxBrowserForm->cellListBox->value then
       CDS_lbbGetLibAndCellInfo()


       unless( CDS_lbbGetLibAndCellInfoForm->action
	  error("Operation aborted by user request")
       )
       
       
       ;;destLibName=CDS_lbbGetLibAndCellInfoForm->lbbCellLibNameField->value
       ;;when(destLibName == "" return())

       srclib = CDS_lbbGetLibAndCellInfoForm->lbbCellLibNameField->value
       destlib = CDS_lbbGetLibAndCellInfoForm->lbbTCellLibNameField->value
       srcell = CDS_lbbGetLibAndCellInfoForm->lbbCellNameField->value
       destcell = CDS_lbbGetLibAndCellInfoForm->lbbTCellNameField->value
       
       when( (destlib == srclib) &&  (srcell == destcell)
	  warn("Not copying cell onto itself!")
	  return()
       )
       
       
       if(length(CDS_listBoxBrowserForm->cellListBox->value) == 1 then
	  printf("Copying: %s  %s...\n" car(CDS_lbbselectedLibIDs)~>name 
		 car(CDS_listBoxBrowserForm->cellListBox->value))
	  CDS_FFdbCopyCell(?srcLib  srclib
			   ?srcCellName srcell
			   ?destLib destlib
			   ?destCellName destcell
			   ?copyHier CDS_lbbGetLibAndCellInfoForm->lbbCopyHierField->value 
			   ?copyFromRefLib CDS_lbbGetLibAndCellInfoForm->lbbRefLibField->value
			   ?updateInsts CDS_lbbGetLibAndCellInfoForm->lbbResetMasters->value
			   ?force CDS_lbbGetLibAndCellInfoForm->forceOverwrite->value)
					;use the movetocat command to update the cell list... yes I'm lazy
					;move to the top level since that is where the new cell ends up...
	  CDS_lbbmoveToCatUpdateCell("Top Level")
       else
	  destLibName=CDS_lbbGetLibAndCellInfoForm->lbbTCellLibNameField->value

	  when( srcell != destcell
	     error("Source and destination cell must match for multiple select copy!")
	  )
	  
	  

	  foreach(cell CDS_listBoxBrowserForm->cellListBox->value
	     printf("Copying: %s  %s...\n" car(CDS_lbbselectedLibIDs)~>name cell)
	     unless(CDS_FFdbCopyCell(?srcLib car(CDS_lbbselectedLibIDs)~>name
				     ?srcCellName cell 
				     ?destLib destLibName 
				     ?destCellName cell
				     ?copyHier CDS_lbbGetLibAndCellInfoForm->lbbCopyHierField->value
				     ?copyFromRefLib CDS_lbbGetLibAndCellInfoForm->lbbRefLibField->value
				     ?updateInsts CDS_lbbGetLibAndCellInfoForm->lbbResetMasters->value
				     ?force CDS_lbbGetLibAndCellInfoForm->forceOverwrite->value)

		printf("Error: Problem copying %s. Have you specified a valid Lib name?\n" cell) 
	     ) ; ** unless CDS_FFdbCopyCell **
	  ) ; ** foreach cell **
       );if/else length == 1
       printf("Copy command completed\n")
    else
       println("No cell selected!  Select one before choosing Copy Cell command.")
    ) ; ** if CDS_listBoxBrowserForm **
  ) ; ** prog **
) ; ** procedure CDS_lbbCopyCell **




procedure(CDS_lbbCopyCellView()			  ;_Jul 17 00 sikand 2538
  prog((cv destLibName)
    if(CDS_listBoxBrowserForm->cellListBox->value then
       if(length(CDS_listBoxBrowserForm->cellListBox->value) == 1 then
	  unless(car(CDS_listBoxBrowserForm->cellViewListBox->value)
	     if(length(CDS_listBoxBrowserForm->cellViewListBox->choices) == 1 then
		CDS_listBoxBrowserForm->cellViewListBox->value=CDS_listBoxBrowserForm->cellViewListBox->choices
	     else
		CDS_lbbChooseCellView()
	     )
	     unless(CDS_listBoxBrowserForm->cellViewListBox->value
		printf("You must choose a view before copying..\n")
		return()
	     )
	  ) ; ** unless car **
	  unless(CDS_lbbAskForName()
	     return()
	  )
	  when( CDS_lbbAskForNameForm->lbbNameField->value == "" ||
	     CDS_lbbAskForNameForm->lbbViewNameField->value == ""
	     return()
	  )

	  cv=CDS_FFdbCopyCellView(?srcLib car(CDS_lbbselectedLibIDs)~>name 
				  ?srcCellName car(CDS_listBoxBrowserForm->cellListBox->value)
				  ?srcViewName car(CDS_listBoxBrowserForm->cellViewListBox->value)
				  ?destLib car(CDS_lbbselectedLibIDs)~>name
				  ?destCellName CDS_lbbAskForNameForm->lbbNameField->value
				  ?destViewName CDS_lbbAskForNameForm->lbbViewField->value
				  ?destViewType CDS_viewTypeTable[CDS_lbbAskForNameForm->lbbViewField->value])

	  dbClose(cv)
					;use the movetocat command to update the cell list... yes I'm lazy
					;move to the top level since that is where the new cell ends up...
	  CDS_lbbmoveToCatUpdateCell("Top Level")
	  CDS_lbbcheckOtherForms(car(CDS_listBoxBrowserForm->cellListBox->value))
       else
	  CDS_lbbGetLibName() 
	  destLibName=CDS_lbbGetLibNameForm->CDS_lbbLibNameField->value
	  when(destLibName == ""
	     return()
	  )
	  foreach(cell CDS_listBoxBrowserForm->cellListBox->value
	     printf("Copying cellview %s to lib %s\n" cell destLibName)
	     cv=CDS_FFdbCopyCellView(?srcLib car(CDS_lbbselectedLibIDs)~>name  
				     ?srcCellName cell
				     ?srcViewName car(CDS_listBoxBrowserForm->cellViewListBox->value)
				     ?destLib destLibName 
				     ?destCellName cell
				     ?destViewName car(CDS_listBoxBrowserForm->cellViewListBox->value)
				     ?destViewType CDS_viewTypeTable[car(CDS_listBoxBrowserForm->cellViewListBox->value)])
	     if(cv then
		dbClose(cv)
	     else
		printf("Error: Problem copying %s. Have you specified a valid Lib name?\n" cell) 
	     )
	  ) ; ** foreach cell **
       );if one value
    else
       println("No cell selected!  Select one before choosing Copy Cellview command.")
    ) ; ** if CDS_listBoxBrowserForm **
  ) ; ** prog **
) ; ** procedure CDS_lbbCopyCellView **



procedure(CDS_lbbUpdateAndClose()		  ;_Jul 17 00 sikand 210
  CDS_lbbupdateListDisplay(CDS_lbbChooseViewForm->lbbChooseViewBox->value "select" "CellView")
  when(boundp('CDS_lbbChooseViewForm) hiFormCancel(CDS_lbbChooseViewForm))
)


procedure(CDS_lbbgetTheCurrentList(type)	  ;_Jul 17 00 sikand 320
  prog((currentList)
					;return the current list to apply any commands to 
    cond(
       (type == "Lib"
	currentList=CDS_lbblibraryList
       )
       (type == "Cat"
	currentList=CDS_lbbcategoryList
       )
       (type == "Cell"
	currentList=CDS_lbbcellList
       )
    ) ; ** cond type **
    return(currentList)
  );prog
) ; ** procedure CDS_lbbgetTheCurrentList **



procedure(CDS_lbbupdateListDisplay(selectValues mode section) ;_Jul 17 00 sikand 1018
					;update the appropriate list box field with the passed in list

  if(mode == "select" then
     cond(
	(section == "Lib" 
	 CDS_listBoxBrowserForm->libraryListBox->value = selectValues
	)
	(section == "Cat"
	 CDS_listBoxBrowserForm->categoryListBox->value = selectValues
	 CDS_lbbCurCat=CDS_listBoxBrowserForm->currentCatName->value
	)
	(section == "Cell"
	 CDS_listBoxBrowserForm->cellListBox->value = selectValues
	)
	(section == "CellView"
	 CDS_listBoxBrowserForm->cellViewListBox->value = selectValues
	)
     ) ; ** cond section **
  else ;case for "update"
     cond(
	(section == "Lib"
	 CDS_listBoxBrowserForm->libraryListBox->choices = selectValues
	)
	(section == "Cat"
	 CDS_listBoxBrowserForm->categoryListBox->choices = selectValues
	 CDS_lbbCurCat=CDS_listBoxBrowserForm->currentCatName->value
	)
	(section == "Cell"
	 CDS_listBoxBrowserForm->cellListBox->choices = selectValues
	)
	(section == "CellView"
	 CDS_listBoxBrowserForm->cellViewListBox->choices = selectValues
	)
     ) ; ** cond section **
  );if/else
) ; ** procedure CDS_lbbupdateListDisplay **



procedure(CDS_lbbfindTheNames(searchString searchList type) ;_Oct  3 02 sikand 0
  prog((catNames selectList libListToSearch)
					;go search the current display list for names that match the search string
					;if looking for a cell, look in all the categories.

    if(type == "Cell" then
					;look at all the cells in the lib, update the cat and lib fields if found
					;search in each lib selected in the library list box browser
       libListToSearch=CDS_listBoxBrowserForm->libraryListBox->value
       unless(libListToSearch 
	  println("No Libraries Selected!")
	  return()
       )
       foreach(lib libListToSearch
	  unless(CDS_lbbopenLibraryUpdateCat(lib "open")
	     return()
	  )
	  CDS_lbbupdateListDisplay(list(lib) "select" "Lib")
	  printf("Searching Lib: %s\n" lib)

					;first build a list that starts with the current category so we search it first.

	  
	  
	  when(CDS_lbbCurCat == "Top Level" || CDS_lbbCurCat == ""
	     CDS_lbbCurCat="Top Level"
	     CDS_listBoxBrowserForm->currentCatName->value=CDS_lbbCurCat
	  )
	  if( !CDS_lbbFlattenCats then
	     catNames='()
	     foreach(cat CDS_lbbGetLibCats(car(CDS_lbbselectedLibIDs))
		catNames=cons(cat catNames)
		catNames=append(CDS_lbbGetAllCatNames(lib cat) catNames)
	     )
					;make the current cat name the head of the list
	     catNames=append(list(CDS_lbbCurCat) remove(CDS_lbbCurCat catNames))
	     foreach(cat catNames
		CDS_lbbmoveToCatUpdateCell(cat)
		selectList = rexMatchList(searchString CDS_lbbcellList)
		unless(zerop(length(selectList))
					;return the list to the list box
		   CDS_lbbupdateListDisplay(selectList "select" type)
		   print("Names found => ")
		   println(selectList)
		   CDS_lbbcheckOtherForms(car(CDS_listBoxBrowserForm->cellListBox->value))
		   return()
		) ; ** unless zerop **
	     ) ; ** foreach cat **
	  else
	     selectList = rexMatchList(searchString CDS_lbbcellList)
	     CDS_lbbupdateListDisplay(selectList "select" type)
	     print("Names found => ")
	     println(selectList)
	     CDS_lbbcheckOtherForms(car(CDS_listBoxBrowserForm->cellListBox->value))
	     return()

	  ) ; ** if CDS_lbbFlattenCats **
	  
	  when(zerop(length(selectList))
	     println("No match")
	     CDS_lbbCurCat="Top Level"
	     CDS_listBoxBrowserForm->currentCatName->value=CDS_lbbCurCat
	     currentLib=CDS_listBoxBrowserForm->libraryListBox->value
	     CDS_lbbopenLibraryUpdateCat(car(currentLib) "open")
	  )    ; ** when zerop **
       );foreach lib

					;if we found no matchs at all, then just leave the browser in
					;the top level of the last lib searched
       printf("select list=%d" length(selectList))
       unless(zerop(length(selectList))
	  CDS_lbbmoveToCatUpdateCell("Top Level")
       ) 
    else
       selectList = rexMatchList(searchString searchList)
       if(zerop(length(selectList)) then
	  println("No match")
       else
					;return the list to the list box
	  CDS_lbbupdateListDisplay(selectList "select" type)
	  print("Names found => ")
	  println(selectList)
       ) ; ** if zerop **
    )  ; ** if type **
  ) ; ** prog **
) ; ** procedure CDS_lbbfindTheNames **


procedure(CDS_lbbGetAllCatNames(libName catName)  ;_Jul 17 00 sikand 349
					;go recurse down the cat tree to pick up all sub cats
  prog((catMems catList)
    catList='()
    catMems=CDS_lbbGetCatMembers(ddGetObj(libName) catName)
    foreach(mem catMems
       when(cadr(mem) == "category"
	  catList=cons(car(mem) catList)
	  catList=append(CDS_lbbGetAllCatNames(libName car(mem)) catList)
       )
    ) ; ** foreach mem **
    return(catList)
  ) ; ** prog **
) ; ** procedure CDS_lbbGetAllCatNames **


procedure(CDS_lbbOpenCell(mode @optional dblClk)  ;_Oct  3 02 sikand 0
  prog(()

					;update the cellview list box first
    CDS_lbbcheckOtherForms(car(CDS_listBoxBrowserForm->cellListBox->value
			   ))

					;allow editing directly with double click in the cellview list box
    when(dblClk && CDS_lbbdblClickMode == "edit" 
       mode = "a"
    )

    if(CDS_listBoxBrowserForm->cellListBox->value then
       when(length(CDS_listBoxBrowserForm->cellListBox->value) > 1
	  printf("Can only open one cell, taking the first on the list...\n")
       )
       unless(CDS_listBoxBrowserForm->cellViewListBox->value

					;default to the only view if there is just one...
	  if(length(CDS_listBoxBrowserForm->cellViewListBox->choices) == 1 then
	     CDS_listBoxBrowserForm->cellViewListBox->value=CDS_listBoxBrowserForm->cellViewListBox->choices
	  else
					;users can specify a default view to open (if it exists)
	     if(boundp('CDS_lbbDefaultView) then
		if(member(CDS_lbbDefaultView CDS_listBoxBrowserForm->cellViewListBox->choices) then
		   CDS_listBoxBrowserForm->cellViewListBox->value=list(CDS_lbbDefaultView)
		else
		   CDS_lbbChooseCellView()
		)
	     else
		CDS_lbbChooseCellView()
	     ) ; ** if boundp **
	  ) ; ** if length **
	  unless(CDS_listBoxBrowserForm->cellViewListBox->value
	     printf("You must select a cellView before opening...")
	     return()
	  )
       ) ; ** unless CDS_listBoxBrowserForm **
					;add to the history list
       CDS_LBBupdateHistList(strcat(car(CDS_lbbselectedLibIDs)~>name "  "
				    car(CDS_listBoxBrowserForm->cellListBox->value) "  "
				    car(CDS_listBoxBrowserForm->cellViewListBox->value)))

       geOpen(?lib  car(CDS_lbbselectedLibIDs)~>name
	      ?cell car(CDS_listBoxBrowserForm->cellListBox->value)
	      ?view car(CDS_listBoxBrowserForm->cellViewListBox->value)
	      ?mode mode)

    else
       printf("No cell selected...\n")
    ) ; ** if CDS_listBoxBrowserForm **
  ) ; ** prog **
) ; ** procedure CDS_lbbOpenCell **


procedure(CDS_lbbCreateNew(type @optional (newName nil)) ;_Mar 18 03 jdao 3509
						  ;create a new category, cell or library depending on setting of "Apply" 
  prog((viewName catID newPath cv)
    catID = nil

    case(type
       ("Lib"
	unless(newName
	   unless(CDS_lbbAskForLibName()
	      return()
	   )
	   newName=CDS_lbbAskForLibNameForm->lbbNameField->value
	   newPath=CDS_lbbAskForLibNameForm->lbbPathField->value
	) ; ** unless newName **
	when(ddGetObj(newName)
	   printf("Warning: Lib %s already exists...\n" newName)
	   return()
	)

					;create the lib and point to the standard techlib for techfile info
	unless(ddCreateLib(newName strcat(newPath "/" newName)  CDS_lbbAskForLibNameForm->dmOption->value)
	   printf("Error: Problem creating lib %s.  Check Unix directory permissions ...\n" newName)
	   return()
	)
	;; bind to system wide tech file
	techBindTechFile(ddGetObj(newName) CDS_P4ProjectTechLib)
	;; set the DM type explicitly
	CDS_ddSetLibDMSys(ddGetObj(newName) CDS_lbbAskForLibNameForm->dmOption->value)
	
	CDS_lbbrefreshTheLibList(t)
	CDS_listBoxBrowserForm->libraryListBox->value=list(newName)
	CDS_lbbopenLibraryUpdateCat(newName "open")
       )
       ("Cat"
	newName=CDS_lbbMoveForm->lbbNewCatName->value
	when(CDS_lbbCatTable[newName]
	   printf("Error: %s already exists in library: %s\n" newName
		  car(CDS_lbbselectedLibIDs)~>name)
	   return()
	)
	if((CDS_lbbCurCat == "Top Level") || (CDS_lbbCurCat == "") then
	   catID=ddCatOpen(car(CDS_lbbselectedLibIDs) newName "w")
	   unless( catID
	      error("Could not open category!")
	   )
	   

	   
	   CDS_lbbCatTable[newName]=list("Top Level" nil)
	else
	   catID=ddCatOpen(ddCatOpen(car(CDS_lbbselectedLibIDs) CDS_lbbCurCat "r") newName "w")
	   unless( catID
	      error("Could not open category!")
	   )

	   
	   CDS_lbbCatTable[newName]=list(CDS_lbbCurCat nil)
	) ; ** if CDS_lbbCurCat **
	CDS_lbbcategoryList=cons(newName CDS_lbbcategoryList)
	CDS_lbbcategoryList=remove("No Categories" CDS_lbbcategoryList)
	CDS_lbbcategoryList=remove("No Sub-Categories" CDS_lbbcategoryList)
	CDS_lbbcategoryList=sort(CDS_lbbcategoryList 'alphalessp)

	CDS_lbbupdateListDisplay(CDS_lbbcategoryList "update" "Cat")
	return(catID)
       )
       (list("Cell" "CellView")
	unless(newName
	   when(type == "CellView" && boundp('CDS_lbbAskForCellNameForm)
	      CDS_lbbAskForCellNameForm->lbbNameField->value=car(CDS_listBoxBrowserForm->cellListBox->value)
	   )
	   unless(CDS_lbbAskForCellName()
	      return()
	   )
	   newName=CDS_lbbAskForCellNameForm->lbbNameField->value
	) ; ** unless newName **
	viewName=CDS_lbbAskForCellNameForm->lbbViewNameField->value
	when(viewName == "" || newName == ""
	   printf("Error:  You must specify a cell name and view name\n")
	   return()
	)
	unless(CDS_viewTypeTable[viewName]
	   hiGetAttention()
	   printf("Error:  ViewType: %s not currently supported by listBoxBrowser.  See your CAD person to add it...\n" viewName) 
	   return()
	)

	cv=dbOpenCellViewByType(car(CDS_lbbselectedLibIDs) newName viewName CDS_viewTypeTable[viewName] "r")
	getWarn()  ;flush the warning
	if(cv then
	   unless(CDS_FFpopDialogBox(sprintf(nil "%s %s %s already exists.  Overwrite it?\n" 
					     car(CDS_lbbselectedLibIDs)~>name newName viewName))
	      return(nil)
	   )
	) ; ** if cv **
	if( viewName == "config" then
	   ;; this is a hack to get config views to work. Seems
	   ;; like ic50 has better support for config so hopefully
	   ;; we can get rid of this. jdao:03/18/2003
	   ;; open it with deNewCellView, this brings up the
	   ;;hierEditor
	   deNewCellView(car(CDS_lbbselectedLibIDs)~>name newName viewName CDS_viewTypeTable[viewName] nil)
	else
	   dbOpenCellViewByType(car(CDS_lbbselectedLibIDs) newName viewName CDS_viewTypeTable[viewName] "w")
	) ; ** if viewName **
	;;Move the new cell to the category we are currently in
	unless(CDS_lbbCurCat == "Top Level"
	   CDS_lbbMoveCellsToCategory(CDS_lbbCurCat list(newName))
	)
	CDS_lbbcellList=remove("No Cells" CDS_lbbcellList)
	unless(member(newName CDS_lbbcellList)
	   CDS_lbbcellList=cons(newName CDS_lbbcellList)
	   CDS_lbbcellList=CDS_lbbsortTheList("Cell" CDS_lbbcellList)
	)
	CDS_lbbupdateListDisplay(CDS_lbbcellList "update" "Cell")
	CDS_lbbviewList=ddGetObj(car(CDS_lbbselectedLibIDs)~>name newName)~>views~>name
	CDS_lbbviewList=sort(CDS_lbbviewList 'alphalessp)
	CDS_lbbupdateListDisplay(CDS_lbbviewList "update" "CellView")

					;open the layout editor
	unless( viewName == "config"
	   geOpen(?lib  car(CDS_lbbselectedLibIDs)~>name
		  ?cell newName
		  ?view viewName
		  ?viewType CDS_viewTypeTable[viewName]
		  ?mode "a")
	) ; ** unless viewName **
      ); ** list("Cell" "CellView")
    );case
    return(t)
  );prog
) ; ** procedure CDS_lbbCreateNew **




procedure(CDS_lbbIpcError(pid data)		  ;_Jul 17 00 sikand 16
  println(pid)
  printf("%s" data)
)


procedure(CDS_lbbDelete(type @optional (libName nil)) ;_Oct  3 02 sikand 6752
					;delete a  category, cell or library depending on setting of "Apply" 
  prog((catID cats allCatNames deleteList dddid cellListToDelete lbbDeleteViewField displayList
        mainXY LROffset libid cells viewList action formSize viewsToDel deleteCount deleteTotal
        delObj)

    catId = nil
    case(type
       ("Lib"
	if(libName then
	   CDS_listBoxBrowserForm->libraryListBox->value=list(libName)
	else
	   unless(CDS_WarnDialogBox("Delete Warn" "Do you really want to delete the lib(s)?")
	      return()
	   )
	) ; ** if libName **
					;go blow away all the selected libraries
	foreach(lib CDS_listBoxBrowserForm->libraryListBox->value

					;Had to first blow off categories first else we got .nfs file errors....
	   allCatNames='()
	   foreach(cat CDS_lbbGetLibCats(ddGetObj(lib))
	      allCatNames=cons(cat allCatNames)
	      allCatNames=append(CDS_lbbGetAllCatNames(lib cat) allCatNames)
	   )
	   
					;Comment this section out to demonstrate the delete lib problem
	   ;; I did -- Shiv
					; printf("Removing Old Categories...\n")
;                 foreach(cat allCatNames
;                     catID=ddCatOpen(ddGetObj(lib) cat "a")
;                     ddCatRemove(catID)
;                 )
	   
	   printf("\nRemoving Library: %s\n" lib)
	   ddDeleteObj(ddGetObj(lib))
	   ddSetForcedLib("cds.lib")
	   ddUpdateLibList()
	   CDS_lbblibraryList=CDS_lbbsortTheList("Lib" ddGetLibList()~>name)
	   CDS_lbbrefreshTheLibList(t)
	) ; ** foreach lib **
					;if we blew away all the libs, then stuff a default message 
	unless(CDS_lbblibraryList
	   CDS_lbblibraryList='("No Libraries")
	)
	CDS_lbbupdateListDisplay(CDS_lbblibraryList "update" "Lib")
	CDS_lbbrefreshTheLibList(t)
       )
       ("Cat"
	cats=CDS_listBoxBrowserForm->categoryListBox->value 
	foreach(category cats
	   deleteList='()

					;blow off all lower level cats, then the selected cat
	   deleteList=CDS_lbbGetAllCatNames(car(CDS_lbbselectedLibIDs)~>name category)
	   deleteList=cons(category deleteList)
	   foreach(cat deleteList
	      catID=ddCatOpen(car(CDS_lbbselectedLibIDs) cat "r")
	      when(catID
		 ddCatRemove(catID)
	      )
	      CDS_lbbcategoryList=remove(cat CDS_lbbcategoryList)
	      remove(cat CDS_lbbCatTable)
	   ) ; ** foreach cat **
	) ; ** foreach category **
	unless(CDS_lbbcategoryList
	   CDS_lbbcategoryList='("No Categories")
	)
	CDS_lbbupdateListDisplay(CDS_lbbcategoryList "update" "Cat")
	
					;check to see if we are at the top.  If we are then we need to regenerate
					;a new cell list.  If not, then we just update the category field.
	when((CDS_lbbCurCat == "Top Level")  || (CDS_lbbCurCat == "")
	   CDS_lbbmoveToCatUpdateCell("Top Level")
	)
       )
       ("Cell"
	unless(CDS_WarnDialogBox("Delete Warn" "     Do you really want to delete the cell(s)?\n (Includes all views- layout/schematic/symbol/etc.) ")
	   return()
	)
	unless(CDS_lbbCurCat == "Top Level"
	   catID=ddCatOpen(car(CDS_lbbselectedLibIDs) CDS_lbbCurCat  "a")
	   unless( catID
	      error("Could not open category!")
	   )
	) ; ** unless CDS_lbbCurCat **
					;go blow away all the selected cells
	deleteCount=1
	deleteTotal=length(CDS_listBoxBrowserForm->cellListBox->value)
	foreach(cell CDS_listBoxBrowserForm->cellListBox->value
	   printf("Deleting %d of %d => %s\n" deleteCount++ deleteTotal cell)
	   dddid = ddGetObj(car(CDS_lbbselectedLibIDs)~>name cell)
	   when( dddid
	      ddDeleteObj(dddid)
	   )
	   when(catID
	      ddCatSubItem(catID cell)
	   )
	   CDS_lbbcellList=remove(cell CDS_lbbcellList)
	) ; ** foreach cell **
	when(catID
	   ddCatSave(catID)
	   ddCatClose(catID)
	)
					;if we blew away all the cells, then stuff a default message, unless there are 
					;subcategories with cells in them 
	unless(CDS_lbbcellList
	   if(CDS_lbbCurCat == "Top Level" then
	      CDS_lbbcellList='("No Cells")
	   else
					;if there is a category, then we can stay here.  This is the case of a category
					;with only sub-categories as members.  This is legal.
	      if(car(CDS_lbbcategoryList) == "No Categories" ||
		 car(CDS_lbbcategoryList) == "No Sub-Categories" then
		 CDS_lbbpopOneCategoryLevel()
	      else
		 CDS_lbbcellList='("No Cells")
	      ) ; ** if car **
	   ) ; ** if CDS_lbbCurCat **
	) ; ** unless CDS_lbbcellList **
	unless(CDS_lbbcategoryList
	   CDS_lbbcategoryList='("No Categories")
	)
	CDS_lbbupdateListDisplay(CDS_lbbcategoryList "update" "Cat")
	CDS_lbbupdateListDisplay(CDS_lbbcellList "update" "Cell")
	CDS_lbbviewList='()
	CDS_lbbupdateListDisplay(CDS_lbbviewList "update" "CellView")
       )
       ("EmptyCells"
	unless(CDS_listBoxBrowserForm->libraryListBox->value
	   hiGetAttention()
	   printf("Must Select A Lib First...\n")
	   return()
	)
	foreach(cell car(CDS_lbbselectedLibIDs)~>cells
	   unless(cell~>views
	      printf("Deleting Empty Cell: %s\n" cell~>name)
	      ddDeleteObj(cell)
	   )
	) ; ** foreach cell **
	CDS_lbbrefreshTheLibList(t)
       )
       ("CellView"
	unless(car(CDS_listBoxBrowserForm->cellViewListBox->value)
	   if(length(CDS_listBoxBrowserForm->cellViewListBox->choices) == 1 then
	      CDS_listBoxBrowserForm->cellViewListBox->value=CDS_listBoxBrowserForm->cellViewListBox->choices
	   else
	      CDS_lbbChooseCellView()
	   )
	   unless(CDS_listBoxBrowserForm->cellViewListBox->value
	      printf("Error: No cellView exists to delete...\n")
	      return()
	   )
	) ; ** unless car **
	unless(CDS_WarnDialogBox("Delete Warn" "Do you really want to delete the cellView(s)?")
	   return()
	)

	foreach(view CDS_listBoxBrowserForm->cellViewListBox->value
	   printf("Deleting view %s %s\n" car(CDS_listBoxBrowserForm->cellListBox->value) view)
	   
	   when(delObj = ddGetObj(car(CDS_lbbselectedLibIDs)~>name car(CDS_listBoxBrowserForm->cellListBox->value) view)
	      ddDeleteObj(delObj)
	   )
	   	   
	   CDS_lbbviewList=remove(view CDS_lbbviewList)

					;if there are no more views for this cell, then delete the cell too
	   ;;unless(ddGetObj(car(CDS_lbbselectedLibIDs)~>name car(CDS_listBoxBrowserForm->cellListBox->value))~>views
	   unless(CDS_lbbviewList
					;move the cell to the top to get it out of any cat files
	      cellListToDelete=CDS_listBoxBrowserForm->cellListBox->value
	      CDS_lbbMoveCellsToCategory("Top Level" cellListToDelete)
	      printf("Deleting cell %s because it has no cellviews\n" car(cellListToDelete))
	      ;; only call ddDeleteObj if there are files to delete (property bags usually)
	      when(ddGetObj(car(CDS_lbbselectedLibIDs)~>name car(cellListToDelete))~>files
		 delObj = ddGetObj(car(CDS_lbbselectedLibIDs)~>name car(cellListToDelete))
		 when( delObj
		    ddDeleteObj(delObj)
		 )
	      ) ; ** when ddGetObj **
	      ;;printf("After deleting the cellview, there were no remaining views for cell: %s, so lbb deleted it as well...\n" car(cellListToDelete))
	      CDS_lbbcellList=remove(car(CDS_listBoxBrowserForm->cellListBox->value) CDS_lbbcellList)
	   ) ; ** unless CDS_lbbviewList **
	) ; ** foreach view **
					;if we blew away all the cellviews, then stuff a default message 
	unless(CDS_lbbcellList
	   CDS_lbbcellList='("No Cells")
	)
	CDS_lbbupdateListDisplay(CDS_lbbcellList "update" "Cell")
	CDS_lbbupdateListDisplay(CDS_lbbviewList "update" "CellView")
       )
       ("Views"
					;delete all specified views in a lib 
	lbbDeleteViewField= hiCreateStringField(
			       ?name 'lbbDeleteViewField
			       ?prompt "View Name(s)"
			       ?value ""
			       ?callback ""
			       ?format "%s"
			    )
	displayList=list(
		       list(lbbDeleteViewField           5:10 300:25  90)
		    )
	formSize= 350:120
	
					;go display the form
	hiCreateAppForm(
	   ?name 'CDS_lbbDeleteViewForm
	   ?buttonLayout 'OKCancelDef
	   ?fields displayList
	   ?formTitle "Delete All Views"
	   ?callback ""
	   ?help "Layout" ;Look at Layout.HRF file for help
	   ?initialSize formSize
	);hiCreateAppForm
	mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
	if(car(mainXY) < 500 then
	   LROffset=-150
	else
	   LROffset=-410
	)
	action=hiDisplayForm(CDS_lbbDeleteViewForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+140)

	when(CDS_lbbDeleteViewForm->lbbDeleteViewField->value == "" || !action
	   return()
	)

					;go delete all the specified views.  Give TWO warnings...
	unless(CDS_WarnDialogBox("Delete Warn" "Do you REALLY want to delete all these views in the lib?")
	   return()
	)
	viewsToDel=parseString(CDS_lbbDeleteViewForm->lbbDeleteViewField->value " ")
	libid=car(CDS_lbbselectedLibIDs)
	cells=libid~>cells
	viewList='()
	foreach(cell cells
	   foreach(view cell~>views
	      when(member(view~>name viewsToDel)
		 viewList=cons(view viewList)
	      )
	   )
	) ; ** foreach cell **
	deleteCount=1
	deleteTotal=length(viewList)
	foreach(view viewList
	   printf("Deleting %d of %d=> %s %s %s\n" deleteCount++ deleteTotal 
		  view~>lib~>name view~>cell~>name view~>name)
	   when(delObj = ddGetObj(view~>lib~>name view~>cell~>name view~>name)
	      ddDeleteObj(delObj)
	   )
	)
	CDS_lbbmoveToCatUpdateCell("Top Level")

					;clean up any cells that ended up without cellviews
	CDS_lbbDelete("EmptyCells")
	printf("Deleting Complete.\n")
       )
    ) ; ** case type **
  ) ; ** prog **
) ; ** procedure CDS_lbbDelete **


procedure(CDS_lbbUserFuncLoop()			  ;_Jul 17 00 sikand 633
					;procedure to go through each selected cell and call CDS_lbbUserFunc with the
					;cellviewID passed for the cell.

  prog((libname)

    when(zerop(length(CDS_listBoxBrowserForm->cellListBox->value))
       println("No Cells selected.  Select cells before running CDS_lbbUserFunc...")
       return()
    )
    libname=car(CDS_lbbselectedLibIDs)~>name
    foreach(cell CDS_listBoxBrowserForm->cellListBox->value
       foreach(cellview ddGetObj(libname cell)~>views
	  CDS_lbbUserFunc(dbOpenCellViewByType(libname cell cellview~>name))
       )
    )
    printf("CDS_lbbUserFunc Complete.\n")
  );prog
) ; ** procedure CDS_lbbUserFuncLoop **


procedure(CDS_lbbUserFunc(cv)			  ;_Jul 17 00 sikand 74
					;Initial CDS_lbbUserFunc - this would be reloaded with the users function.
  prog(()
    printf("Current Lib: %s\tCell: %s\t\tView:%s\n" cv~>libName cv~>cellName cv~>viewName)
  )
) ; ** procedure CDS_lbbUserFunc **



procedure(CDS_lbbMove()				  ;_Jul 17 00 sikand 2248
					;function to move cells into a category.  Optionally, create a new category if the user wants.
  prog((mainXY lbbMoveListBox lbbMoveLabel lbbMoveLabel1 LROffset catList libPath cats
	lbbNewCatName)

    when(zerop(length(CDS_listBoxBrowserForm->cellListBox->value))
       println("No Cells selected.  Select cells before trying to move them...")
       return()
    )
    
    libPath=car(CDS_lbbselectedLibIDs)~>readpath

    CDS_IPCBufferProcess(sprintf(nil "ls %s\n" libPath))
    catList=parseString(CDS_IPCBuffer "\n")
    cats=setof(x catList rexMatchp("\\.Cat$" x))
    cats=foreach(mapcar x cats substring(x 1 strlen(x)-4))
    cats=append(list("Top Level") cats)


					;pop a form to ask which category to put the cells in
    lbbMoveLabel=hiCreateLabel(
		    ?name 'lbbMoveLabel
		    ?labelText "Choose Category Or Enter New"
		    ?justification 'center
		 )
    lbbMoveLabel1=hiCreateLabel(
		     ?name 'lbbMoveLabel1
		     ?labelText "Category Name To Move Cells"
		     ?justification 'center
		  )
    lbbMoveListBox= hiCreateListBoxField(
		       ?name 'lbbMoveListBox
		       ?choices sort(cats 'alphalessp)
		       ?multipleSelect nil
		       ?callback ""
		    )
    lbbNewCatName= hiCreateStringField(
		      ?name 'lbbNewCatName
		      ?prompt "New Cat:"
		      ?value ""
		      ?callback ""
		      ?format "%s"
		   )
					;go display the form
    hiCreateAppForm(
       ?name 'CDS_lbbMoveForm
       ?buttonLayout 'OKCancelApply
       ?fields list(
		  list(lbbMoveLabel           0:10  190:20    )
		  list(lbbMoveLabel1          0:25  190:20    )
		  list(lbbMoveListBox          0:50  190:100  0)
		  list(lbbNewCatName          5:150 190:25  70)
	       )
       ?formTitle "Move Cells To Category"
       ?callback "CDS_lbbMoveCellsToCategory(car(CDS_lbbMoveForm->lbbMoveListBox->value)
                                            CDS_listBoxBrowserForm->cellListBox->value)"
       ?help "Layout" ;Look at Layout.HRF file for help
       ?initialSize 280:230
    );hiCreateAppForm

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(car(mainXY) < 500 then
       LROffset=-50
    else
       LROffset=-300
    )
    hiDisplayForm(CDS_lbbMoveForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+240)
  ) ; ** prog **
) ; ** procedure CDS_lbbMove **


procedure(CDS_lbbMoveCellsToCategory(catName cellsToMove) ;_Oct  3 02 sikand 0
					;move selected cells to a new category. 
  prog((catID currentCatID cellIDs newId )

    catID = nil
    currentCatID = nil
    unless(catName || (boundp('CDS_lbbMoveForm) && CDS_lbbMoveForm->lbbNewCatName->value) 
       return()
    )
					;if the user entered a new name, go create it before moving cells into it
    if(boundp('CDS_lbbMoveForm) && CDS_lbbMoveForm->lbbNewCatName->value != ""  then
       catName=CDS_lbbMoveForm->lbbNewCatName->value
       catID=CDS_lbbCreateNew("Cat" CDS_lbbMoveForm->lbbNewCatName->value)
    else
       unless(catName == "Top Level"
	  catID=ddCatOpen(car(CDS_lbbselectedLibIDs) catName "a")
	  unless( catID
	     error("Could not open category!")
	  )
       ) ; ** unless catName **
    ) ; ** if boundp **
    unless(CDS_lbbCurCat == "Top Level"
       currentCatID=ddCatOpen(car(CDS_lbbselectedLibIDs) CDS_lbbCurCat  "a")
       unless(currentCatID
	  error("Could not open category!")
       )
       
    ) ; ** unless CDS_lbbCurCat **
    cellIDs=setof(cell car(CDS_lbbselectedLibIDs)~>cells member(cell~>name cellsToMove))

					;remove cell(s) else we end up with duplicate cells in categories (except
					;when moving cells from the top level down into a category or where the catID
					;and currentCatID are = meaning we are creating a new cell within an existing cat)
    unless((CDS_lbbCurCat == "Top Level") || (CDS_lbbCurCat == "") ||
       (currentCatID == catID)
       foreach(cell cellIDs
	  ddCatSubItem(currentCatID cell~>name)
       )
       ddCatSave(currentCatID)
    ) ; ** unless CDS_lbbCurCat **

    unless(catName == "Top Level"
       foreach(cell cellIDs
	  newId=ddCatAddItem(catID cell~>name "cell")
	  unless(newId
	     println("Error: Cells were not successfully moved, check for valid lib and categories")
	     return()
	  )
       ) ; ** foreach cell **
       ddCatSave(catID)
    ) ; ** unless catName **
					;if CatID = currentCatID, we are creating a new cell within an existing cat
    unless(currentCatID == catID
       foreach(cell cellsToMove
	  CDS_lbbcellList=remove(cell CDS_lbbcellList)
       )
    )

					;don't try to close it twice if they are the same ID or we will get an error.
    if(currentCatID == catID then
       when(currentCatID ddCatClose(currentCatID))
    else
       when(currentCatID ddCatClose(currentCatID))
       when(catID ddCatClose(catID))
    ) ; ** if currentCatID **

					;update the browser
    if(!CDS_lbbcellList then
       CDS_lbbrefreshTheLibList() 
    else
       CDS_lbbupdateListDisplay(CDS_lbbcellList "update" "Cell")
       CDS_lbbviewList='()
       CDS_lbbupdateListDisplay(CDS_lbbviewList "update" "CellView")
    ) ; ** if CDS_lbbcellList **
    when(boundp('CDS_lbbMoveForm)
       CDS_lbbMoveForm->lbbNewCatName->value=""  ;reset for subsequent cell moves
    )
  ) ; ** prog **
) ; ** procedure CDS_lbbMoveCellsToCategory **



procedure(CDS_lbbAskForName()			  ;_Jul 17 00 sikand 1165
  prog((lbbNameField lbbViewField mainXY displayList formSize res LROffset)

    lbbNameField= hiCreateStringField(
		     ?name 'lbbNameField
		     ?prompt "Cell Name:"
		     ?value car(CDS_listBoxBrowserForm->cellListBox->value)
		     ?callback ""
		     ?format "%s"
		  )
    lbbViewField= hiCreateStringField(
		     ?name 'lbbViewField
		     ?prompt "View Name:"
		     ?value car(CDS_listBoxBrowserForm->cellViewListBox->value)
		     ?callback ""
		     ?format "%s"
		  )
    displayList=list(
		   list(lbbNameField           5:10 300:25  80)
		   list(lbbViewField           5:35 300:25  80)
		)
    formSize= 350:120

					;go display the form
    hiCreateAppForm(
       ?name 'CDS_lbbAskForNameForm
       ?buttonLayout 'OKCancelDef
       ?fields displayList
       ?formTitle "Enter New Name"
       ?callback ""
       ?help "Layout" ;Look at Layout.HRF file for help
       ?initialSize formSize
    );hiCreateAppForm

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(car(mainXY) < 500 then
       LROffset=-50
    else
       LROffset=-410
    )
    res=hiDisplayForm(CDS_lbbAskForNameForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+740)
    return(res)
  ) ; ** prog **
) ; ** procedure CDS_lbbAskForName **



procedure(CDS_lbbAskForCellName()		  ;_May  8 02 sikand 0
  prog((lbbNameField lbbViewNameField mainXY displayList formSize res LROffset)

					;define the form only once
    when(!(boundp('CDS_lbbAskForCellNameForm) && CDS_lbbAskForCellNameForm) || CDS_lbbformDebug 
       lbbNameField= hiCreateStringField(
			?name 'lbbNameField
			?prompt "Cell Name:"
			?value ""
			?callback ""
			?format "%s"
		     )
       lbbViewNameField= hiCreateStringField(
			    ?name 'lbbViewNameField
			    ?prompt "View Name:"
			    ?value ""
			    ?callback ""
			    ?format "%s"
			 )


       displayList=list(
		      list(lbbNameField           5:10 300:25  80)
		      list(lbbViewNameField       5:35 300:25  80)
		   )
       formSize= 350:120

					;go display the form
       hiCreateAppForm(
	  ?name 'CDS_lbbAskForCellNameForm
	  ?buttonLayout 'OKCancelDef
	  ?fields displayList
	  ?formTitle "Enter New Cell Name"
	  ?callback ""
	  
	  ?help "Layout" ;Look at Layout.HRF file for help
	  ?initialSize formSize
       );hiCreateAppForm
    );when not previously defined

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(car(mainXY) < 500 then
       LROffset=-50
    else
       LROffset=-410
    )
    res=hiDisplayForm(CDS_lbbAskForCellNameForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+440)
    return(res)
  ) ; ** prog **
) ; ** procedure CDS_lbbAskForCellName **



procedure(CDS_lbbGetLibName()			  ;_Jul 17 00 sikand 1082
  prog((CDS_lbbLibNameField mainXY LROffset)

   ;;;(definition of ask for Lib name form **********************************
					;define the form only once
    when(!(boundp('CDS_lbbGetLibNameForm) && CDS_lbbGetLibNameForm) || CDS_lbbformDebug 
       CDS_lbbLibNameField= hiCreateStringField(
			       ?name 'CDS_lbbLibNameField
			       ?prompt "Name of Lib to copy cells to:"
			       ?value ""
			       ?callback ""
			       ?format "%s"
			    )

					;go display the form
       hiCreateAppForm(
	  ?name 'CDS_lbbGetLibNameForm
	  ?buttonLayout 'OKCancelDef
	  ?fields list(
		     list(CDS_lbbLibNameField           5:10 350:25  180)
		  )
	  ?formTitle "Enter Lib Name"
	  ?callback ""
	  ?help "Layout" ;Look at Layout.HRF file for help
	  ?initialSize 400:80
       );hiCreateAppForm
    );when not defined before
   ;;; end of newname form) ;;;

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(car(mainXY) < 500 then
       LROffset=-50
    else
       LROffset=-460
    )
    hiDisplayForm(CDS_lbbGetLibNameForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+440)
  ) ; ** prog **
) ; ** procedure CDS_lbbGetLibName **



procedure(CDS_lbbGetLibAndCellInfo()		  ;_Oct  3 02 sikand 0
  prog((lbbCellLibNameField  lbbTCellLibNameField lbbCopyHierField lbbRefLibField 
	lbbResetMasters forceOverwrite mainXY LROffset lbbCellNameField
        lbbTCellNameField form)

   ;;;(definition of ask for Lib and cell info ******************************
					;define the form only once

    
    
    
    when(!(boundp('CDS_lbbGetLibAndCellInfoForm) && CDS_lbbGetLibAndCellInfoForm) || CDS_lbbformDebug 
       lbbCellLibNameField= hiCreateStringField(
			       ?name 'lbbCellLibNameField
			       ?prompt "Source Library:"
			       ?value car(CDS_lbbselectedLibIDs)~>name
			       ?callback ""
			       ?format "%s"
			    )


       lbbCellNameField= hiCreateStringField(
			    ?name 'lbbCellNameField
			    ?prompt "Source Cell:"
			    ?value car(CDS_listBoxBrowserForm->cellListBox->value)
			    ?callback ""
			    ?format "%s"
			 )


       lbbTCellLibNameField= hiCreateStringField(
				?name 'lbbTCellLibNameField
				?prompt "Target Library:"
				?value   car(CDS_lbbselectedLibIDs)~>name
				?callback ""
				?format "%s"
			     )

       lbbTCellNameField= hiCreateStringField(
			     ?name 'lbbTCellNameField
			     ?prompt "Target Cell:"
			     ?value car(CDS_listBoxBrowserForm->cellListBox->value)
			     ?callback ""
			     ?format "%s"
			  )

       
       lbbCopyHierField= hiCreateBooleanButton(
			    ?name 'lbbCopyHierField
			    ?buttonText "Copy cell hierarchy?"
			    ?value nil
			 )
       lbbRefLibField= hiCreateBooleanButton(
			  ?name 'lbbRefLibField
			  ?buttonText "Copy from reference libs?"
			  ?value nil
		       )
       lbbResetMasters= hiCreateBooleanButton(
			   ?name 'lbbResetMasters
			   ?buttonText "Reset Instance Masters?"
			   ?value t 
			)
       forceOverwrite= hiCreateBooleanButton(
			  ?name 'forceOverwrite
			  ?buttonText "Overwrite Existing Cells?"
			  ?value nil
		       )

					;go display the form
       hiCreateAppForm(
	  ?name 'CDS_lbbGetLibAndCellInfoForm
	  ?buttonLayout 'OKCancelDef
	  ?fields list(
		     list(lbbCellLibNameField       5:10  350:25  180)
		     list(lbbCellNameField       5:50  350:25  180)
		     list(lbbTCellLibNameField       5:90  350:25  180)
		     list(lbbTCellNameField       5:120  350:25  180)
		     list(lbbCopyHierField          5:160  200:20 170)
		     list(lbbRefLibField            5:185 200:20 170)
		     list(lbbResetMasters           5:210 200:20 170)
		     list(forceOverwrite            5:235 200:20 170)
		  )
	  ?formTitle "Copy Cell"
	  ?callback '("CDS_lbbGetLibAndCellInfoForm->action=t" "CDS_lbbGetLibAndCellInfoForm->action=nil")
	  
	  ?help "Layout" ;Look at Layout.HRF file for help
	  ?initialSize 400:400
       );hiCreateAppForm
    );when not defined before
    ;;; end of newname form) ;;;
    form = CDS_lbbGetLibAndCellInfoForm
    


    if(length(CDS_listBoxBrowserForm->cellListBox->value) >  1 then
       form~>lbbCellNameField~>editable = nil
       form~>lbbTCellNameField~>editable = nil
    else
       form~>lbbCellNameField~>editable = t
       form~>lbbCellNameField~>editable = t
    ) ; ** if length **

    mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid))
    if(car(mainXY) < 500 then
       LROffset=-50
    else
       LROffset=-455
    )
    form = CDS_lbbGetLibAndCellInfoForm
    form~>lbbTCellNameField~>value = car(CDS_listBoxBrowserForm->cellListBox->value)
    form~>lbbCellNameField~>value = car(CDS_listBoxBrowserForm->cellListBox->value)
    hiDisplayForm(CDS_lbbGetLibAndCellInfoForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+400)
  ) ; ** prog **
) ; ** procedure CDS_lbbGetLibAndCellInfo **



procedure(CDS_lbbClearListBox(selectList)	  ;_Jul 17 00 sikand 458
					;clear the various list boxes
  foreach(listBox selectList
     case(listBox
	("Cat"
	 CDS_lbbcategoryList='("No Categories")
	 CDS_lbbupdateListDisplay(CDS_lbbcategoryList "update" "Cat")
	 CDS_lbbCurCat = ""
	)
	("Cell"
	 CDS_lbbcellList=list("No Cells")
	 CDS_lbbupdateListDisplay(CDS_lbbcellList "update" "Cell")
	)
	("CellView"
	 CDS_lbbviewList='()
	 CDS_lbbupdateListDisplay(CDS_lbbviewList "update" "CellView")
	)
     ) ; ** case listBox **
  ) ; ** foreach listBox **
) ; ** procedure CDS_lbbClearListBox **


procedure(CDS_lbbsortTime(sortElementA sortElementB) ;_Jul 17 00 sikand 16
					;takes a list of names and times  ((name time) (name time) ...) and sorts them
					;into assending time order
  prog(()
    cond(
       (compareTime(cadr(sortElementA) cadr(sortElementB)) < 0
	return(nil)        ;return nil to sort which means swap elements
       )
       (compareTime(cadr(sortElementA) cadr(sortElementB)) > 0
	return(t)          ;return t to sort which means don't swap elements
       )
       (compareTime(cadr(sortElementA) cadr(sortElementB)) == 0
	return(t)       ;if A = B, then don't swap the elements
       )
    );cond
  );prog 
) ; ** procedure CDS_lbbsortTime **


procedure(CDS_lbbCloseDownForms(wid)		  ;_Jul 17 00 sikand 1149
					;close any open forms

					;now have to unregister window trigger in case we came to this cleanup
					;via the window->close rather than the Motif frame button (else we would
					;call this cleanup procedure twice)

  hiUnregCloseProc(wid "CDS_lbbCloseDownForms")
  when(boundp('CDS_lbbAskForNameForm) hiFormCancel(CDS_lbbAskForNameForm))
  when(boundp('CDS_lbbCellOptionsForm) hiFormCancel(CDS_lbbCellOptionsForm))
  when(boundp('CDS_lbbLibOptionsForm) hiFormCancel(CDS_lbbLibOptionsForm))
  when(boundp('CDS_lbbAskForLibNameForm) hiFormCancel(CDS_lbbAskForLibNameForm))
  when(boundp('CDS_lbbAskForCellNameForm) hiFormCancel(CDS_lbbAskForCellNameForm))
  when(boundp('CDS_lbbGetLibNameForm) hiFormCancel(CDS_lbbGetLibNameForm))
  when(boundp('CDS_lbbGetLibAndCellInfoForm) hiFormCancel(CDS_lbbGetLibAndCellInfoForm))
  when(boundp('CDS_lbbFindNameForm) hiFormCancel(CDS_lbbFindNameForm))
  when(boundp('CDS_lbbMoveForm) hiFormCancel(CDS_lbbMoveForm))
  when(boundp('CDS_lbbChooseViewForm) hiFormCancel(CDS_lbbChooseViewForm))
  when(boundp('CDS_LBBhistForm) hiFormCancel(CDS_LBBhistForm))
  
					;close the floorplanner window
  hiUnmapWindow(wid)
) ; ** procedure CDS_lbbCloseDownForms **
# Change User Description Committed
#1 4529 robert_yu p4 integrate from public/perforce/cdsp4/release/2.2/...
//guest/perforce_software/cdsp4/release/2.2/Skill/ListBoxBrowser/listBoxBrowser.il
#16 2957 Joe Dao Added lbb support for config views.
They are currently
not managed by cdsp4.

CDS_P4Config.il -- add config view to unmanaged list
CDS_P4Triggers.il --
          CDS_P4AnyCheckouts -- ignore deleted version at head of tree during
                 sync check
CDS_P4Globals -- add config view
listBoxBrowser --
            CDS_lbbCreateNew -- add support for config view
#15 2203 Shiv Sikand More delete bug fixes
#14 2202 Shiv Sikand Fix delete bug
#13 2197 Shiv Sikand Forgot to remove a debugging printf
#12 2196 Shiv Sikand Missed pruning when categories flattened
#11 2193 Shiv Sikand Delete overhaul part deux
#10 2192 Shiv Sikand Fix for Delete->Clean Catalog->Refresh
a) in lbb code, reject empty cells or views
b) clean the catalog on FirstAccessLib in background
       c) Bug fix where ipcId was not reported
#9 2185 Shiv Sikand re-fixed copy bug (brain fade)
#8 2184 Shiv Sikand whoops
#7 2183 Shiv Sikand Fix copy bug
#6 2181 Shiv Sikand Support Category Flattening
#5 1793 Shiv Sikand Deleted some left over cruf from an experiment that broke new cell
#4 1773 Shiv Sikand New copy support
support target lib and target cell
(rename support)
#3 1762 Shiv Sikand Don't use deNew coz we can't seed it
#2 1761 Shiv Sikand Move library new and cell new commands back to Cadence API calls
#1 1675 Shiv Sikand New 2.2 tree