;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 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. ; procedure(listBoxBrowser(@optional initMode) ;_Oct 2 02 sikand 6990 prog((libraryListBox categoryListBox cellListBox currentCatName categoryReturn libCommands catCommands cellCommands cellViewListBox cellViewCommands formXY p4VerFull p4Ver clientName libRefresh cellHist constants) p4VerFull="$Id: //guest/perforce_software/cdsp4/release/2.2/Skill/ListBoxBrowser/cdsp4_lib.il#9 $" p4Ver=head(parseString(cadr(parseString(p4VerFull "#")) " ")) printf("listBoxBrowser-ver #%s.\n" p4Ver) if(initMode == "init" then CDS_lbbformDebug=t else CDS_lbbformDebug=nil ) ; allow user to override in their .cdslocal unless(boundp('CDS_lbbFlattenCats) CDS_lbbFlattenCats = nil) ;need to initialize the options fields CDS_lbbDefineCellOptionsForm() CDS_lbbDefineLibOptionsForm() when(CDS_lbbdblClickMode == "edit" printf("Warning: You have listBoxBrowser's double-click mode set to \"Edit\"\n") ) unless(boundp('CDS_lbbCurCat) CDS_lbbCurCat="Top Level") unless(boundp('CDS_lbbselectedLibIDs) CDS_lbbselectedLibIDs='()) unless(boundp('CDS_lbb_libFindString) CDS_lbb_libFindString="") unless(boundp('CDS_lbb_catFindString) CDS_lbb_catFindString="") unless(boundp('CDS_lbb_cellFindString) CDS_lbb_cellFindString="") unless(boundp('CDS_lbbcategoryList) CDS_lbbcategoryList='("No Categories")) unless(boundp('CDS_lbbcellList) CDS_lbbcellList='("No Cells")) unless(boundp('CDS_lbbviewList) CDS_lbbviewList='()) unless(boundp('CDS_lbblibraryList) ;go get the initial lib,cat,cell lists CDS_lbblibraryList=CDS_lbbsortTheList("Lib" ddGetLibList()~>name) ) CDS_LBBhistList=CDS_LBBaccessHistFile("read") when(initMode == "init" CDS_lbbformDebug=t CDS_lbbcategoryList='("No Categories") CDS_lbbselectedLibIDs='() CDS_lbbcellList='("No Cells") CDS_lbbviewList='() CDS_lbb_libFindString="" CDS_lbb_catFindString="" CDS_lbb_cellFindString="" CDS_lbbCurCat="Top Level" ;go get the initial lib,cat,cell lists CDS_lbblibraryList=CDS_lbbsortTheList("Lib" ddGetLibList()~>name) ) ; ** when initMode ** ;now define the main listBoxBrowser form when(!(boundp('CDS_listBoxBrowserForm) && CDS_listBoxBrowserForm) || CDS_lbbformDebug ; if form exists, we have an explicit re-init. ; close form window, so form can be deleted when(boundp('CDS_listBoxBrowserForm) && CDS_listBoxBrowserForm hiCloseWindow(CDS_LBBwid) ) libRefresh= hiCreateButton( ?name 'libRefresh ?buttonText "Rfsh" ?callback "CDS_lbbrefreshTheLibList(t)" ) libCommands=hiCreateCyclicField( ?name 'libCommands ?prompt " " ?callback "CDS_lbbevalLibCommand()" ?value "Library Commands" ?choices '("Library Commands" "Copy" "Clean Catalog" "Find" "Library File Manager" "Integration Wizard" "Make local client" "New" "Options" "Properties" "Refresh" "Rename" "Revision" "Show Changes" "Show Checkouts" "Synchronize" "Update Access Lists" "Delete Empty Cells" "Delete Views" "Delete") ) catCommands=hiCreateCyclicField( ?name 'catCommands ?prompt " " ?callback "CDS_lbbevalCatCommand()" ?value "Category Commands" ?choices '("Category Commands" "Find" "Toggle Flatten" "Open" "Delete") ) cellHist= hiCreateButton( ?name 'cellHist ?buttonText "His" ?callback "CDS_LBBopenHistory()" ) cellCommands=hiCreateCyclicField( ?name 'cellCommands ?prompt " " ?callback "CDS_lbbevalCellCommand()" ?value "Cell Commands" ?choices '("Cell Commands" "Copy" "Edit" "Find" "Move" "New" "Options" "Properties" "Purge" "Read" "CDS_lbbUserFunc" "Delete") ) libraryListBox= hiCreateListBoxField( ?name 'libraryListBox ?choices CDS_lbblibraryList ?multipleSelect t ?doubleClickCB "CDS_lbbrefreshTheLibList()" ?callback "CDS_lbbrefreshTheLibList()" ) clientName= hiCreateStringField( ?name 'clientName ?prompt "" ?editable t ?callback "" ?format "%s" ) currentCatName= hiCreateStringField( ?name 'currentCatName ?prompt " " ?editable nil ?callback "" ?format "%s" ) categoryReturn= hiCreateButton( ?name 'categoryReturn ?buttonText "Ret" ?callback "CDS_lbbpopOneCategoryLevel()" ) categoryListBox= hiCreateListBoxField( ?name 'categoryListBox ?choices CDS_lbbcategoryList ?multipleSelect t ?doubleClickCB "CDS_lbbmoveToCatUpdateCell(car(CDS_listBoxBrowserForm->categoryListBox->value))" ?callback "" ) cellListBox= hiCreateListBoxField( ?name 'cellListBox ?choices CDS_lbbcellList ?multipleSelect t ?doubleClickCB "CDS_lbbOpenCell(\"r\" t)" ?callback "CDS_lbbcheckOtherForms(car(CDS_listBoxBrowserForm->cellListBox->value))" ) cellViewCommands=hiCreateCyclicField( ?name 'cellViewCommands ?prompt " " ?callback "CDS_lbbevalCellViewCommand()" ?value "CellView Commands" ?choices '("CellView Commands" "Cancel-Checkout" "Check-In" "Copy" "Edit" "New" "Properties" "Read" "Show Versions" "Delete") ) cellViewListBox= hiCreateListBoxField( ?name 'cellViewListBox ?choices CDS_lbbviewList ?multipleSelect t ?doubleClickCB "CDS_lbbOpenCell(\"r\" t)" ?callback "CDS_lbbcheckOtherForms(car(CDS_listBoxBrowserForm->cellListBox->value))" ) ;now go build and display the form constants = hicLeftPositionSet | hicRightPositionSet hiCreateAppForm( ?name 'CDS_listBoxBrowserForm ?buttonLayout 'OKCancel ?formTitle "Library Browser" ?fields list( list(libCommands 7:5 60:20 0) list(libRefresh 152:5 37:27 ) list(clientName 0:31 192:25 0) list(libraryListBox 0:60 192:100 0) list(catCommands 20:165 60:20 0) list(currentCatName 0:200 160:25 0) list(categoryReturn 161:202 30:27 ) list(categoryListBox 0:235 192:100 0) list(cellHist 154:345 35:27 0) list(cellCommands 14:345 60:20 0) list(cellListBox 0:375 192:350 0) list(cellViewCommands 20:725 60:20 0) list(cellViewListBox 0:755 192:80 0) ) ?attachmentList list( nil nil constants constants nil nil nil constants nil nil constants nil constants ) ?help "Layout" ;Look at Layout.HRF file for help ?initialSize 195:875 );hiCreateAppForm );unless not previously defined if(boundp('CDS_LBBwid) && windowp(CDS_LBBwid) then hiMapWindow(CDS_LBBwid) hiRaiseWindow(CDS_LBBwid) else ;make it so the user can specify a list of x:y coords in the .cdslocal if(boundp('CDS_lbbFormLocation) then formXY=CDS_lbbFormLocation else formXY=0:75 ) CDS_LBBwid=hiOpenWindow( ?bBox list(formXY car(formXY)+car(CDS_listBoxBrowserForm~>initialSize): cadr(formXY)+cadr(CDS_listBoxBrowserForm~>initialSize)) ?type "form" ?form CDS_listBoxBrowserForm ?closeProc "CDS_lbbCloseDownForms" ?help "CDS_listBoxBrowserForm" ;look at Layout.HRF file ) CDS_LBBwid->neverCurrentWindow=t CDS_LBBAddWindowBanner() ) ; ** if boundp ** ) ; ** prog ** ) ; ** procedure listBoxBrowser ** procedure(CDS_lbbupdateClientField() ;_Jul 19 00 sikand 901 prog((curLibId currentLib dmSys) ;go update the client field currentLib=CDS_listBoxBrowserForm->libraryListBox->value if(length(currentLib) == 1 then curLibId=ddGetObj(car(currentLib)) if(curLibId then dmSys=ddGetObjDMSys(curLibId) else dmSys="" ) if(dmSys == "p4" then CDS_listBoxBrowserForm->clientName->value=CDS_P4GetClient(ddGetObj(car(currentLib))) unless(CDS_listBoxBrowserForm->clientName->value hiGetAttention() printf("Fatal Error: Library client is bad. Bad return value from CDS_P4GetClient...\n") CDS_listBoxBrowserForm->libraryListBox->value='() CDS_lbbrefreshTheLibList() ) ; ** unless CDS_listBoxBrowserForm ** else CDS_listBoxBrowserForm->clientName->value="Not Revisioned" ) ; ** if dmSys ** else CDS_listBoxBrowserForm->clientName->value="" ) ; ** if length ** ) ; ** prog ** ) ; ** procedure CDS_lbbupdateClientField ** procedure(CDS_lbbCopyLib() ;_Jul 11 01 sikand 2603 ;procedure to copy all the cells in a library to a new library. The cells are ;opened and instance masters are re-mapped to the new lib if they were referencing ;the original lib to begin with. Return the new libName prog((curLibId newLib topCats cellList catList allCats catContents catID numCells curCount destLibFiles srcLibFiles id srcLoc destLoc ipcPid) curLibId=car(CDS_lbbselectedLibIDs) unless(CDS_lbbCreateNew("Lib") return() ) newLib=CDS_lbbAskForLibNameForm->lbbNameField->value numCells=length(curLibId~>cells) curCount=1 foreach(cell curLibId~>cells if(CDS_FFdbCopyCell(?srcLib curLibId~>name ?srcCellName cell~>name ?destLib CDS_lbbAskForLibNameForm->lbbNameField->value ?destCellName cell~>name ?copyHier nil ?force nil ?updateInsts nil ?copyFromRefLib nil) then printf("Copied cell %d of %d: %s...\n" curCount++ numCells cell~>name) else printf("Error: Problem copying %s. Have you specified a valid Lib name?\n" cell~>name) ) ; ** if CDS_FFdbCopyCell ** ) ; ** foreach cell ** ;now that all the cells are copied, go reset the instance pointers printf("Resetting Instance Master Pointers...\n") foreach(cell curLibId~>cells foreach(view cell~>views CDS_LFresetInstMasters(CDS_lbbAskForLibNameForm->lbbNameField->value cell~>name view~>name) ) ) ;now go re-create the categories and stuff the cells into them printf("Writing Category Data...\n") CDS_lbbCellAndCatTable=makeTable(gensym('CDS_lbbCellAndCatTable) nil) allCats='() topCats=CDS_lbbGetLibCats(curLibId) foreach(cat topCats allCats=append(allCats CDS_lbbGetAllCatNames(curLibId~>name cat)) allCats=cons(cat allCats) ) allCats=remove(nil allCats) foreach(cat allCats catContents=CDS_lbbGetCatMembers(curLibId cat) cellList='() catList='() foreach(item catContents when(cadr(item) == "cell" cellList=cons(car(item) cellList) ) when(cadr(item) == "category" catList=cons(car(item) catList) ) ) ; ** foreach item ** CDS_lbbCellAndCatTable[cat]=list(catList cellList) ) ; ** foreach cat ** ;now we have a table that describes the contents of each category so go build the cats ;in the new library. foreach(catItem CDS_lbbCellAndCatTable catID=ddCatOpen(ddGetObj(newLib) catItem "a") unless( catID error("Couldn't not open category") ) ;first add the subcategories foreach(cat car(CDS_lbbCellAndCatTable[catItem]) ddCatAddItem(catID cat "category") ) ;now add the cells foreach(cell cadr(CDS_lbbCellAndCatTable[catItem]) ddCatAddItem(catID cell "cell") ) ddCatSave(catID) ddCatClose(catID) ) ; ** foreach catItem ** ;now let's go make sure we got all the lib~>files copied ;don't copy the "%" backup files or the .p4client file (a non managed file) ;; or any old category files ;; or the lib prop file srcLibFiles=curLibId~>files destLibFiles=ddGetObj(newLib)~>files destLoc=ddGetObj(newLib)~>writePath foreach(file srcLibFiles srcLoc=file~>writePath unless(member(file~>name destLibFiles~>name) || rexMatchp("%" file~>name) || rexMatchp("\\Cat" file~>name) || file~>name == "dm.tag" || file~>name == "prop.xx" ipcPid=ipcBeginProcess(sprintf(nil "cp %s %s; chmod +w %s" srcLoc strcat(destLoc "/" file~>name) strcat(destLoc "/" file~>name) ) "" "CDS_lbbIpcError") ipcWait(ipcPid 60) unless(ipcGetExitStatus(ipcPid) return() ) ;check in the files id=ddGetObj(newLib nil nil file~>name nil "a") unless(ddGetObjDMSys(id) == "none" CDS_P4PostCreateObj(id~>lib id~>writePath symbolToString(id~>type) id) ) ) ; ** unless member ** ) ; ** foreach file ** printf("Copy Complete.\n") CDS_lbbrefreshTheLibList() return(CDS_lbbAskForLibNameForm->lbbNameField->value) );prog ) ; ** procedure CDS_lbbCopyLib ** procedure(CDS_lbbMakeLocal(ddid) ;_Jul 19 00 sikand 1013 let((clientRootField lbbNameField formSize displayList form) ;; set up a form and ask for root when(!(boundp('CDS_p4clientForm) && CDS_p4clientForm) lbbNameField= hiCreateStringField( ?name 'lbbNameField ?prompt "Lib name" ?value ddid~>name ?callback "" ?format "%s" ?editable nil ) clientRootField = hiCreateStringField( ?name 'clientRootField ?prompt "Client root" ?value "" ?editable t ) displayList=list( list(lbbNameField 5:10 300:25 80) list(clientRootField 5:60 300:25 80) ) formSize= 350:150 ;go display the form hiCreateAppForm( ?name 'CDS_p4clientForm ?buttonLayout 'OKCancelDef ?fields displayList ?callback 'CDS_lbbp4clientFormCB ?formTitle "Specify client root" ?initialSize formSize ) ) ; ** when boundp ** form = symeval('CDS_p4clientForm) form->appData = ddid hiDisplayForm(form) ) ; ** let ** ) ; ** procedure CDS_lbbMakeLocal ** procedure(CDS_lbbp4clientFormCB(form) ;_Jul 15 98 sikand 137 let(( clientroot ddid) ;; get the root clientroot = form->clientRootField->value ddid = form->appData CDS_P4MakeLocalCopy(ddid clientroot) ) ; ** let ** ) ; ** procedure CDS_lbbp4clientFormCB ** procedure(CDS_lbbRevision(lib) ;_Jan 17 03 sikand 1858 ; revision an unmanaged library in p4 prog(( lbbNameField libType displayList formSize mainXY LROffset res form clientNameField clientRootField chipOption customField defclient binfo) when( ddGetObjDMSys(lib) == "p4" CDS_P4Error("Revision" "Library is already managed by p4") return(nil) ) when(!(boundp('CDS_lbbRevisionForm) && CDS_lbbRevisionForm) || CDS_lbbformDebug lbbNameField= hiCreateStringField( ?name 'lbbNameField ?prompt "Lib name" ?value lib~>name ?callback "" ?format "%s" ?editable nil ) binfo = getShellEnvVar("PROJECT_BRANCH") if( binfo then defclient = strcat(lib~>name ":" binfo) else defclient = strcat(lib~>name ":" CDS_Project "_" CDS_ProjectRev) ) blockNameField = hiCreateStringField( ?name 'blockNameField ?prompt "Block name" ?value "" ) clientNameField = hiCreateStringField( ?name 'clientNameField ?prompt "Client name" ?value defclient ?editable t ) clientRootField = hiCreateStringField( ?name 'clientRootField ?prompt "Client root" ?value lib~>writePath ?editable t ) customField = hiCreateStringField( ?name 'customField ?prompt "Custom view" ?value "" ?editable t ) ;;chipOption = hiCreateCyclicField(?name 'chipOption ;;?choices '("common" "d" "g" "n" "r" "t") ;;?prompt "Chip" ;; ?value "common" ;;) ; ** when boundp ** libType=hiCreateCyclicField( ?name 'libType ?prompt "Lib Type " ?callback "CDS_lbbRevLibNameForm~>blockNameField~>editable=nil" ?value "Design" ?choices '("Reference" "Design" "Bulk") ) displayList=list( list(lbbNameField 5:10 300:25 80) list(blockNameField 5:50 300:25 80) list(clientNameField 5:90 300:25 80) list(clientRootField 5:130 300:25 80) list(customField 5:170 300:25 80) list(libType 5:210 100:20 60) ) formSize= 350:350 ;go display the form hiCreateAppForm( ?name 'CDS_lbbRevLibNameForm ?buttonLayout 'OKCancelDef ?fields displayList ?formTitle "Specify revision details" ?callback 'CDS_P4RevisionLib ?initialSize formSize ) ) ; ** when boundp ** mainXY=cadr(hiGetAbsWindowScreenBBox(CDS_LBBwid)) if(car(mainXY) < 500 then LROffset=-50 else LROffset=-410 ) form = symeval('CDS_lbbRevLibNameForm) form->appData = lib res=hiDisplayForm(CDS_lbbRevLibNameForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+175) return(res) ) ; ** prog ** ) ; ** procedure CDS_lbbRevision ** procedure(CDS_lbbAskForLibName() ;_Jan 17 03 sikand 867 prog((lbbPathField lbbNameField mainXY displayList formSize res LROffset dmOption libType chipOption) ;define the form only once when(!(boundp('CDS_lbbAskForLibNameForm) && CDS_lbbAskForLibNameForm) || CDS_lbbformDebug lbbNameField= hiCreateStringField( ?name 'lbbNameField ?prompt "Lib Name:" ?value "" ?callback "" ?format "%s" ) lbbPathField= hiCreateStringField( ?name 'lbbPathField ?prompt "Lib Path:" ?value "." ?defValue "." ?callback "" ?format "%s" ) dmOption=hiCreateCyclicField( ?name 'dmOption ?prompt "DM Type " ?callback "" ?value "none" ?choices '("p4" "none") ) libType=hiCreateCyclicField( ?name 'libType ?prompt "Lib Type " ?callback "" ?value "Design" ?choices '("Reference" "Design" "Bulk") ) displayList=list( list(lbbNameField 5:10 300:25 80) list(lbbPathField 5:35 300:25 80) ;;list(chipOption 5:70 300:25 80) list(dmOption 5:110 100:20 60) list(libType 150:110 100:20 60) ) formSize= 350:195 ; else ; displayList=list( ; list(lbbNameField 5:10 300:25 80) ; list(lbbPathField 5:35 300:25 80) ; ) ; formSize= 350:120 ;go display the form hiCreateAppForm( ?name 'CDS_lbbAskForLibNameForm ?buttonLayout 'OKCancelDef ?fields displayList ?formTitle "Enter New Lib 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_lbbAskForLibNameForm car(mainXY)+LROffset:cadr(hiGetMaxScreenCoords())-cadr(mainXY)+175) return(res) ) ; ** prog ** ) ; ** procedure CDS_lbbAskForLibName ** procedure(CDS_lbbShowVersions() ;_Jul 19 00 sikand 792 prog((cdbId) unless(car(CDS_listBoxBrowserForm->cellViewListBox->value) ;set selected value to the one and only as a default 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 show-versions...\n") return() ) ) ; ** unless car ** foreach(view CDS_listBoxBrowserForm->cellViewListBox->value cdbId=CDS_lbbGetMasterId(car(CDS_lbbselectedLibIDs)~>name car(CDS_listBoxBrowserForm->cellListBox->value) view) CDS_P4ShowVersions(cdbId) ) ) ; ** prog ** ) ; ** procedure CDS_lbbShowVersions **
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#9 | 2879 | Shiv Sikand | Bulk library support | ||
#8 | 2191 | Mike Klein | Allow user to override CDS_lbbFlattenCats in their .cdslocal. | ||
#7 | 2186 | Shiv Sikand |
raise window after unmap change to ktext |
||
#6 | 2182 | Shiv Sikand | Forgot to init the category flatten variable | ||
#5 | 2181 | Shiv Sikand | Support Category Flattening | ||
#4 | 2180 | Shiv Sikand | Add support for resizing width of listBoxBrowser | ||
#3 | 2065 | Shiv Sikand |
Bulk mode should not trigger checkout event Also make sure you don't try and check in a checked in object |
||
#2 | 1763 | Shiv Sikand |
Fix for revisioning libraries when branch is detected to support shared branch style libraries Old behaviour always resulted in Project and Project Rev mainline depot specs and client name style revisions. Never mattered before shared branch model was introduced because branch libraries were always propagated..... Last time this code was changed was July 1998 !! |
||
#1 | 1675 | Shiv Sikand | New 2.2 tree |