1/* 2 * TODO: 3 * - support reserved checkout repository - DONE not tested 4 * Add syntax/extension mapping to repository settings - DONE 5 * Issue with TABS display and invalid UTF8 strings on GTK - DONE 6 * - revamp batch jobs. - DONE 7 * Jobs: button to show number of running jobs - DONE 8 * Clicking on Jobs: button displays dialog listing each job (description, time submitted, status (Running, Completed) 9 * and menu to view and delete job details - DONE 10 * Jobs stay in log dir until they are deleted, so old jobs can be viewed in next session - DONE 11 * use "tee" for batch jobs so a permanent record of the job is retained - DONE 12 * have "log" directory for each repository so jobs for different repositories 13 * are listed seperately - DONE 14 * LabelModule: make it work with "standard" cvs - can't because CVS doesn't return correct 15 * info for common "linked" directories 16 * Add ListLocked command for a module. List all files that are checked out. - DONE 17 * Add Directory/File menu maintenance - DONE 18 * Finish Link Directory - DONE 19 * Finish GetAll - DONE (problem with dw_messagebox() under Win32 - removed messagebox) 20 * Finish Copy Repository; delete label files TODO 21 * Remove .label files from checkoutall/undocheckoutall - DONE 22 * When checking out (for lock), undo checkout, check in, update file buttons - DONE 23 * When adding directories, ignore "files to ignore" - DONE 24 * Finish Promote - DONE 25 default promote command: zip %V%.zip %D% 26 %V% version promoting (NOT dir,ver, but ver) 27 %D% !installdirs 28 need !installdirs, !promotecommand 29 * Make to run in background. Need to run it somehow in a native shell script that captures 30 all of the output. - DONE 31 * copy repository to work this way for CVS 32 - copy all files in labelfile from current repository directory to new repository directory 33 cp oldir/file,v newdir/file,v 34 - for each file in label file, get rel 35 - get labels for file 36 - for each label determine if the rel on the label > rel in labelfile 37 - if so, delete label: "rtag -d label" 38 - now all labels are gone, "admin -orel::" 39 - delete label files identified above 40 * LABEL command to include admin/build.conf, and this build.conf should be used when 41 building or promoting or an option to use original settings, or current settings! 42 * Renameinrepository still - DON'T provide rename 43 * ReportMods doesn't work across repositories. 44 Try being in test: test/working projects/latest - DONE 45 * Delete Repository 46 * Add bookmarks - DONE 47 * "flat" display of files - DONE 48 * Add Clear Output on messages pane - DONE 49 * Show Differences should not allow "Working" unless a working file exists - DONE 50 * Use cvs list only if !global.!!repository.!!enhanced_cvs.!!last_repository = 'Y' 51 * Determine if dw_exit() should be called! rexxdw.rexx does not use it. 52 * Have a module level exclusion list of directories and files that are NOT to 53 * be included in a label or build. Useful when large binaries are put in the 54 * repository but are not used in the build 55 * Check all callbacks when running "cvs" command in case we have lost access to CVS server; see UpdateCallbak 56 * 57 */ 58OPTIONS INTERNAL_QUEUES NOEXT_COMMANDS_AS_FUNCS 59!global.!version = '4.1.1' 60Numeric Digits 12 61 62Parse Version . vno . 63If vno < 5.00 Then Call AbortText "You need a version of Regina (Language Level) >= 5.00" 64Trace 'O' 65Parse Source os called_as prog 66If called_as \= 'SUBROUTINE' Then 67 Do 68 Say 'This program MUST be called as a subroutine' 69 Exit 1 70 End 71 72Signal on Halt 73/* 74signal on novalue 75*/ 76--!global.!container_disallows_icons = 1 77/* 78 * Parse our arguments... 79 */ 80!global.!batch_mode = 0 81If Arg() > 1 | Left( Arg(1), 2 ) = '-h' Then !global.!batch_mode = 1 82Do i = 1 To Arg() 83 If Arg( i ) = '-O' Then !global.!offline = 1 84 Else 85 Do 86 If !global.!batch_mode Then Queue Arg( i ) 87 End 88End 89/* 90Parse Arg !global.!_args 91Select 92 When Words( !global.!_args ) > 1 | Left( !global.!_args, 2 ) = '-h' Then !global.!batch_mode = 1 93 When Word( !global.!_args, 1 ) = '-o' Then 94 Do 95 !global.!offline = 1 96 !global.!_args = Delword( !global.!_args, 1, 1 ) 97 End 98 Otherwise Nop 99End 100*/ 101 102Call Initialisation 103 104/* 105 * Set things here that are need in batch as well as online 106 */ 107!global.!tempfiles.0 = 0 108!global.!mainwindow = '' /* set this here so we know if we have a main window to use */ 109!global.!color_background = '#eee5de' 110!global.!validcvstypes = 'local pserver rsh ssh' /* ensure these stay in this order */ 111!global.!usermenu_saved_variable_name.0 = 0 112/* 113 * We can run the administrative functions; label, build and 114 * promote in "batch" mode. So parse the command line and see 115 * if we are running a batch command. 116 */ 117If !global.!batch_mode Then Call Batch 118 119If RxFuncAdd( 'DW_LoadFuncs', 'rexxdw', 'DW_LoadFuncs' ) \= 0 Then 120 Do 121 Say 'No GUI environment available - running in batch mode.' 122 !global.!batch_mode = 1 123 Queue '-H' 124 Call Batch 125 End 126Call dw_loadfuncs 127 128/* 129Call RxFuncAdd 'CurlLoadFuncs', 'rexxcurl', 'CurlLoadFuncs' 130Call CurlLoadFuncs 131*/ 132 133Call dw_init 134!global.!screen_width = dw_screen_width() 135!global.!screen_height = dw_screen_height() 136Select 137 When !global.!screen_height > 768 Then !global.!toolbox_size = 32 138 When !global.!screen_height > 600 Then !global.!toolbox_size = 26 139 Otherwise !global.!toolbox_size = 20 140End 141/* 142 * We can set our font size for GTK now... 143 */ 144If !global.!os \= 'OS2' & !global.!os \= 'WIN32' & !global.!os \= 'WIN64' & !global.!os \= 'OSX' Then 145 Do 146 If !REXXDW.!GTK_MAJOR_VERSION > 1 Then 147 Do 148 If !global.!toolbox_size = 32 Then font_size = 10 149 Else font_size = 8 150 !global.!fixedfont = 'monospace' font_size 151 !global.!italicfont = 'monospace italic' font_size 152 !global.!boldfont = 'monospace bold italic' font_size 153 !global.!bolditalicfont = 'monospace italic' font_size 154 End 155 Else 156 Do 157 !global.!fixedfont = '-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1' 158 !global.!italicfont = '-adobe-courier-medium-o-normal-*-*-120-*-*-m-*-iso8859-1' 159 !global.!boldfont = '-adobe-courier-bold-r-normal-*-*-120-*-*-m-*-iso8859-1' 160 !global.!bolditalicfont = '-adobe-courier-bold-o-normal-*-*-120-*-*-m-*-iso8859-1' 161 End 162 End 163 164!global.!windowstyle = dw_or( !REXXDW.!DW_FCF_SYSMENU, !REXXDW.!DW_FCF_TITLEBAR, !REXXDW.!DW_FCF_SHELLPOSITION, !REXXDW.!DW_FCF_TASKLIST, !REXXDW.!DW_FCF_DLGBORDER, !REXXDW.!DW_FCF_SIZEBORDER, !REXXDW.!DW_FCF_MINMAX ) 165 166!global.!container_colour = dw_rgb( 255, 245, 225 ) 167 168!global.!months = 'January February March April May June July August September October November December' 169 170!global.!maxfilebuttons = 21 171!global.!maxfileseparators = 8 172!global.!buttonheight = 25 173!global.!widgetheight = 25 174 175!global.!running_jobs = '' 176/* 177 * Many dwindows callbacks fire while setting up the windows. 178 * Use this flag to indicate to our callback handlers to only 179 * operate when this has been set to 1. 180 */ 181!global.!allowcallbacks = 0 182/* 183 * Set !!last_repository to zero to allow the user settings file to be written during 184 * initial setup 185 */ 186!!last_repository = 0 187/* 188 * We have to read the users .qocca file to determine how many repositories they have 189 * configured, so we know how many notebook pages to create. 190 */ 191If Word( Stream( !global.!home'.qocca', 'C', 'FSTAT' ), 8 ) = 'RegularFile' Then 192 Do 193 Call ConvertOldUserSettingsFile 194 End 195Call ReadUserSettingsFile 196 197If Datatype( !global.!!user.!!bookmark.0 ) \= 'NUM' Then 198 Do 199 !global.!!user.!!bookmark.0 = 0 200 !global.!!user.!!bookmark_repository.0 = 0 201 End 202/* 203 * If we don't have a default repository, we have to ask the user to setup one 204 */ 205If !global.!!number_repositories = 0 | Left( !global.!!number_repositories, 1 ) = '!' Then 206 Do 207 If Stream( !global.!user_settings, 'C', 'QUERY EXISTS' ) = '' Then 208 Do 209 If UserPreferencesCallback( 'junk', 1 ) = 'close' Then Call CleanupAndExit 1 210 Call WriteUserSettingsFile 211 End 212 If GetNewRepository() = 'close' Then Call CleanupAndExit 1 213 End 214Else 215 Do 216 /* 217 * If we have 1 parameter passed, then assume it is a repository name 218 * to open with 219 If Words( !global.!_args ) = 1 Then 220 */ 221 If Arg() = 1 Then 222 Do 223 repno = FindRepository( Arg( 1 ) ) 224 If repno = 0 Then 225 Do 226 Call dw_messagebox 'Unknown repository', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Nothing known about "'Arg( 1 )'" repository.' 227 Call dw_exit 0 228 Exit 1 229 End 230 Else 231 !!last_repository = repno 232 End 233 End 234!global.!repfiles_flags.0 = 5 235If !global.!container_disallows_icons = 1 Then icon_flag = !REXXDW.!DW_CFA_STRING 236Else icon_flag = !REXXDW.!DW_CFA_BITMAPORICON 237!global.!repfiles_flags.1 = dw_or( icon_flag, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 238!global.!repfiles_flags.2 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 239!global.!repfiles_flags.3 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 240!global.!repfiles_flags.4 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 241!global.!repfiles_flags.5 = dw_or( icon_flag, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 242!global.!repfiles_titles.0 = 5 243!global.!repfiles_titles.1 = '' /* Sts */ 244!global.!repfiles_titles.2 = 'Revision Date' 245!global.!repfiles_titles.3 = 'Last Change' 246!global.!repfiles_titles.4 = 'Revision' 247!global.!repfiles_titles.5 = 'Reminder' 248!global.!allfiles_flags.0 = 6 249!global.!allfiles_flags.1 = dw_or( icon_flag, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 250!global.!allfiles_flags.2 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 251!global.!allfiles_flags.3 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 252!global.!allfiles_flags.4 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 253!global.!allfiles_flags.5 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 254!global.!allfiles_flags.6 = dw_or( icon_flag, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 255!global.!allfiles_titles.0 = 6 256!global.!allfiles_titles.1 = '' /* Sts */ 257!global.!allfiles_titles.2 = 'Revision Date' 258!global.!allfiles_titles.3 = 'Last Change' 259!global.!allfiles_titles.4 = 'Revision' 260!global.!allfiles_titles.5 = 'Directory' 261!global.!allfiles_titles.6 = 'Reminder' 262!global.!nonrepfiles_flags.0 = 3 263!global.!nonrepfiles_flags.1 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 264!global.!nonrepfiles_flags.2 = dw_or( !REXXDW.!DW_CFA_ULONG, !REXXDW.!DW_CFA_RIGHT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 265!global.!nonrepfiles_flags.3 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 266!global.!nonrepfiles_titles.0 = 3 267!global.!nonrepfiles_titles.1 = 'File Date' 268!global.!nonrepfiles_titles.2 = 'Size' 269!global.!nonrepfiles_titles.3 = 'Permissions' 270!global.!deletedfiles_flags.0 = 1 271!global.!deletedfiles_flags.1 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 272!global.!deletedfiles_titles.0 = 1 273!global.!deletedfiles_titles.1 = 'Revision' 274!global.!filefiltericons.0 = 6 275!global.!filefiltericons.1 = 'fileuptodate' ; !global.!filefiltericonsdesc.1 = 'Up-to-date' 276!global.!filefiltericons.2 = 'filemodified' ; !global.!filefiltericonsdesc.2 = 'Locally Modified' 277!global.!filefiltericons.3 = 'fileneedscheckout' ; !global.!filefiltericonsdesc.3 = 'Needs Checkout' 278!global.!filefiltericons.4 = 'fileneedspatch' ; !global.!filefiltericonsdesc.4 = 'Needs Patch' 279!global.!filefiltericons.5 = 'fileneedsmerge' ; !global.!filefiltericonsdesc.5 = 'Needs Merge' 280!global.!filefiltericons.6 = 'fileconflict' ; !global.!filefiltericonsdesc.6 = 'Conflicts' 281/* 282 * Create the main window now and show it 283 */ 284Call CreateMainWindow 285--Call dw_window_set_font !global.!mainwindow, !global.!fixedfont /* MH */ 286/* 287 * We now know the current repository we are working with; set 288 * the notebook tab to match 289 */ 290Call dw_notebook_page_set !global.!repnotebook, !global.!repnotebookpage.!!last_repository 291/* 292 * We can now change the main window title 293 */ 294Call SetWindowTitle 295 296!global.!repfile_sort_order = 0 /* default - name */ 297!global.!repfile_sort_direction.0 = 'ascending' /* name */ 298!global.!repfile_sort_direction.1 = 'ascending' /* status */ 299!global.!repfile_sort_direction.2 = 'ascending' /* date */ 300!global.!repfile_sort_direction.3 = 'ascending' /* user / locker */ 301!global.!repfile_sort_direction.4 = 'ascending' /* rev */ 302!global.!repfile_sort_direction.5 = 'ascending' /* reminder */ 303!global.!nonrepfile_sort_order = 0 /* default - name */ 304!global.!nonrepfile_sort_direction.0 = 'ascending' /* name */ 305!global.!nonrepfile_sort_direction.1 = 'ascending' /* date */ 306!global.!nonrepfile_sort_direction.2 = 'ascending' /* size */ 307!global.!nonrepfile_sort_direction.3 = 'ascending' /* perm */ 308!global.!allfile_sort_order = 0 /* default - name */ 309!global.!allfile_sort_direction.0 = 'ascending' /* name */ 310!global.!allfile_sort_direction.1 = 'ascending' /* status */ 311!global.!allfile_sort_direction.2 = 'ascending' /* date */ 312!global.!allfile_sort_direction.3 = 'ascending' /* user / locker */ 313!global.!allfile_sort_direction.4 = 'ascending' /* rev */ 314!global.!allfile_sort_direction.5 = 'ascending' /* reminder */ 315 316/* 317 * Catch syntax errors from here on. This allows us to remove temporary 318 * files we have created. 319 */ 320Signal on Syntax 321 322/* 323 * Now populate our windows with the details based on the repository we 324 * have selected 325 */ 326Call DisplayRepository 327Call PopulateBookmarks 328/* 329 * Our main loop 330 */ 331/* 332 * The following is the main event loop for this program. We check the 333 * variable !REXXDW.!HAVE_REXXCALLBACK to determine which mechanism 334 * can be used for callbacks. It is far better to use the mechanism 335 * offered by an interpreter that offers RexxCallBack() in its API. 336 */ 337If !REXXDW.!HAVE_REXXCALLBACK Then 338 Do 339 Call dw_main 340 End 341Else 342 Do Forever 343 cmd = dw_main_iteration() 344 If cmd \= '' Then Interpret 'Call' cmd 345 End 346 347Return 0 348 349Initialisation: Procedure Expose !REXXDW. !global. !!last_repository 350/* 351 * Various globals 352 */ 353!global.!crlf = d2c(13)||d2c(10) 354!global.!offline = 0 355!global.!remindertext = '' 356!global.!select_year = Substr( Date( 'S' ), 1, 4 ) 357!global.!select_month = Date( 'M' ) 358!global.!select_mon = Substr( Date( 'S' ), 5, 2 ) 359!global.!select_day = '' 360If Value( 'QOCCA_ADMINISTRATOR', , 'ENVIRONMENT' ) = '' Then !global.!superadministrator = 'N' 361Else !global.!superadministrator = 'Y' 362Parse Source os . prog 363Select 364 When os = 'WIN32' | os = 'WIN64' | os = 'OS2' | os = 'OS/2' Then 365 Do 366 !global.!home = Value( 'QOCCA_HOME', , 'ENVIRONMENT' ) 367 If !global.!home = '' Then !global.!home = 'c:\' 368 !global.!ossep = '\' 369 !global.!devnull = '> nul 2>&1' 370 !global.!stderrdevnull = '2> nul' 371 !global.!background_start_window = 'start' 372 !global.!background_start_nowindow = 'start /B' 373 !global.!datadir = '' /*'-D c:\bin'*/ 374 If os = 'WIN32' | os = 'WIN64' Then 375 Do 376 win = Uname( 'S' ) 377 If win = 'WIN95' | win = 'WIN98' | win = 'WINME' Then !global.!background_start_nowindow = 'start /M' 378 imagedir = 'images\win' 379 !global.!os = os 380 !global.!fixedfont = '8.Courier' 381 !global.!italicfont = '8.Courier Italic' 382 !global.!boldfont = '8.Courier Bold' 383 !global.!bolditalicfont = '8.Courier Bold Italic' 384 !global.!shell_ext = '.bat' 385 !global.!shell_rc = '%errorlevel%' 386 !global.!cmddelr = 'qrm -fr' 387 !global.!cmdrename = 'move' 388 !global.!cmdcopy = 'copy' 389 !global.!cmddiff = 'qdiff.exe' 390 !global.!cmdecho = 'qecho.exe -E' 391 !global.!cmdmkdir = 'qmkdir.exe -p' 392 !global.!cmdtee = 'qtee.exe' 393 rexxutil = 'rexxutil' 394 End 395 Else 396 Do 397 !global.!os = 'OS2' 398 imagedir = 'images\os2' 399 !global.!fixedfont = '5.System VIO' 400 !global.!italicfont = '5.System VIO Italic' 401 !global.!boldfont = '5.System VIO Bold' 402 !global.!bolditalicfont = '5.System VIO Bold Italic' 403 !global.!shell_ext = '.cmd' 404 !global.!shell_rc = '%errorlevel%' 405 !global.!cmddelr = 'rm -fr' 406 !global.!cmdrename = 'ren' 407 !global.!cmdcopy = 'copy' 408 !global.!cmddiff = 'diff.exe' 409 !global.!cmdecho = 'echo.exe' 410 !global.!cmdmkdir = 'mkdir.exe -p' 411 !global.!cmdtee = 'tee.exe' 412 rexxutil = 'regutil' 413 End 414 !global.!background_end = '' 415 !global.!shell_command = '' 416 !global.!shell_first_line = '@echo off' 417 !global.!command_prefix = 'call' 418 !global.!symlink = '' 419 !global.!rexxdiff = 'rexxdiff.exe' /*regina.exe -a \qocca\diff.rexx*/ 420 !global.!qocca_command = 'qocca.exe' /*regina \qocca\qocca.rexx*/ 421 Call Value 'CVS_PASSFILE', !global.!home'.cvspass', 'ENVIRONMENT' 422 End 423 When Uname( 'S' ) = 'Darwin' Then -- MacOS X 424 Do 425 !global.!home = Value( 'HOME', , 'ENVIRONMENT' ) 426 !global.!ossep = '/' 427 !global.!devnull = '> /dev/null 2>&1' 428 !global.!stderrdevnull = '2> /dev/null' 429 !global.!cmddelr = 'rm -fr' 430 !global.!cmdrename = 'mv' 431 !global.!cmdcopy = 'cp' 432 !global.!cmddiff = 'diff' 433 !global.!cmdecho = 'echo' 434 !global.!cmdmkdir = 'mkdir -p' 435 !global.!cmdtee = 'tee' 436 !global.!background_start_window = 'xterm -e' -- ??? 437 !global.!background_start_nowindow = '' 438 !global.!background_end = '&' 439 !global.!shell_ext = '.sh' 440 !global.!shell_command = 'sh' 441 !global.!shell_first_line = '#!/bin/sh' 442 !global.!shell_rc = '$?' 443 !global.!command_prefix = 'sh' 444 !global.!symlink = 'ln -sf' 445 -- determine which version of MacOS X we are running; 446 -- < 10.6 (Snow Leopard) "open" does not allow args to be passed 447 -- to an application 448 Address System 'sw_vers -productVersion' With Output Stem osxver. 449 If osxver.1 < 10.6 Then 450 Do 451 _args = '' 452 !global.!rexxdiff_by_env_variable = 1 453 End 454 Else 455 Do 456 _args = '--args' 457 !global.!rexxdiff_by_env_variable = 0 458 End 459 !global.!rexxdiff = 'open -n -b org.rexx.app.rexxdiff' _args 460 !global.!qocca_command = 'qocca' /*regina $HOME/qocca/qocca.rexx*/ 461 imagedir = 'images/win' -- ??? 462 !global.!datadir = '' 463 !global.!os = 'OSX' 464 rexxutil = 'regutil' 465 If Right( !global.!home, 1 ) \= '/' Then cvspass = !global.!home'/.cvspass' 466 Else cvspass = !global.!home'.cvspass' 467 Call Value 'CVS_PASSFILE', cvspass, 'ENVIRONMENT' 468 !global.!fixedfont = '10.Monaco' 469 !global.!italicfont = '10.Monaco Italic' 470 !global.!boldfont = '10.Monaco Bold' 471 !global.!bolditalicfont = '10.Monaco Bold Italic' 472 End 473 Otherwise /* Unixy OSes */ 474 Do 475 !global.!home = Value( 'HOME', , 'ENVIRONMENT' ) 476 !global.!ossep = '/' 477 !global.!devnull = '> /dev/null 2>&1' 478 !global.!stderrdevnull = '2> /dev/null' 479 !global.!cmddelr = 'rm -fr' 480 !global.!cmdrename = 'mv' 481 !global.!cmdcopy = 'cp' 482 !global.!cmddiff = 'diff' 483 !global.!cmdecho = 'echo' 484 !global.!cmdmkdir = 'mkdir -p' 485 !global.!cmdtee = 'tee' 486 !global.!background_start_window = 'xterm -e' 487 !global.!background_start_nowindow = '' 488 !global.!background_end = '&' 489 !global.!shell_ext = '.sh' 490 !global.!shell_command = 'sh' 491 !global.!shell_first_line = '#!/bin/sh' 492 !global.!shell_rc = '$?' 493 !global.!command_prefix = 'sh' 494 !global.!symlink = 'ln -sf' 495 !global.!rexxdiff = 'rexxdiff' /*regina -a $HOME/qocca/diff.rexx*/ 496 !global.!qocca_command = 'qocca' /*regina $HOME/qocca/qocca.rexx*/ 497 imagedir = 'images/win' 498 !global.!datadir = '' 499 !global.!os = os 500 rexxutil = 'rexxutil' 501 If Right( !global.!home, 1 ) \= '/' Then cvspass = !global.!home'/.cvspass' 502 Else cvspass = !global.!home'.cvspass' 503 Call Value 'CVS_PASSFILE', cvspass, 'ENVIRONMENT' 504 /* 505 * Setting the font for GTK has to wait until we have 506 * loaded Rexx/DW, so we can get the value of 507 * !REXXDW.!GTK_MAJOR_VERSION 508 */ 509 End 510End 511/* 512 * Based on the full path to ourselves, find the icons directory 513 */ 514pos = Lastpos( !global.!ossep, prog ) 515If pos = 0 Then base = '.' 516Else base = Substr( prog, 1, pos-1 ) 517len = Length( base ) 518If Translate( Right( base, 3 ) ) = 'BIN' Then 519 Do 520 !global.!icondir = Substr( base, 1, len-3 ) || 'share' || !global.!ossep || 'qocca' || !global.!ossep || imagedir || !global.!ossep 521 !global.!helpdir = Substr( base, 1, len-3 ) || 'share' || !global.!ossep || 'qocca' || !global.!ossep || 'help' || !global.!ossep 522 End 523Else 524 Do 525 !global.!icondir = base || !global.!ossep || imagedir || !global.!ossep 526 !global.!helpdir = base || !global.!ossep || 'help' || !global.!ossep 527 End 528/* 529 * Based on the full path to ourselves, find the base directory for highlight 530 * Don't do this for Unix platforms 531 */ 532If os = 'WIN32' | os = 'WIN64' | os = 'OS2' | os = 'OS/2' Then 533 Do 534 If Translate( Right( base, 3 ) ) = 'BIN' Then !global.!datadir = '-D' quote( Substr( base, 1, len-4 ) ) 535 Else !global.!datadir = '-D' quote( base ) 536 End 537/* 538 * Do we actually have highlight? 539 */ 540Address System 'highlight --version' With Output Stem junk. Error Stem junk. 541If rc = 0 Then !global.!have_highlight = 1 542Else !global.!have_highlight = 0 543 544!global.!valid_repository_types = 'cvs rcs svn' 545 546/* 547 * Load RexxUtil external function package 548 */ 549/* 550Call RxFuncAdd 'SysLoadFuncs', rexxutil, 'SysLoadFuncs' 551*/ 552Call RxFuncAdd 'sysloadfuncs', rexxutil, 'sysloadfuncs' 553Call SysLoadFuncs 554 555/* 556 * Get username and home values 557 */ 558user = Value( 'QOCCA_USERNAME', , 'ENVIRONMENT' ) 559If user = '' Then !global.!user = Userid() 560Else !global.!user = user 561If !global.!home = '' Then Call AbortText 'HOME environment value not set. Cannot continue' 562!global.!home = Changestr( '/', !global.!home, !global.!ossep ) 563If Right( !global.!home, 1 ) \= !global.!ossep Then !global.!home = !global.!home||!global.!ossep 564!global.!user_settings = !global.!home'.qocca'||!global.!ossep||'user.settings' 565 566/* 567 * If on Windows 32bit only, load w32funcs 568 */ 569If !global.!os = 'WIN32' Then 570 Do 571 Call RxFuncAdd 'w32loadfuncs','w32util','w32loadfuncs' 572 If w32loadfuncs() \= 0 Then 573 Do 574 Say RxFuncErrmsg() 575 Exit 1 576 End 577 !global.!loadedw32util = 1 578 End 579/* 580 * Load the Rexx/SQL functions for MySQL 581 */ 582!global.!havesql = 0 583/* 584!global.!havesql = 1 585If \!global.!batch_mode & !global.!os \= 'OS2' Then 586 Do 587 If RxFuncAdd( 'SQLLoadFuncs','rexxsql','SQLLoadFuncs' ) \= 0 Then 588 Do 589 Say RxFuncErrmsg() 590 !global.!havesql = 0 591 End 592 Else 593 Do 594 If sqlloadfuncs() \= 0 Then Exit 1 595 End 596 End 597*/ 598/* 599 * Defines the known templates for various compilers 600 */ 601Call SetCompilerTemplates 602 603Return 604 605DisplayRepository: Procedure Expose !REXXDW. !global. !!last_repository 606/* 607 * While setting up our display, don't allow callbacks to be processed 608 */ 609!global.!allowcallbacks = 0 610Call SetCursorWait 611 612Call DisplayStatus 'Setting environment...' 613Call SetRepositoryEnvs 614/* 615 * We are now pointing to a configuration (and have logged in if necessary) 616 */ 617Call DisplayStatus 'Reading repository settings...' 618Call ConnectToRepository !!last_repository 619Call GetConfigurationFile 620 621Call DisplayStatus 'Creating working environment...' 622Call SetupEnvironment 623 624Call GetModulesFromRepository 625/* 626 * Now we have all the repository information, we can create our tree 627 */ 628Call GenerateTree 629 630Call DisplayRepositoryFiles 631Call DisplayNonRepositoryFiles 632Call DisplayDeletedFiles 633/* 634 * Don't display "all files"; only generate this list when switching pages 635 */ 636/* 637 * Create/update our toolbars... 638 */ 639Call AdjustToolbars 640/* 641 * Blank out the status line 642 */ 643Call SetCursorNoWait 644Call DisplayStatus '' 645!global.!allowcallbacks = 1 646/* 647 * Reshow the main window because buttons could have changed 648 */ 649Call dw_window_show !global.!mainwindow 650Return 651 652AdjustToolbars: Procedure Expose !REXXDW. !global. !!last_repository 653Call CreateDirToolbarList 654Call CreateDirToolbar 655/* 656 * Now we know the current module (if there is one) 657 */ 658Call AdjustDirToolbarList 659Call AdjustDirToolbarButtons 660/* 661 * Create the file toolbox buttons 662 */ 663Call CreateFileToolbarList 664Call CreateFileToolbar 665/* 666 * Now we know the current files (if there are some) 667 */ 668Call AdjustFileToolbarList 669Call AdjustFileToolbarButtons 670Return 671 672ConvertOldUserSettingsFile: Procedure Expose !REXXDW. !global. !!last_repository 673/* 674 * Read the old .qocca file into memory variables 675 */ 676fn = !global.!home'.qocca' 677Call Stream fn, 'C', 'OPEN READ' 678Do While Lines(fn) > 0 679 Parse Value Linein(fn) With key '=' value 680 If key \= '' Then 681 Do 682 If Left( value, 8 ) = '"!GLOBAL.' Then value = '' 683 If key = '!!last_repository' Then Interpret key '=' value 684 Else Interpret '!GLOBAL.'key '=' value 685 End 686End 687Call Stream fn, 'C', 'CLOSE' 688!global.!!last_repository_name = !global.!!repository.!!name.!!last_repository 689!global.!!number_repositories = !global.!!repository.!!name.0 690/* 691 * Delete the .qocca file and create a directory with the same name 692 */ 693Call SysFileDelete fn 694Call CreateDirectory fn 695/* 696 * Now write the new config file and repository details 697 */ 698Call WriteUserSettingsFile 699Return 700 701ReadUserSettingsFile: Procedure Expose !REXXDW. !global. !!last_repository 702fn = !global.!user_settings 703Call Stream fn, 'C', 'OPEN READ' 704Do While Lines(fn) > 0 705 Parse Value Linein(fn) With key '=' value 706 If key \= '' Then 707 Do 708 If Left( value, 8 ) = '"!GLOBAL.' Then value = '' 709/* If key = '!!last_repository' Then Interpret key '=' value*/ 710 Interpret '!GLOBAL.'key '=' value 711 End 712End 713Call Stream fn, 'C', 'CLOSE' 714/* 715 * Now read all repository settings files 716 */ 717dir = !global.!home'.qocca' 718Call SysFileTree dir||!global.!ossep||'repository.*', 'FILE.', 'FO' 719/* 720 * If we have repository.* files then rename them to *.repository files 721 * and then read these in 722 */ 723Do i = 1 To file.0 724 fn = file.i 725 Parse Var fn . 'repository.' base 726 Address System !global.!cmdrename fn dir||!global.!ossep||base'.repository' With Output Stem junk. Error Stem junk. 727End 728Call SysFileTree dir||!global.!ossep||'*.repository', 'FILE.', 'FO' 729If file.0 > 0 Then 730 Do 731 /* 732 * In case we don't find a match, set the last repository to be 1 733 */ 734 !!last_repository = 1 735 If file.0 > 1 Then Call SysStemSort 'FILE.','ascending',!global.!!user.!!preference.!!sort, , , 1, 100 736 Do i = 1 To file.0 737 fn = file.i 738 Call Stream fn, 'C', 'OPEN READ' 739 Do While Lines(fn) > 0 740 Parse Value Linein(fn) With key '=' value 741 If key \= '' Then 742 Do 743 If Left( value, 8 ) = '"!GLOBAL.' Then value = '' 744 a = Value( key )'.'Value( i ) 745 Interpret '!GLOBAL'.a '=' value 746 End 747 End 748 Call Stream fn, 'C', 'CLOSE' 749 /* 750 * Check if this repository was the last one to be opened 751 */ 752 If !global.!!repository.!!name.i = !global.!!last_repository_name Then !!last_repository = i 753 /* 754 * Tidy up new variables and set defaults 755 */ 756 If Left( !global.!!repository.!!filefilters.i, 1 ) = '!' Then !global.!!repository.!!filefilters.i = '' 757 If Left( !global.!!repository.!!cvs_compression.i, 1 ) = '!' Then !global.!!repository.!!cvs_compression.i = '-z3' 758 End 759End 760!global.!!number_repositories = file.0 761Return 762 763WriteUserSettingsFile: Procedure Expose !REXXDW. !global. !!last_repository 764dir = !global.!home'.qocca' 765Call CreateDirectory dir 766/* 767 * Do a quick check that we have access to the variables we are writing; 768 * we don't want to stuff up the .qocca file! 769 */ 770If \DirectoryExists( Strip( !global.!!tmpdir, 'T', '/' ) ) | Datatype( !!last_repository ) \= 'NUM' | !global.!!user.!!textpager = '!GLOBAL.!!USER.!!TEXTPAGER' Then Return 771If !!last_repository \= 0 Then 772 Do 773 /* 774 * Write the repositories...if there are any 775 */ 776 If Left( !global.!!number_repositories, 1 ) \= '!' Then 777 Do i = 1 To !global.!!number_repositories 778 fn = dir||!global.!ossep||!global.!!repository.!!name.i'.repository' 779 Call Stream fn, 'C', 'OPEN WRITE REPLACE' 780 Call Lineout fn,'!!repository.!!name='Quote( !global.!!repository.!!name.i ) 781 Call Lineout fn,'!!repository.!!path='Quote( !global.!!repository.!!path.i ) 782 Call Lineout fn,'!!repository.!!type='Quote( !global.!!repository.!!type.i ) 783 Call Lineout fn,'!!repository.!!shortpath='Quote( !global.!!repository.!!shortpath.i ) 784 Call Lineout fn,'!!repository.!!server='Quote( !global.!!repository.!!server.i ) 785 Call Lineout fn,'!!repository.!!cvsport='Quote( !global.!!repository.!!cvsport.i ) 786 Call Lineout fn,'!!repository.!!username='Quote( !global.!!repository.!!username.i ) 787 Call Lineout fn,'!!repository.!!contype='Quote( !global.!!repository.!!contype.i ) 788 Call Lineout fn,'!!repository.!!password='Quote( !global.!!repository.!!password.i ) 789 Call Lineout fn,'!!repository.!!last_tree_opened='Quote( !global.!!repository.!!last_tree_opened.i ) 790 Call Lineout fn,'!!repository.!!working_dir='Quote( !global.!!repository.!!working_dir.i ) 791 Call Lineout fn,'!!repository.!!public_cvs='Quote( !global.!!repository.!!public_cvs.i ) 792 Call Lineout fn,'!!repository.!!public_cvs_dirs='Quote( !global.!!repository.!!public_cvs_dirs.i ) 793 Call Lineout fn,'!!repository.!!enhanced_cvs='Quote( !global.!!repository.!!enhanced_cvs.i ) 794 Call Lineout fn,'!!repository.!!filefilters='Quote( !global.!!repository.!!filefilters.i ) 795 Call Lineout fn,'!!repository.!!cvs_compression='Quote( !global.!!repository.!!cvs_compression.i ) 796 Call Stream fn, 'C', 'CLOSE' 797 End 798 /* 799 * Write the last repository, ... 800 Call Lineout fn,'!!last_repository='Quote( !!last_repository ) 801 */ 802 End 803/* 804 * Set the user settings configuration file name 805 */ 806fn = !global.!user_settings 807Call Stream fn, 'C', 'OPEN WRITE REPLACE' 808/* 809 * Write the last repository, ... 810 */ 811Call Lineout fn,'!!last_repository_name='Quote( !global.!!repository.!!name.!!last_repository ) 812/* 813 * ... now the user settings... 814 */ 815Call Lineout fn,'!!user.!!style='Quote( !global.!!user.!!style ) 816Call Lineout fn,'!!user.!!diffprog='Quote( !global.!!user.!!diffprog ) 817Call Lineout fn,'!!user.!!textpager='Quote( !global.!!user.!!textpager ) 818Call Lineout fn,'!!user.!!textpager_console='Quote( !global.!!user.!!textpager_console ) 819Call Lineout fn,'!!user.!!texteditor='Quote( !global.!!user.!!texteditor ) 820Call Lineout fn,'!!user.!!texteditor_console='Quote( !global.!!user.!!texteditor_console ) 821Call Lineout fn,'!!user.!!binarypager='Quote( !global.!!user.!!binarypager ) 822Call Lineout fn,'!!user.!!binarypager_console='Quote( !global.!!user.!!binarypager_console ) 823Call Lineout fn,'!!user.!!binaryeditor='Quote( !global.!!user.!!binaryeditor ) 824Call Lineout fn,'!!user.!!binaryeditor_console='Quote( !global.!!user.!!binaryeditor_console ) 825Call Lineout fn,'!!user.!!preference.!!sort='Quote( !global.!!user.!!preference.!!sort ) 826Call Lineout fn,'!!user.!!preference.!!confirm_exit='Quote( !global.!!user.!!preference.!!confirm_exit ) 827Call Lineout fn,'!!user.!!preference.!!save_position='Quote( !global.!!user.!!preference.!!save_position ) 828Call Lineout fn,'!!user.!!preference.!!debug_commands='Quote( !global.!!user.!!preference.!!debug_commands ) 829Call Lineout fn,'!!user.!!preference.!!showmodified='Quote( !global.!!user.!!preference.!!showmodified ) 830Call Lineout fn,'!!user.!!preference.!!windowsfileassociations='Quote( !global.!!user.!!preference.!!windowsfileassociations ) 831Call Lineout fn,'!!user.!!preference.!!windowsfileassociations_extensions='Quote( !global.!!user.!!preference.!!windowsfileassociations_extensions ) 832Call Lineout fn,'!!user.!!preference.!!tabspaces='Quote( !global.!!user.!!preference.!!tabspaces ) 833Call Lineout fn,'!!tmpdir='Quote( !global.!!tmpdir ) 834If Datatype( !global.!!user.!!filemenu.!!label.0 ) = 'NUM' Then 835 Do 836 Call Lineout fn,'!!user.!!filemenu.!!label.0='Quote( !global.!!user.!!filemenu.!!label.0 ) 837 Call Lineout fn,'!!user.!!filemenu.!!command.0='Quote( !global.!!user.!!filemenu.!!command.0 ) 838 Do i = 1 To !global.!!user.!!filemenu.!!label.0 839 Call Lineout fn,'!!user.!!filemenu.!!label.'i'='Quote( !global.!!user.!!filemenu.!!label.i ) 840 Call Lineout fn,'!!user.!!filemenu.!!command.'i'='Quote( !global.!!user.!!filemenu.!!command.i ) 841 End 842 End 843If Datatype( !global.!!user.!!dirmenu.!!label.0 ) = 'NUM' Then 844 Do 845 Call Lineout fn,'!!user.!!dirmenu.!!label.0='Quote( !global.!!user.!!dirmenu.!!label.0 ) 846 Call Lineout fn,'!!user.!!dirmenu.!!command.0='Quote( !global.!!user.!!dirmenu.!!command.0 ) 847 Do i = 1 To !global.!!user.!!dirmenu.!!label.0 848 Call Lineout fn,'!!user.!!dirmenu.!!label.'i'='Quote( !global.!!user.!!dirmenu.!!label.i ) 849 Call Lineout fn,'!!user.!!dirmenu.!!command.'i'='Quote( !global.!!user.!!dirmenu.!!command.i ) 850 End 851 End 852/* 853 * If not set, then the 0th item is zero. 854 * Set the 0th item of !!bookmark_repository to the same value as the base 855 */ 856If Datatype( !global.!!user.!!bookmark.0 ) \= 'NUM' Then !global.!!user.!!bookmark.0 = 0 857Call Lineout fn,'!!user.!!bookmark.0='Quote( !global.!!user.!!bookmark.0 ) 858Call Lineout fn,'!!user.!!bookmark_repository.0='Quote( !global.!!user.!!bookmark.0 ) 859Do i = 1 To !global.!!user.!!bookmark.0 860 Call Lineout fn,'!!user.!!bookmark.'i'='Quote( !global.!!user.!!bookmark.i ) 861 Call Lineout fn,'!!user.!!bookmark_repository.'i'='Quote( !global.!!user.!!bookmark_repository.i ) 862End 863Call Lineout fn,'!!user.!!window_pos_size='Quote( !global.!!user.!!window_pos_size ) 864Call Stream fn, 'C', 'CLOSE' 865Return 866 867/* 868 * Add bookmarks for the current repository into the bookmark combobox 869 */ 870PopulateBookmarks: Procedure Expose !REXXDW. !global. !!last_repository 871/* 872 * Clean out the entries currently in the listbox 873 */ 874count = dw_listbox_count( !global.!bookmarks_cb ) 875idx = 0 876Do i = 1 To count 877 Call dw_listbox_delete !global.!bookmarks_cb, idx 878End 879Call dw_window_set_text !global.!bookmarks_cb, '' 880/* 881 * Add the bookmarks for this repository 882 */ 883Do i = 1 To !global.!!user.!!bookmark.0 884 If !global.!!user.!!bookmark_repository.i = !!last_repository Then Call dw_listbox_append !global.!bookmarks_cb, !global.!!user.!!bookmark.i 885End 886Return 887 888SelectBookmarkCallback: Procedure Expose !REXXDW. !global. !!last_repository 889Parse Arg win, list_idx 890If list_idx < 0 Then Return 1 891text = dw_listbox_get_text( win, list_idx ) 892Call dw_window_set_text win, text 893Return 1 894 895SelectBookmarkApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 896/* 897 * For the selected bookmark, try and open it 898 */ 899text = Strip( dw_window_get_text( !global.!bookmarks_cb ) ) 900openat = 0 901Do i = 1 To !global.!repdir.!!last_repository.0 902 If !global.!repdir.!!last_repository.i = '/'text Then 903 Do 904 openat = i 905 Leave 906 End 907End 908If openat \= 0 Then 909 Do 910 /* 911 * Set the current dirname, open the tree and make it current... 912 */ 913 !global.!current_dirname.!!last_repository = Substr( !global.!repdir.!!last_repository.openat, 2 ) 914 Call OpenTreeAt openat 915 Call SetCursorWait 916 /* 917 * Adjust the directory toolbar 918 */ 919 Call AdjustDirToolbarList 920 Call AdjustDirToolbarButtons 921 /* 922 * Refresh the repository files, non-rep files and deleted files 923 * tabs. DO NOT refresh the all files tab; it takes too long unless 924 * it is the current tab 925 */ 926 Call DisplayRepositoryFiles 927 Call DisplayNonRepositoryFiles 928 Call DisplayDeletedFiles 929 If !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then Call DisplayAllFiles 930 /* 931 * If this directory is set for reserved checkout, 932 */ 933 Call SetLockedStatusIcon 934 /* 935 * Adjust the file toolbar as well! 936 */ 937 Call FileSelectCallback 938 Call SetCursorNoWait 939 End 940Return 0 941 942UserPreferencesCallback: Procedure Expose !REXXDW. !global. !!last_repository 943Parse Arg win, initial 944/* 945 * User preferences... 946 * 947 * +---------------------------------------------------------------------------------+ 948 * | Text | 949 * | | 950 * +---------------------------------------------------------------------------------+ 951 * | Text Editor: _______________________X Binary Editor: ____________________X | 952 * | Text Pager: _______________________X Binary Viewer: ____________________X | 953 * | Temp dir: _______________________X X Use Windows File Associations: | 954 * | Syntax Theme: _______________________v X Case Sensitive Sorting | 955 * | Diff Program: _______________________X Tab Spaces: _____________________v | 956 * | <Directory Menus> <File Menus> 957 * +---------------------------------------------------------------------------------+ 958 * 959 */ 960title_width = 100 961win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Edit User Preferences', !global.!windowstyle ) 962If initial Then 963 Do 964 /* 965 * We have to create the window icon here because the main window has not 966 * been created yet. 967 */ 968 qoccaicon = dw_icon_load_from_file( !global.!icondir'qocca' ) 969 End 970Else qoccaicon = !global.!qoccaicon 971Call dw_window_set_icon win, qoccaicon 972topbox = dw_box_new( !REXXDW.!DW_VERT ) 973Call dw_box_pack_start win, topbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 974/* 975 * Add a disabled MLE with instructions 976 */ 977t1 = dw_mle_new( 0 ) 978Call dw_box_pack_start topbox, t1, !REXXDW.!DW_SIZE_AUTO, 150, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 979Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 980Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 981Call UserPreferencesHelpFocusCallback t1, 'INITIAL', t1 982/* 983 * Add a horiz box for two columns of widgets 984 */ 985data_box = dw_box_new( !REXXDW.!DW_HORZ ) 986 Call dw_box_pack_start topbox, data_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 987/* 988 * Add a vertical box for the left column of widgets 989 */ 990left_box = dw_box_new( !REXXDW.!DW_VERT ) 991Call dw_box_pack_start data_box, left_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 5 992/* 993 * Add a vertical box for the right column of widgets 994 */ 995right_box = dw_box_new( !REXXDW.!DW_VERT ) 996Call dw_box_pack_start data_box, right_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 5 997/* 998 * Add the boxes and widgets for the left column... 999 */ 1000/* text editor */ 1001tmpbox = dw_groupbox_new( !REXXDW.!DW_VERT, 'Text Editor', !REXXDW.!DW_FONT_BOLD ) 1002Call dw_box_pack_start left_box, tmpbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 1003text_editor_box = dw_box_new( !REXXDW.!DW_HORZ ) 1004Call dw_box_pack_start tmpbox, text_editor_box, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1005If Left( !global.!!user.!!texteditor, 1 ) = '!' Then oldvalue = '' 1006Else oldvalue = !global.!!user.!!texteditor 1007text_editor_entry = dw_entryfield_new( oldvalue, 0 ) 1008Call dw_box_pack_start text_editor_box, text_editor_entry, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1009Call dw_signal_connect text_editor_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'UserPreferencesHelpFocusCallback', 'TEXTEDITOR', t1 1010abutton = dw_bitmapbutton_new_from_file( 'Browse', 0, !global.!icondir||'modulecheckedout' ) 1011Call dw_box_pack_start text_editor_box, abutton, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1012Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericFileSelector', text_editor_entry, 'Locate text editor', '', 1, !REXXDW.!DW_FILE_OPEN 1013text_editor_cb = dw_checkbox_new( 'Run in console', 0 ) 1014Call dw_box_pack_start tmpbox, text_editor_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1015If !global.!!user.!!texteditor_console = 1 Then Call dw_checkbox_set text_editor_cb, !REXXDW.!DW_CHECKED 1016Else Call dw_checkbox_set text_editor_cb, !REXXDW.!DW_UNCHECKED 1017/* text pager */ 1018tmpbox = dw_groupbox_new( !REXXDW.!DW_VERT, 'Text Viewer', !REXXDW.!DW_FONT_BOLD ) 1019Call dw_box_pack_start left_box, tmpbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 1020text_pager_box = dw_box_new( !REXXDW.!DW_HORZ ) 1021Call dw_box_pack_start tmpbox, text_pager_box, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1022If Left( !global.!!user.!!textpager, 1 ) = '!' Then oldvalue = '' 1023Else oldvalue = !global.!!user.!!textpager 1024text_pager_entry = dw_entryfield_new( oldvalue, 0 ) 1025Call dw_box_pack_start text_pager_box, text_pager_entry, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1026Call dw_signal_connect text_pager_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'UserPreferencesHelpFocusCallback', 'TEXTPAGER', t1 1027abutton = dw_bitmapbutton_new_from_file( 'Browse', 0, !global.!icondir||'modulecheckedout' ) 1028Call dw_box_pack_start text_pager_box, abutton, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1029Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericFileSelector', text_pager_entry, 'Locate text viewer', '', 1, !REXXDW.!DW_FILE_OPEN 1030text_pager_cb = dw_checkbox_new( 'Run in console', 0 ) 1031Call dw_box_pack_start tmpbox, text_pager_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1032If !global.!!user.!!textpager_console = 1 Then Call dw_checkbox_set text_pager_cb, !REXXDW.!DW_CHECKED 1033Else Call dw_checkbox_set text_pager_cb, !REXXDW.!DW_UNCHECKED 1034/* temp dir */ 1035tmp_dir_box = dw_box_new( !REXXDW.!DW_HORZ ) 1036Call dw_box_pack_start left_box, tmp_dir_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1037tmp = dw_text_new( 'Temp Directory', 0 ) 1038Call dw_box_pack_start tmp_dir_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1039Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1040/* 1041 * If this is the first time through, try and find the user's temp directory... 1042 */ 1043If initial Then 1044 Do 1045 oldvalue = GetUserTempDirectory() 1046 End 1047Else 1048 Do 1049 If Left( !global.!!tmpdir, 1 ) = '!' Then oldvalue = '' 1050 Else oldvalue = !global.!!tmpdir 1051 End 1052tmp_dir_entry = dw_entryfield_new( oldvalue, 0 ) 1053Call dw_box_pack_start tmp_dir_box, tmp_dir_entry, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1054Call dw_signal_connect tmp_dir_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'UserPreferencesHelpFocusCallback', 'TMPDIR', t1 1055abutton = dw_bitmapbutton_new_from_file( 'Browse', 0, !global.!icondir||'modulecheckedout' ) 1056Call dw_box_pack_start tmp_dir_box, abutton, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1057Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericDirectorySelector', tmp_dir_entry, 'Set Temporary Directory to:' 1058/* diff program */ 1059diff_program_box = dw_box_new( !REXXDW.!DW_HORZ ) 1060Call dw_box_pack_start left_box, diff_program_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1061tmp = dw_text_new( 'Diff Program', 0 ) 1062Call dw_box_pack_start diff_program_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1063Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1064If Left( !global.!!user.!!diffprog, 1 ) = '!' Then oldvalue = '' 1065Else oldvalue = !global.!!user.!!diffprog 1066diff_program_entry = dw_entryfield_new( oldvalue, 0 ) 1067Call dw_box_pack_start diff_program_box, diff_program_entry, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1068Call dw_signal_connect diff_program_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'UserPreferencesHelpFocusCallback', 'DIFFPROG', t1 1069abutton = dw_bitmapbutton_new_from_file( 'Browse', 0, !global.!icondir||'modulecheckedout' ) 1070Call dw_box_pack_start diff_program_box, abutton, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1071Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericFileSelector', diff_program_entry, 'Locate diff program', '', 1, !REXXDW.!DW_FILE_OPEN 1072/* empty space */ 1073Call dw_box_pack_start left_box, 0, 0, 10, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1074/* directory menu */ 1075b2 = dw_button_new( 'Maintain Directory Menus', 0 ) 1076Call dw_box_pack_start left_box, b2, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1077Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'ModifyUserMenuCallback', 'DIR' 1078/* 1079 * Add the boxes and widgets for the right column... 1080 */ 1081/* binary editor */ 1082tmpbox = dw_groupbox_new( !REXXDW.!DW_VERT, 'Binary Editor', !REXXDW.!DW_FONT_BOLD ) 1083Call dw_box_pack_start right_box, tmpbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 1084binary_editor_box = dw_box_new( !REXXDW.!DW_HORZ ) 1085Call dw_box_pack_start tmpbox, binary_editor_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1086If Left( !global.!!user.!!binaryeditor, 1 ) = '!' Then oldvalue = '' 1087Else oldvalue = !global.!!user.!!binaryeditor 1088binary_editor_entry = dw_entryfield_new( oldvalue, 0 ) 1089Call dw_box_pack_start binary_editor_box, binary_editor_entry, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1090Call dw_signal_connect binary_editor_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'UserPreferencesHelpFocusCallback', 'BINARYEDITOR', t1 1091abutton = dw_bitmapbutton_new_from_file( 'Browse', 0, !global.!icondir||'modulecheckedout' ) 1092Call dw_box_pack_start binary_editor_box, abutton, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1093Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericFileSelector', binary_editor_entry, 'Locate binary editor', '', 1, !REXXDW.!DW_FILE_OPEN 1094binary_editor_cb = dw_checkbox_new( 'Run in console', 0 ) 1095Call dw_box_pack_start tmpbox, binary_editor_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1096If !global.!!user.!!binaryeditor_console = 1 Then Call dw_checkbox_set binary_editor_cb, !REXXDW.!DW_CHECKED 1097Else Call dw_checkbox_set binary_editor_cb, !REXXDW.!DW_UNCHECKED 1098/* binary pager */ 1099tmpbox = dw_groupbox_new( !REXXDW.!DW_VERT, 'Binary Viewer', !REXXDW.!DW_FONT_BOLD ) 1100Call dw_box_pack_start right_box, tmpbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 1101binary_pager_box = dw_box_new( !REXXDW.!DW_HORZ ) 1102Call dw_box_pack_start tmpbox, binary_pager_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1103If Left( !global.!!user.!!binarypager, 1 ) = '!' Then oldvalue = '' 1104Else oldvalue = !global.!!user.!!binarypager 1105binary_pager_entry = dw_entryfield_new( oldvalue, 0 ) 1106Call dw_box_pack_start binary_pager_box, binary_pager_entry, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1107Call dw_signal_connect binary_pager_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'UserPreferencesHelpFocusCallback', 'BINARYPAGER', t1 1108abutton = dw_bitmapbutton_new_from_file( 'Browse', 0, !global.!icondir||'modulecheckedout' ) 1109Call dw_box_pack_start binary_pager_box, abutton, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1110Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericFileSelector', binary_pager_entry, 'Locate binary viewer', '', 1, !REXXDW.!DW_FILE_OPEN 1111binary_pager_cb = dw_checkbox_new( 'Run in console', 0 ) 1112Call dw_box_pack_start tmpbox, binary_pager_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1113If !global.!!user.!!binarypager_console = 1 Then Call dw_checkbox_set binary_pager_cb, !REXXDW.!DW_CHECKED 1114Else Call dw_checkbox_set binary_pager_cb, !REXXDW.!DW_UNCHECKED 1115/* tab spaces spinbutton */ 1116tab_spaces_box = dw_box_new( !REXXDW.!DW_HORZ ) 1117Call dw_box_pack_start right_box, tab_spaces_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1118tmp = dw_text_new( 'Tab Spaces', 0 ) 1119Call dw_box_pack_start tab_spaces_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1120Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1121sb = dw_spinbutton_new( '', 0 ) 1122Call dw_box_pack_start tab_spaces_box, sb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1123Call dw_spinbutton_set_limits sb, 20, 0 1124If Datatype( !global.!!user.!!preference.!!tabspaces ) \= 'NUM' Then !global.!!user.!!preference.!!tabspaces = 4 1125Call dw_spinbutton_set_pos sb, !global.!!user.!!preference.!!tabspaces 1126Call dw_signal_connect sb, !REXXDW.!DW_SET_FOCUS_EVENT, 'UserPreferencesHelpFocusCallback', 'TABSPACES', t1 1127/* 1128 * Now the user's default syntax highlighter 1129 */ 1130If initial Then 1131 Do 1132 stylebox = '' 1133 Call dw_box_pack_start right_box, 0, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1134 End 1135Else 1136 Do 1137 Call DisplayStatus 'Getting syntax highlighting themes...' 1138 1139 tmp_box = dw_box_new( !REXXDW.!DW_HORZ ) 1140 Call dw_box_pack_start right_box, tmp_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1141 tmp = dw_text_new( 'Syntax Theme', 0 ) 1142 Call dw_box_pack_start tmp_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1143 Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1144 If Left( !global.!!user.!!style, 1 ) = '' Then default_style = '' 1145 Else default_style = !global.!!user.!!style 1146 stylebox = dw_combobox_new( default_style, 0 ) 1147 Call dw_box_pack_start tmp_box, stylebox, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1148 Address System 'highlight -w' !global.!datadir With Output Stem styles. Error Stem junk. 1149 Do i = 1 To styles.0 1150 If Words( styles.i ) = 1 Then Call dw_listbox_append stylebox, Strip( styles.i ) 1151 End 1152 Call dw_signal_connect stylebox, !REXXDW.!DW_LIST_SELECT_EVENT, 'SelectStyleCallback' 1153 Call dw_window_set_text stylebox, default_style /* default value doesn't work in dw_combobox_new */ 1154 1155 Call DisplayStatus '' 1156 End 1157/* empty space */ 1158Call dw_box_pack_start right_box, 0, 0, 10, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1159/* file menu */ 1160b1 = dw_button_new( 'Maintain File Menus', 0 ) 1161Call dw_box_pack_start right_box, b1, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1162Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'ModifyUserMenuCallback', 'FILE' 1163/* -- checkboxes in groupbox - full width-- */ 1164groupbox = dw_groupbox_new( !REXXDW.!DW_VERT, 'Options', !REXXDW.!DW_FONT_BOLD ) 1165num_rows = 3 /* number of widgets + 1 for gaps */ 1166Call dw_box_pack_start topbox, groupbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 1167/* 1st row box */ 1168tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 1169Call dw_box_pack_start groupbox, tmpbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1170/* left column box */ 1171left_box = dw_box_new( !REXXDW.!DW_VERT ) 1172Call dw_box_pack_start tmpbox, left_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1173/* right column box */ 1174right_box = dw_box_new( !REXXDW.!DW_VERT ) 1175Call dw_box_pack_start tmpbox, right_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1176/* quick exit - left */ 1177confirm_exit_cb = dw_checkbox_new( 'Confirmation on Exit', 0 ) 1178Call dw_box_pack_start left_box, confirm_exit_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1179If !global.!!user.!!preference.!!confirm_exit = 1 Then Call dw_checkbox_set confirm_exit_cb, !REXXDW.!DW_CHECKED 1180Else Call dw_checkbox_set confirm_exit_cb, !REXXDW.!DW_UNCHECKED 1181/* save position on exit - right */ 1182save_position_cb = dw_checkbox_new( 'Use saved position on start', 0 ) 1183Call dw_box_pack_start right_box, save_position_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1184If !global.!!user.!!preference.!!save_position = '1' Then Call dw_checkbox_set save_position_cb, !REXXDW.!DW_CHECKED 1185Else Call dw_checkbox_set save_position_cb, !REXXDW.!DW_UNCHECKED 1186/* 2nd row box */ 1187tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 1188Call dw_box_pack_start groupbox, tmpbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1189/* left column box */ 1190left_box = dw_box_new( !REXXDW.!DW_VERT ) 1191Call dw_box_pack_start tmpbox, left_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1192/* sorting - left */ 1193sort_cb = dw_checkbox_new( 'Case Sensitive Sorting', 0 ) 1194Call dw_box_pack_start left_box, sort_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1195If !global.!!user.!!preference.!!sort = 'sensitive' Then Call dw_checkbox_set sort_cb, !REXXDW.!DW_CHECKED 1196Else Call dw_checkbox_set sort_cb, !REXXDW.!DW_UNCHECKED 1197/* right column box */ 1198right_box = dw_box_new( !REXXDW.!DW_VERT ) 1199Call dw_box_pack_start tmpbox, right_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1200/* debug commands - right */ 1201debug_commands_cb = dw_checkbox_new( 'Debug Repository Commands', 0 ) 1202Call dw_box_pack_start right_box, debug_commands_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1203If !global.!!user.!!preference.!!debug_commands = 1 Then Call dw_checkbox_set debug_commands_cb, !REXXDW.!DW_CHECKED 1204Else Call dw_checkbox_set debug_commands_cb, !REXXDW.!DW_UNCHECKED 1205/* win32 file associations - full width */ 1206If !global.!os = 'WIN32' Then 1207 Do 1208 tmpbox = dw_groupbox_new( !REXXDW.!DW_VERT, 'Use Windows File Associations', !REXXDW.!DW_FONT_BOLD ) 1209 Call dw_box_pack_start topbox, tmpbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 1210 fa_cb = dw_checkbox_new( 'For all files', 0 ) 1211 Call dw_box_pack_start tmpbox, fa_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1212 /* 1213 * On first start of QOCCA, set Windows File Associations to true under WIN32 1214 */ 1215 If initial Then 1216 Do 1217 Call dw_checkbox_set fa_cb, !REXXDW.!DW_CHECKED 1218 End 1219 Else 1220 Do 1221 If !global.!!user.!!preference.!!windowsfileassociations = 1 Then Call dw_checkbox_set fa_cb, !REXXDW.!DW_CHECKED 1222 Else Call dw_checkbox_set fa_cb, !REXXDW.!DW_UNCHECKED 1223 End 1224 fa_box = dw_box_new( !REXXDW.!DW_HORZ ) 1225 Call dw_box_pack_start tmpbox, fa_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1226 tmp = dw_text_new( 'Only for:', 0 ) 1227 Call dw_box_pack_start fa_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1228 Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1229 If Left( !global.!!user.!!preference.!!windowsfileassociations_extensions, 1 ) = '!' Then oldvalue = '' 1230 Else oldvalue = !global.!!user.!!preference.!!windowsfileassociations_extensions 1231 fa_entry = dw_entryfield_new( oldvalue, 0 ) 1232 Call dw_box_pack_start fa_box, fa_entry, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1233 Call dw_signal_connect fa_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'UserPreferencesHelpFocusCallback', 'FILEASSOC', t1 1234 End 1235/* 1236 * Create Cancel and Apply buttons 1237 */ 1238b1 = dw_button_new( 'Apply', 0 ) 1239Call dw_box_pack_start topbox, b1, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1240 1241b2 = dw_button_new( 'Cancel', 0 ) 1242Call dw_box_pack_start topbox, b2, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1243/* 1244 * Display the window 1245 */ 1246Call dw_window_set_gravity win, !REXXDW.!DW_GRAV_CENTRE, !REXXDW.!DW_GRAV_CENTRE 1247Call dw_window_set_pos_size win, 0, 0, 0, 0 1248Call dw_window_show win 1249Do Forever 1250 /* 1251 * Create a dialog for the window 1252 */ 1253 dialog_wait = dw_dialog_new( ) 1254 /* 1255 * We now have everything setup, we can connect the destroying of the top-level window 1256 * to the 'close' callback 1257 */ 1258 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'UserPreferencesApplyCallback', win, dialog_wait, text_editor_entry, text_pager_entry, tmp_dir_entry, binary_editor_entry, binary_pager_entry, fa_cb, fa_entry, sort_cb, stylebox, sb, diff_program_entry, confirm_exit_cb, text_editor_cb, binary_editor_cb, text_pager_cb, binary_pager_cb, save_position_cb, debug_commands_cb 1259 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 1260 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 1261 /* 1262 * Wait for the dialog to come back 1263 */ 1264 cancel = dw_dialog_wait( dialog_wait ) 1265 /* 1266 * All successful processing done in the 'applycallback', so simply get 1267 * out of the loop if we don't have any validation issues 1268 */ 1269 If cancel \= 'retry' Then Leave 1270End 1271 1272Return 0 1273 1274SelectStyleCallback: Procedure Expose !REXXDW. !global. !!last_repository 1275Parse Arg win, list_idx 1276If list_idx < 0 Then Return 1 1277text = dw_listbox_get_text( win, list_idx ) 1278Call dw_window_set_text win, text 1279Return 1 1280 1281ModifyUserMenuCallback: Procedure Expose !REXXDW. !global. !!last_repository 1282/* 1283 * Display the current list of user file menus 1284 */ 1285/* 1286 * Create a container box with 1287 * +---------------------------------------------------+ 1288 * | Specify the ... Use %F% for the full filename | 1289 * +---------------------------------------------------+ 1290 * | Label | Command | 1291 * +---------------------------------------------------+ 1292 * | the | the %F% |^| 1293 * | xedit | xedit %F% |v| 1294 * +---------------------------------------------------+ 1295 * | xyx | | Save | 1296 * +---------------------------------------------------+ 1297 * | | Change | | Delete | | 1298 * +---------------------------------------------------+ 1299 * | Cancel | 1300 * +---------------------------------------------------+ 1301 * | Apply | 1302 * +---------------------------------------------------+ 1303 * and provide right-click menu with 'Change' and 'Delete' 1304 * 1305 */ 1306Parse Arg ., type . 1307title_width = 50 1308flags.0 = 2 1309flags.1 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 1310flags.2 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 1311titles.0 = 2 1312titles.1 = 'Menu Label' 1313titles.2 = 'Command' 1314title.DIR = 'Maintain Directory Menu' 1315title.FILE = 'Maintain File Menu' 1316help.DIR.1 = 'This dialog allows you to add your own menus to the directory menu.' 1317help.DIR.2 = ' Specify the menu label and command to execute. The fully qualified' 1318help.DIR.3 = ' working directory is available for substitution into your command.' 1319help.DIR.4 = ' Add %D% where you want the directory name to be substituted, and %W% where you want the working directory substituted.' 1320help.DIR.5 = ' User variables can also be substituted; use %xx% where xx is a string. A dialog box will popup asking for the values.' 1321help.DIR.6 = ' Use %%% to specify a percent sign.' 1322help.DIR.0 = 6 1323help.FILE.1 = 'This dialog allows you to add your own menus to the file menu.' 1324help.FILE.2 = ' Specify the menu label and command to execute. The fully qualified' 1325help.FILE.3 = ' working directory and file name is available for substitution into your command.' 1326help.FILE.4 = ' Add %D% where you want the directory name to be substituted, %W% where you want the working directory substituted, and' 1327help.FILE.5 = ' %F% where you want the file name to be substituted.' 1328help.FILE.6 = ' User variables can also be substituted; use %xx% where xx is a string. A dialog box will popup asking for the values.' 1329help.FILE.7 = ' Use %%% to specify a percent sign.' 1330help.FILE.0 = 7 1331If type = 'DIR' Then 1332 Do 1333 If Left( !global.!!user.!!dirmenu.!!label.0, 1 ) = '!' Then 1334 Do 1335 !global.!!user.!!dirmenu.!!label.0 = 0 1336 !global.!!user.!!dirmenu.!!command.0 = 0 1337 End 1338 Call SysStemCopy '!global.!!user.!!dirmenu.!!label.', '!global.!current_menu_label.' 1339 Call SysStemCopy '!global.!!user.!!dirmenu.!!command.', '!global.!current_menu_command.' 1340 End 1341Else 1342 Do 1343 If Left( !global.!!user.!!filemenu.!!label.0, 1 ) = '!' Then 1344 Do 1345 !global.!!user.!!filemenu.!!label.0 = 0 1346 !global.!!user.!!filemenu.!!command.0 = 0 1347 End 1348 Call SysStemCopy '!global.!!user.!!filemenu.!!label.', '!global.!current_menu_label.' 1349 Call SysStemCopy '!global.!!user.!!filemenu.!!command.', '!global.!current_menu_command.' 1350 End 1351win = dw_window_new( !REXXDW.!DW_DESKTOP, title.type, !global.!windowstyle ) 1352Call dw_window_set_icon win, !global.!qoccaicon 1353topbox = dw_box_new( !REXXDW.!DW_VERT ) 1354Call dw_box_pack_start win, topbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1355/* 1356 * Add a disabled MLE with instructions 1357 */ 1358t1 = dw_mle_new( 0 ) 1359Call dw_box_pack_start topbox, t1, !REXXDW.!DW_SIZE_AUTO, 200, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1360Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 1361Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 1362res = -1 1363Do i = 1 To help.type.0 1364 res = dw_mle_import( t1, help.type.i, res ) 1365End 1366Call dw_window_disable t1 1367/* 1368 * Create our container in the box... 1369 */ 1370!global.!usermenucontainer = dw_container_new( 1, !REXXDW.!DW_SINGLE_SELECTION ) 1371Call dw_box_pack_start topbox, !global.!usermenucontainer, 400, 300, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1372!global.!usermenucontainer.?firsttime = 1 1373/* 1374 * Use a normal container. 1375 */ 1376Call dw_container_setup !global.!usermenucontainer, 'flags.', 'titles.', 0 1377 1378Call DisplayUserMenu 1379/* 1380 * Create edit area 1381 */ 1382tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 1383Call dw_box_pack_start topbox, tmpbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1384!global.!usermenu_text = dw_entryfield_new( '', 0 ) 1385Call dw_box_pack_start tmpbox, !global.!usermenu_text, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1386!global.!usermenu_entry = dw_entryfield_new( '', 0 ) 1387Call dw_box_pack_start tmpbox, !global.!usermenu_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1388ba = dw_button_new( 'Add/Change', 0 ) 1389Call dw_box_pack_start tmpbox, ba, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1390bd = dw_button_new( 'Delete', 0 ) 1391Call dw_box_pack_start tmpbox, bd, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1392 1393/* 1394 * Create Cancel and Apply button 1395 */ 1396b1 = dw_button_new( 'Apply', 0 ) 1397Call dw_box_pack_start topbox, b1, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1398 1399b2 = dw_button_new( 'Cancel', 0 ) 1400Call dw_box_pack_start topbox, b2, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1401/* 1402 * Display the window 1403 */ 1404Call dw_window_set_gravity win, !REXXDW.!DW_GRAV_CENTRE, !REXXDW.!DW_GRAV_CENTRE 1405Call dw_window_set_pos_size win, 0, 0, 0, 0 1406Call dw_window_show win 1407Do Forever 1408 /* 1409 * Create a dialog for the window 1410 */ 1411 dialog_wait = dw_dialog_new( ) 1412 /* 1413 * We now have everything setup, we can connect the destroying of the top-level window 1414 * to the 'close' callback 1415 */ 1416 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'UserMenuApplyCallback', win, dialog_wait, type 1417 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 1418 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 1419 Call dw_signal_connect ba, !REXXDW.!DW_CLICKED_EVENT, 'UserMenuAddChangeButtonCallback' 1420 Call dw_signal_connect bd, !REXXDW.!DW_CLICKED_EVENT, 'UserMenuDeleteButtonCallback' 1421 /* 1422 * Wait for the dialog to come back 1423 */ 1424 cancel = dw_dialog_wait( dialog_wait ) 1425 /* 1426 * All successful processing done in the 'applycallback', so simply get 1427 * out of the loop if we don't have any validation issues 1428 */ 1429 If cancel \= 'retry' Then Leave 1430End 1431Return 1 1432 1433DisplayUserMenu: Procedure Expose !REXXDW. !global. !!last_repository 1434/* 1435 * Delete everything in the container so we can replace the existing data 1436 */ 1437If !global.!usermenucontainer.?firsttime = 0 Then 1438 Do 1439 Call dw_signal_disconnect !global.!usermenucontainer, !REXXDW.!DW_ITEM_SELECT_EVENT 1440 Call dw_container_clear !global.!usermenucontainer, !REXXDW.!DW_DONT_REDRAW 1441 End 1442!global.!usermenucontainer.?firsttime = 0 1443/* 1444 * Add the entries into the container 1445 */ 1446containermemory = dw_container_alloc( !global.!usermenucontainer, !global.!current_menu_label.0 ) 1447Do i = 1 To !global.!current_menu_label.0 1448 Call dw_container_set_item !global.!usermenucontainer, containermemory, 0, i-1, !global.!current_menu_label.i 1449 Call dw_container_set_item !global.!usermenucontainer, containermemory, 1, i-1, !global.!current_menu_command.i 1450 Call dw_container_set_row_title containermemory, i-1, i 1451End 1452Call dw_container_set_stripe !global.!usermenucontainer, !REXXDW.!DW_CLR_WHITE, !global.!container_colour 1453Call dw_container_insert !global.!usermenucontainer, containermemory, !global.!current_menu_label.0 1454Call dw_container_optimize !global.!usermenucontainer 1455/* 1456 * Only now can we connect our signals, because dw_set_file() causes the signals to fire!!!... 1457 */ 1458Call dw_signal_connect !global.!usermenucontainer, !REXXDW.!DW_ITEM_SELECT_EVENT, 'UserMenuSelectCallback' 1459 1460Return 1461 1462/* 1463 * Set our edit are with values from the currently selected item 1464 */ 1465UserMenuSelectCallback: Procedure Expose !REXXDW. !global. !!last_repository 1466Parse Arg window, ., idx 1467Call dw_window_set_text !global.!usermenu_text, !global.!current_menu_label.idx 1468Call dw_window_set_text !global.!usermenu_entry, !global.!current_menu_command.idx 1469Return 1 1470 1471/* 1472 * Set our edit are with values from the currently selected item 1473 */ 1474UserMenuDeleteButtonCallback: Procedure Expose !REXXDW. !global. !!last_repository 1475/* 1476 * If we don't have anything in the edit area yet, just return 1477 */ 1478label = Strip( dw_window_get_text( !global.!usermenu_text ) ) 1479If label = '' Then Return 0 1480/* 1481 * If we have the label in the array delete it, otherwise ignore the delete 1482 */ 1483idx = 0 1484Do i = 1 To !global.!current_menu_label.0 1485 If !global.!current_menu_label.i = label Then 1486 Do 1487 idx = i 1488 Leave 1489 End 1490End 1491If idx = 0 Then Return 1 1492Call SysStemDelete '!global.!current_menu_label.', idx 1493Call SysStemDelete '!global.!current_menu_command.', idx 1494/* 1495 * Redisplay the container 1496 */ 1497Call DisplayUserMenu 1498Return 1 1499 1500UserMenuAddChangeButtonCallback: Procedure Expose !REXXDW. !global. !!last_repository 1501/* 1502 * If we don't have anything in the edit area yet, just return 1503 */ 1504label = Strip( dw_window_get_text( !global.!usermenu_text ) ) 1505If label = '' Then Return 0 1506/* 1507 * If we don't have the label in the array already, add it, otherwise 1508 * update the value 1509 */ 1510idx = 0 1511Do i = 1 To !global.!current_menu_label.0 1512 If !global.!current_menu_label.i = label Then 1513 Do 1514 idx = i 1515 Leave 1516 End 1517End 1518command = Strip( dw_window_get_text( !global.!usermenu_entry ) ) 1519If idx = 0 Then 1520 Do 1521 Call SysStemInsert '!global.!current_menu_label.', 1+!global.!current_menu_label.0, label 1522 Call SysStemInsert '!global.!current_menu_command.', 1+!global.!current_menu_command.0, command 1523 End 1524Else 1525 Do 1526 !global.!current_menu_label.idx = label 1527 !global.!current_menu_command.idx = command 1528 End 1529/* 1530 * Redisplay the container 1531 */ 1532Call DisplayUserMenu 1533Return 0 1534 1535/* 1536 * Apply the changes for the menu permanently 1537 */ 1538UserMenuApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 1539Parse Arg ., win, dialog, type 1540If type = 'DIR' Then 1541 Do 1542 Call SysStemCopy '!global.!current_menu_label.', '!global.!!user.!!dirmenu.!!label.' 1543 Call SysStemCopy '!global.!current_menu_command.', '!global.!!user.!!dirmenu.!!command.' 1544 End 1545Else 1546 Do 1547 Call SysStemCopy '!global.!current_menu_label.', '!global.!!user.!!filemenu.!!label.' 1548 Call SysStemCopy '!global.!current_menu_command.', '!global.!!user.!!filemenu.!!command.' 1549 End 1550/* 1551 * Save the user preferences now 1552 */ 1553Call WriteUserSettingsFile 1554Call dw_dialog_dismiss dialog, 'apply' 1555/* 1556 * Destroy the window 1557 */ 1558Call dw_window_destroy win 1559Return 0 1560 1561 1562UserPreferencesApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 1563Parse Arg ., win, dialog, text_editor_entry, text_pager_entry, tmp_dir_entry, binary_editor_entry, binary_pager_entry, fa_cb, fa_entry, sort_cb, stylebox, sb, diff_program_entry, confirm_exit_cb, text_editor_cb, binary_editor_cb, text_pager_cb, binary_pager_cb, save_position_cb, debug_commands_cb 1564/* 1565 * Validate that all mandatory fields are supplied 1566 * If on WIN32 and Windows File Associations checked, then we don't need 1567 * editors or pagers 1568 */ 1569t_editor = Strip( dw_window_get_text( text_editor_entry ) ) 1570t_pager = Strip( dw_window_get_text( text_pager_entry ) ) 1571b_editor = Strip( dw_window_get_text( binary_editor_entry ) ) 1572b_pager = Strip( dw_window_get_text( binary_pager_entry ) ) 1573diff_prog = Strip( dw_window_get_text( diff_program_entry ) ) 1574If stylebox \= '' Then style = Strip( dw_window_get_text( stylebox ) ) 1575Else style = '' 1576strict_validation = 1 1577t_tmpdir = Strip( Strip( Changestr( !global.!ossep, dw_window_get_text( tmp_dir_entry ), '/' ) ), 'T', '/' ) 1578If !global.!os = 'WIN32' Then 1579 Do 1580 fa_ext = Strip( dw_window_get_text( fa_entry ) ) 1581 fa = dw_checkbox_get( fa_cb ) 1582 If fa Then strict_validation = 0 1583 Else strict_validation = 1 1584 End 1585Select 1586 When t_editor = '' & strict_validation Then 1587 Do 1588 Call dw_messagebox 'Validation Error', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Text Editor field is empty. Please re-enter.' 1589 Call dw_dialog_dismiss dialog, 'retry' 1590 Return 0 1591 End 1592 When b_editor = '' & strict_validation Then 1593 Do 1594 Call dw_messagebox 'Validation Error', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Binary Editor field is empty. Please re-enter.' 1595 Call dw_dialog_dismiss dialog, 'retry' 1596 Return 0 1597 End 1598 When t_pager = '' & strict_validation Then 1599 Do 1600 Call dw_messagebox 'Validation Error', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Text Viewer field is empty. Please re-enter.' 1601 Call dw_dialog_dismiss dialog, 'retry' 1602 Return 0 1603 End 1604 When b_pager = '' & strict_validation Then 1605 Do 1606 Call dw_messagebox 'Validation Error', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Binary Viewer field is empty. Please re-enter.' 1607 Call dw_dialog_dismiss dialog, 'retry' 1608 Return 0 1609 End 1610 When t_tmpdir = '' | DirectoryExists(t_tmpdir) = 0 Then 1611 Do 1612 Call dw_messagebox 'Validation Error', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), "Temp Dir is empty or doesn't exist. Please re-enter." 1613 Call dw_dialog_dismiss dialog, 'retry' 1614 Return 0 1615 End 1616 Otherwise Nop 1617End 1618/* 1619 * Check text editor has %F% 1620 */ 1621If Countstr( '%F', t_editor ) \= 1 & strict_validation Then 1622 Do 1623 Call dw_messagebox 'Validation Error', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Text Editor field does not have mandatory %F% placemarker. Please re-enter.' 1624 Call dw_dialog_dismiss dialog, 'retry' 1625 Return 0 1626 End 1627/* 1628 * Append !global.!ossep to !!tmpdir if it doesn't have a trailing slash 1629 */ 1630If Right( t_tmpdir, 1 ) \= '/' Then !global.!!tmpdir = t_tmpdir||'/' 1631Else !global.!!tmpdir = t_tmpdir 1632!global.!!user.!!texteditor = t_editor 1633!global.!!user.!!textpager = t_pager 1634!global.!!user.!!binaryeditor = b_editor 1635!global.!!user.!!binarypager = b_pager 1636If dw_checkbox_get( sort_cb ) Then !global.!!user.!!preference.!!sort = 'sensitive' 1637Else !global.!!user.!!preference.!!sort = 'insensitive' 1638!global.!!user.!!preference.!!confirm_exit = dw_checkbox_get( confirm_exit_cb ) 1639!global.!!user.!!preference.!!save_position = dw_checkbox_get( save_position_cb ) 1640!global.!!user.!!preference.!!debug_commands = dw_checkbox_get( debug_commands_cb ) 1641If !global.!os = 'WIN32' Then !global.!!user.!!preference.!!windowsfileassociations = fa 1642Else !global.!!user.!!preference.!!windowsfileassociations = 0 1643!global.!!user.!!preference.!!tabspaces = dw_spinbutton_get_pos( sb ) 1644!global.!!user.!!preference.!!showmodified = 1 1645!global.!!user.!!style = style 1646!global.!!user.!!diffprog = diff_prog 1647!global.!!user.!!preference.!!windowsfileassociations_extensions = fa_ext 1648!global.!!user.!!texteditor_console = dw_checkbox_get( text_editor_cb ) 1649!global.!!user.!!textpager_console = dw_checkbox_get( text_pager_cb ) 1650!global.!!user.!!binaryeditor_console = dw_checkbox_get( binary_editor_cb ) 1651!global.!!user.!!binarypager_console = dw_checkbox_get( binary_pager_cb ) 1652/* 1653 * Save the user preferences now 1654 */ 1655Call WriteUserSettingsFile 1656Call dw_dialog_dismiss dialog, 'apply' 1657/* 1658 * Destroy the window 1659 */ 1660Call dw_window_destroy win 1661Return 0 1662 1663UserPreferencesHelpFocusCallback: Procedure Expose !REXXDW. !global. !!last_repository 1664Parse Arg win, which, textwin 1665help.initial = 'Specify your preferences below.' 1666help.texteditor = 'Enter the command you wish to execute to Edit a text configuration item, or use the folder icon to select a program.', 1667 ' You must also include %F% to specify where filenames are the be included in the command string. You can optionally add %L% and %C% to specify line and column positions when the editor is called from the Build Results window.' 1668help.textpager = 'Enter the command you wish to execute to View a text configuration item, or use the folder icon to select a program.' 1669help.binaryeditor = 'Enter the command you wish to execute to Edit a binary configuration item, or use the folder icon to select a program.' 1670help.binarypager = 'Enter the command you wish to execute to View a binary configuration item, or use the folder icon to select a program.' 1671help.tmpdir = 'Enter a directory where temporary files used by QOCCA can be stored, or use the folder icon to select a directory. This temporary directory should not be a directory that other developers are likely to use.' 1672help.fileassoc = 'Check the button if you want to use the default Windows File Associations for editing and viewing instead of the selected programs.' 1673help.sorting = 'Check the button if you want the order of the files in the files pane to respect case.' 1674help.showmodified = "Check the button if you want QOCCA to execute 'Show Modified' automatically each time a new file list is displayed." 1675help.setcolours = "Click this to specify the foreground and background colours of the 3 major panes." 1676help.filemenus = "Click this to bring up a dialog that allows you to create your own menu items for the File Menu." 1677help.dirmenus = "Click this to bring up a dialog that allows you to create your own menu items for the Directory Menu." 1678help.sytnax = "Select the default theme to use in 'Show Annotations' and 'Show Differences'." 1679help.tabspaces = "Replace TABS in 'Show Annotations' and 'Show Differences' with this many spaces. 0 indicates no substitution." 1680help.diffprog = "Specify the 'diff' program to call for 'Show Differences'. If not specifed, 'rexxdiff ' is used, where %F1% and %F2% are the file names to compare, %T1% and %T2% are the file descriptions." 1681help.fileassoc = "Specify the extensions to apply the default file associations to." 1682Call dw_window_enable textwin 1683Call dw_mle_set_cursor textwin, 0 1684Call dw_mle_delete textwin 1685Call dw_mle_import textwin, help.which, -1 1686Call dw_window_disable textwin 1687Return 0 1688 1689RepositorySettingsCallback: Procedure Expose !REXXDW. !global. !!last_repository 1690/* 1691 * Project properties... (from build.conf) 1692 * 1693 * +---------------------------------------------------+ 1694 * | Text | 1695 * | | 1696 * +---------------------------------------------------+ 1697 * | Admin Users: ______________________ | !admin_users 1698 * | Admin Email: ______________________ | !admin_email 1699 * | Build Users: _______________________ | !build_users 1700 * | Update Users: ______________________ | !update_users 1701 * | User mappings: _____________________ | !user_mappings 1702 * | Runtime Environments: ______________________ | !runtime_envs 1703 * | Platform Targets: __________________ | !platforms 1704 * | Files to Ignore: ___________________ | !ignorefiles 1705 * | Binary files: __ ___________________ | !binaryfiles 1706 * | Version Env Variable _______________ | !versionenvvar 1707 * | Build Number Env Variable _______________ | !buildenvvar 1708 * | Build Directory: ____________________________ | !builddir 1709 * | Log Directory: ____________________________ | !logdir 1710 * | User Can Delete: x | !user_can_delete 1711 * | Reserved Checkout: x | !reservedcheckout 1712 * +---------------------------------------------------+ 1713 * | Help | 1714 * | | 1715 * +---------------------------------------------------+ 1716 */ 1717this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 1718num_platforms = Words( !global.!platforms ) 1719 1720title_width = 130 1721win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Edit Repository Settings', !global.!windowstyle ) 1722Call dw_window_set_icon win, !global.!qoccaicon 1723topbox = dw_box_new( !REXXDW.!DW_VERT ) 1724Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1725/* 1726 * Add a disabled MLE with instructions 1727 */ 1728t1 = dw_mle_new( 0 ) 1729Call dw_box_pack_start topbox, t1, 400, 75, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 1730Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 1731Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 1732Call UserPreferencesHelpFocusCallback t1, 'INITIAL', t1 1733Call dw_window_disable t1 1734 1735/* 1736 * Add a vertical box for the left column of widgets 1737 */ 1738left_box = dw_box_new( !REXXDW.!DW_VERT ) 1739Call dw_box_pack_start topbox, left_box, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 5 1740/* 1741 * Add the boxes and widgets for the left column... 1742 */ 1743/* admin users */ 1744admin_users_box = dw_box_new( !REXXDW.!DW_HORZ ) 1745Call dw_box_pack_start left_box, admin_users_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1746tmp = dw_text_new( 'Admin Users', 0 ) 1747Call dw_box_pack_start admin_users_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1748Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1749admin_users_entry = dw_entryfield_new( !global.!admin_users, 0 ) 1750Call dw_box_pack_start admin_users_box, admin_users_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1751Call dw_signal_connect admin_users_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'AU', t1 1752/* admin email */ 1753admin_email_box = dw_box_new( !REXXDW.!DW_HORZ ) 1754Call dw_box_pack_start left_box, admin_email_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1755tmp = dw_text_new( 'Admin Email', 0 ) 1756Call dw_box_pack_start admin_email_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1757Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1758admin_email_entry = dw_entryfield_new( !global.!admin_email, 0 ) 1759Call dw_box_pack_start admin_email_box, admin_email_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1760Call dw_signal_connect admin_email_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'AE', t1 1761/* build users */ 1762build_users_box = dw_box_new( !REXXDW.!DW_HORZ ) 1763Call dw_box_pack_start left_box, build_users_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1764tmp = dw_text_new( 'Build Users', 0 ) 1765Call dw_box_pack_start build_users_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1766Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1767build_users_entry = dw_entryfield_new( !global.!build_users, 0 ) 1768Call dw_box_pack_start build_users_box, build_users_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1769Call dw_signal_connect build_users_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'BU', t1 1770/* update users */ 1771update_users_box = dw_box_new( !REXXDW.!DW_HORZ ) 1772Call dw_box_pack_start left_box, update_users_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1773tmp = dw_text_new( 'Update Users', 0 ) 1774Call dw_box_pack_start update_users_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1775Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1776update_users_entry = dw_entryfield_new( !global.!update_users, 0 ) 1777Call dw_box_pack_start update_users_box, update_users_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1778Call dw_signal_connect update_users_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'UU', t1 1779/* update users */ 1780user_mappings_box = dw_box_new( !REXXDW.!DW_HORZ ) 1781Call dw_box_pack_start left_box, user_mappings_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1782tmp = dw_text_new( 'User Mappings', 0 ) 1783Call dw_box_pack_start user_mappings_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1784Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1785user_mappings_entry = dw_entryfield_new( !global.!user_mappings, 0 ) 1786Call dw_box_pack_start user_mappings_box, user_mappings_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1787Call dw_signal_connect user_mappings_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'UM', t1 1788/* runtime environments */ 1789runtime_environments_box = dw_box_new( !REXXDW.!DW_HORZ ) 1790Call dw_box_pack_start left_box, runtime_environments_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1791tmp = dw_text_new( 'Runtime Environments', 0 ) 1792Call dw_box_pack_start runtime_environments_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1793Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1794runtime_environments_entry = dw_entryfield_new( !global.!runtime_envs, 0 ) 1795Call dw_box_pack_start runtime_environments_box, runtime_environments_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1796Call dw_signal_connect runtime_environments_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'RE', t1 1797/* platform targets */ 1798platform_targets_box = dw_box_new( !REXXDW.!DW_HORZ ) 1799Call dw_box_pack_start left_box, platform_targets_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1800tmp = dw_text_new( 'Platform Targets', 0 ) 1801Call dw_box_pack_start platform_targets_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1802Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1803platform_targets_entry = dw_entryfield_new( !global.!platforms, 0 ) 1804Call dw_box_pack_start platform_targets_box, platform_targets_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1805Call dw_signal_connect platform_targets_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'PT', t1 1806/* files to ignore */ 1807files_to_ignore_box = dw_box_new( !REXXDW.!DW_HORZ ) 1808Call dw_box_pack_start left_box, files_to_ignore_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1809tmp = dw_text_new( 'Files To Ignore', 0 ) 1810Call dw_box_pack_start files_to_ignore_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1811Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1812files_to_ignore_entry = dw_entryfield_new( !global.!ignorefiles, 0 ) 1813Call dw_box_pack_start files_to_ignore_box, files_to_ignore_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1814Call dw_signal_connect files_to_ignore_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'IF', t1 1815/* binary files */ 1816binary_files_box = dw_box_new( !REXXDW.!DW_HORZ ) 1817Call dw_box_pack_start left_box, binary_files_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1818tmp = dw_text_new( 'Binary Files', 0 ) 1819Call dw_box_pack_start binary_files_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1820Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1821binary_files_entry = dw_entryfield_new( !global.!binaryfiles, 0 ) 1822Call dw_box_pack_start binary_files_box, binary_files_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1823Call dw_signal_connect binary_files_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'BF', t1 1824/* variable env variable */ 1825version_env_var_box = dw_box_new( !REXXDW.!DW_HORZ ) 1826Call dw_box_pack_start left_box, version_env_var_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1827tmp = dw_text_new( 'Version Env Variable', 0 ) 1828Call dw_box_pack_start version_env_var_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1829Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1830version_env_var_entry = dw_entryfield_new( !global.!versionenvvar, 0 ) 1831Call dw_box_pack_start version_env_var_box, version_env_var_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1832Call dw_signal_connect version_env_var_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'VE', t1 1833/* build env variable */ 1834build_env_var_box = dw_box_new( !REXXDW.!DW_HORZ ) 1835Call dw_box_pack_start left_box, build_env_var_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1836tmp = dw_text_new( 'Build Env Variable', 0 ) 1837Call dw_box_pack_start build_env_var_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1838Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1839build_env_var_entry = dw_entryfield_new( !global.!buildenvvar, 0 ) 1840Call dw_box_pack_start build_env_var_box, build_env_var_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1841Call dw_signal_connect build_env_var_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'BE', t1 1842/* build dir variable */ 1843build_dir_box = dw_box_new( !REXXDW.!DW_HORZ ) 1844Call dw_box_pack_start left_box, build_dir_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1845tmp = dw_text_new( 'Build Directory', 0 ) 1846Call dw_box_pack_start build_dir_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1847Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1848build_dir_entry = dw_entryfield_new( !global.!builddir, 0 ) 1849Call dw_box_pack_start build_dir_box, build_dir_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1850Call dw_signal_connect build_dir_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'BD', t1 1851/* log env variable */ 1852log_dir_box = dw_box_new( !REXXDW.!DW_HORZ ) 1853Call dw_box_pack_start left_box, log_dir_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1854tmp = dw_text_new( 'Log Directory', 0 ) 1855Call dw_box_pack_start log_dir_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1856Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 1857log_dir_entry = dw_entryfield_new( !global.!logdir, 0 ) 1858Call dw_box_pack_start log_dir_box, log_dir_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1859Call dw_signal_connect log_dir_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'RepositorySettingsHelpFocusCallback', 'LD', t1 1860/* syntax mapping */ 1861b0 = dw_button_new( 'Edit Syntax Mappings', 0 ) 1862Call dw_box_pack_start left_box, b0, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1863Call dw_signal_connect b0, !REXXDW.!DW_CLICKED_EVENT, 'EditSyntaxMappingCallback' 1864/* user can delete */ 1865user_can_delete_cb = dw_checkbox_new( 'User Can Delete', 0 ) 1866Call dw_box_pack_start left_box, user_can_delete_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1867If !global.!user_can_delete = 'Y' Then Call dw_checkbox_set user_can_delete_cb, !REXXDW.!DW_CHECKED 1868Else Call dw_checkbox_set user_can_delete_cb, !REXXDW.!DW_UNCHECKED 1869/* reserved checkout */ 1870reserved_checkout_cb = dw_checkbox_new( 'Reserved Checkout for Repository', 0 ) 1871Call dw_box_pack_start left_box, reserved_checkout_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1872If !global.!reservedcheckout = 'Y' Then Call dw_checkbox_set reserved_checkout_cb, !REXXDW.!DW_CHECKED 1873Else Call dw_checkbox_set reserved_checkout_cb, !REXXDW.!DW_UNCHECKED 1874/* 1875 * Create Cancel and Apply buttons 1876 */ 1877b1 = dw_button_new( 'Apply', 0 ) 1878Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1879 1880b2 = dw_button_new( 'Cancel', 0 ) 1881Call dw_box_pack_start topbox, b2, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 1882/* 1883 * Display the window 1884 */ 1885width = 500 1886height = 590 /* text_height + cb_height + 80 */ 1887Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 1888Call dw_window_show win 1889Call dw_main_sleep 10 1890Do Forever 1891 /* 1892 * Create a dialog for the window 1893 */ 1894 dialog_wait = dw_dialog_new( ) 1895 /* 1896 * We now have everything setup, we can connect the destroying of the top-level window 1897 * to the 'close' callback 1898 */ 1899 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'RepositorySettingsApplyCallback', win, dialog_wait, admin_users_entry, admin_email_entry, build_users_entry, update_users_entry, runtime_environments_entry, platform_targets_entry, files_to_ignore_entry, binary_files_entry, version_env_var_entry, build_env_var_entry, build_dir_entry, log_dir_entry, user_can_delete_cb, reserved_checkout_cb, user_mappings_entry 1900 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 1901 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 1902 /* 1903 * Wait for the dialog to come back 1904 */ 1905 cancel = dw_dialog_wait( dialog_wait ) 1906 /* 1907 * All successful processing done in the 'applycallback', so simply get 1908 * out of the loop if we don't have any validation issues 1909 */ 1910 If cancel \= 'retry' Then Leave 1911End 1912Return 0 1913 1914RepositorySettingsApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 1915Parse Arg ., win, dialog_wait, admin_users_entry, admin_email_entry, build_users_entry, update_users_entry, runtime_environments_entry, platform_targets_entry, files_to_ignore_entry, binary_files_entry, version_env_var_entry, build_env_var_entry, build_dir_entry, log_dir_entry, user_can_delete_cb, reserved_checkout_cb, user_mappings_entry 1916 1917admin_users = Strip( dw_window_get_text( admin_users_entry ) ) 1918admin_email = Strip( dw_window_get_text( admin_email_entry ) ) 1919If Words( admin_users ) \= Words( admin_email ) Then 1920 Do 1921 Call dw_messagebox 'Validation Error', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), 'There must be an email address for each Admin User.' 1922 Call dw_dialog_dismiss dialog_wait, 'retry' 1923 Return 0 1924 End 1925/* 1926 * No more validation done 1927 */ 1928!global.!admin_users = admin_users 1929!global.!admin_email = admin_email 1930!global.!user_mappings = Strip( dw_window_get_text( user_mappings_entry ) ) 1931!global.!build_users = Strip( dw_window_get_text( build_users_entry ) ) 1932!global.!update_users = Strip( dw_window_get_text( update_users_entry ) ) 1933!global.!runtime_envs = Strip( dw_window_get_text( runtime_environments_entry ) ) 1934!global.!platforms = Strip( dw_window_get_text( platform_targets_entry ) ) 1935!global.!ignorefiles = Strip( dw_window_get_text( files_to_ignore_entry ) ) 1936!global.!binaryfiles = Strip( dw_window_get_text( binary_files_entry ) ) 1937!global.!versionenvvar = Strip( dw_window_get_text( version_env_var_entry ) ) 1938!global.!buildenvvar = Strip( dw_window_get_text( build_env_var_entry ) ) 1939!global.!builddir = Strip( dw_window_get_text( build_dir_entry ) ) 1940!global.!logdir = Strip( dw_window_get_text( log_dir_entry ) ) 1941ucd = dw_checkbox_get( user_can_delete_cb ) 1942If ucd Then !global.!user_can_delete = 'Y' 1943Else !global.!user_can_delete = 'N' 1944If dw_checkbox_get( reserved_checkout_cb ) Then !global.!reservedcheckout = 'Y' 1945Else !global.!reservedcheckout = 'N' 1946 1947Call dw_dialog_dismiss dialog_wait, 'apply' 1948Call dw_window_destroy win 1949 1950Call WriteBuildConf 'Updated repository settings' 1951/* 1952 * In case we have changed to/from reserved checkout 1953 */ 1954Call SetLockedStatusIcon 1955 1956Return 0 1957 1958RepositorySettingsHelpFocusCallback: Procedure Expose !REXXDW. !global. !!last_repository 1959Parse Arg win, which, textwin 1960help.initial = 'Update the repository details below.' 1961help.au = 'Enter the names of all users who are allowed to administer this repository separated by spaces.' 1962help.ae = 'Enter the email address for each admin user. There must be a one-to-one relationship between admin users and their email addresses separated by spaces.' 1963help.bu = 'Enter the names of all users who are allowed to build modules in this repository separated by spaces.' 1964help.uu = 'Enter the names of all users who are allowed to update configuration items in this repository separated by spaces.' 1965help.um = 'Enter the userid mappings in the format: userid=new_userid[,userid=new_userid].' 1966help.re = 'Enter the list of environments to which a module can be promoted (not currently used).' 1967help.pt = 'Enter the platform on which builds are required for this repository.' 1968help.if = 'Enter the list of file extensions that you want to ignore when adding files to the repository.' 1969help.bf = 'Enter the list of file extensions that you QOCCA to consider to be binary.' 1970help.ve = 'Enter the environment variable that you want to be set to the version being built.' 1971help.be = 'Enter the environment variable that you want to be set to the build number being built.' 1972help.bd = "Enter the directory where a build is to be done from. This directory is a relative directory specification from the repository's working directory; generally something as simple as 'build'." 1973help.ld = "Enter the directory where log files from batch jobs are written. This directory is a relative directory specification from the repository's working directory; generally something as simple as 'log'." 1974Call dw_mle_set_cursor textwin, 0 1975Call dw_mle_delete textwin 1976Call dw_mle_import textwin, help.which, -1 1977Return 0 1978 1979EditSyntaxMappingCallback: Procedure Expose !REXXDW. !global. !!last_repository 1980/* 1981 * Create a container box with 1982 * +---------------------------------------------------+ 1983 * | Syntax | Extensions | 1984 * +---------------------------------------------------+ 1985 * | xml | |^| 1986 * | rexx | rexx rexx cmd the |v| 1987 * +---------------------------------------------------+ 1988 * | xml | | Save | 1989 * +---------------------------------------------------+ 1990 * | Apply | 1991 * +---------------------------------------------------+ 1992 * | Cancel | 1993 * +---------------------------------------------------+ 1994 * 1995 */ 1996title_width = 50 1997Address System 'highlight -p' !global.!datadir With Output Stem langs. Error Stem err. 1998If langs.0 = 0 Then 1999 Do 2000 Do i = 1 To err.0 2001 End 2002 Return 0 2003 End 2004flags.0 = 2 2005flags.1 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 2006flags.2 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 2007titles.0 = 2 2008titles.1 = 'Syntax' 2009titles.2 = 'Extensions' 2010win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Edit Syntax Mappings', !global.!windowstyle ) 2011Call dw_window_set_icon win, !global.!qoccaicon 2012topbox = dw_box_new( !REXXDW.!DW_VERT ) 2013Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2014/* 2015 * Create our container in the box... 2016 */ 2017!global.!syntaxcontainer = dw_container_new( 1, !REXXDW.!DW_SINGLE_SELECTION ) 2018Call dw_box_pack_start topbox, !global.!syntaxcontainer, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2019!global.!syntaxcontainer.?firsttime = 1 2020!global.!editsyntax_index = 0 2021/* 2022 * Use a normal container. 2023 */ 2024Call dw_container_setup !global.!syntaxcontainer, 'flags.', 'titles.', 0 2025 2026Call DisplaySyntaxMapping 2027/* 2028 * Create edit area 2029 */ 2030tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 2031Call dw_box_pack_start topbox, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2032!global.!editsyntax_text = dw_entryfield_new( '', 0 ) 2033Call dw_box_pack_start tmpbox, !global.!editsyntax_text, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2034Call dw_window_disable !global.!editsyntax_text 2035!global.!editsyntax_entry = dw_entryfield_new( '', 0 ) 2036Call dw_box_pack_start tmpbox, !global.!editsyntax_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2037b0 = dw_button_new( 'Save', 0 ) 2038Call dw_box_pack_start tmpbox, b0, 50, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2039/* 2040 * Create Apply and Cancel buttons 2041 */ 2042b1 = dw_button_new( 'Apply', 0 ) 2043Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2044b2 = dw_button_new( 'Cancel', 0 ) 2045Call dw_box_pack_start topbox, b2, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2046/* 2047 * Display the window 2048 */ 2049width = 500 2050height = 480 /* text_height + cb_height + 80 */ 2051Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 2052Call dw_window_show win 2053 Call dw_main_sleep 10 2054Do Forever 2055 /* 2056 * Create a dialog for the window 2057 */ 2058 dialog_wait = dw_dialog_new( ) 2059 /* 2060 * We now have everything setup, we can connect the destroying of the top-level window 2061 * to the 'close' callback 2062 */ 2063 Call dw_signal_connect b0, !REXXDW.!DW_CLICKED_EVENT, 'EditSyntaxMappingSaveButtonCallback' 2064 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'EditSyntaxMappingApplyCallback', win, dialog_wait 2065 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 2066 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 2067 /* 2068 * Wait for the dialog to come back 2069 */ 2070 cancel = dw_dialog_wait( dialog_wait ) 2071 /* 2072 * All successful processing done in the 'applycallback', so simply get 2073 * out of the loop if we don't have any validation issues 2074 */ 2075 If cancel \= 'retry' Then Leave 2076End 2077Drop !global.!langs. !global.!extensions. 2078Return 0 2079 2080DisplaySyntaxMapping: Procedure Expose !REXXDW. !global. !!last_repository 2081/* 2082 * Determine how many items in the container... 2083 */ 2084Address System 'highlight -p' !global.!datadir With Output Stem langs. Error Stem err. 2085idx = 0 2086Do i = 1 To langs.0 2087 Parse Var langs.i . ':' ext . 2088 ext = Strip( ext ) 2089 If ext \= '' Then 2090 Do 2091 idx = idx + 1 2092 !global.!langs.idx = ext 2093 !global.!langs.0 = idx 2094 End 2095End 2096Drop langs.i 2097If !global.!langs.0 > 1 Then Call SysStemSort '!GLOBAL.!LANGS.','ascending', , , , 1, 20 2098/* 2099 * Delete everything in the container so we can replace the existing files 2100 */ 2101If !global.!syntaxcontainer.?firsttime = 0 Then 2102 Do 2103 Call dw_signal_disconnect !global.!syntaxcontainer, !REXXDW.!DW_ITEM_SELECT_EVENT 2104 Call dw_container_clear !global.!syntaxcontainer, !REXXDW.!DW_DONT_REDRAW 2105 End 2106!global.!syntaxcontainer.?firsttime = 0 2107/* 2108 * Add the entries into the container 2109 */ 2110!global.!syntaxcontainermemory = dw_container_alloc( !global.!syntaxcontainer, !global.!langs.0 ) 2111Do i = 1 To !global.!langs.0 2112 /* 2113 * Find our currently set mappings... 2114 */ 2115 !global.!extensions.i = '' 2116 If Left( !global.!syntax.0, 1 ) \= '!' Then 2117 Do j = 1 To !global.!syntax.0 2118 If !global.!syntax.j = !global.!langs.i Then 2119 Do 2120 !global.!extensions.i = !global.!extension.j 2121 Leave j 2122 End 2123 End 2124 Call dw_container_set_item !global.!syntaxcontainer, !global.!syntaxcontainermemory, 0, i-1, !global.!langs.i 2125 Call dw_container_set_item !global.!syntaxcontainer, !global.!syntaxcontainermemory, 1, i-1, !global.!extensions.i 2126 Call dw_container_set_row_title !global.!syntaxcontainermemory, i-1, i 2127End 2128Call dw_container_set_stripe !global.!syntaxcontainer, !REXXDW.!DW_CLR_WHITE, !global.!container_colour 2129Call dw_container_insert !global.!syntaxcontainer, !global.!syntaxcontainermemory, !global.!langs.0 2130Call dw_container_optimize !global.!syntaxcontainer 2131/* 2132 * Only now can we connect our signals, because dw_set_file() causes the signals to fire!!!... 2133 */ 2134Call dw_signal_connect !global.!syntaxcontainer, !REXXDW.!DW_ITEM_SELECT_EVENT, 'EditSyntaxMappingSelectCallback' 2135 2136Return 2137 2138/* 2139 * Set our edit area with values from the currently selected item 2140 */ 2141EditSyntaxMappingSelectCallback: Procedure Expose !REXXDW. !global. !!last_repository 2142Parse Arg window, ., idx 2143Call dw_window_set_text !global.!editsyntax_text, !global.!langs.idx 2144Call dw_window_set_text !global.!editsyntax_entry, !global.!extensions.idx 2145!global.!editsyntax_index = idx 2146Return 1 2147 2148EditSyntaxMappingSaveButtonCallback: Procedure Expose !REXXDW. !global. !!last_repository 2149/* 2150 * If we don't have anything in the edit area yet, just return 2151 */ 2152If !global.!editsyntax_index = 0 Then Return 0 2153index = !global.!editsyntax_index 2154text = dw_window_get_text( !global.!editsyntax_entry ) 2155!global.!extensions.index = text 2156Call dw_container_set_item !global.!syntaxcontainer, !global.!syntaxcontainermemory, 1, index-1, !global.!extensions.index 2157Return 0 2158 2159EditSyntaxMappingApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 2160Parse Arg ., win, dialog_wait 2161/* 2162 * Convert !global.!langs. and !global.!extensions. to !global.!syntax. and !global.!extension. 2163 */ 2164idx = 0 2165Do i = 1 To !global.!langs.0 2166 If Strip( !global.!extensions.i ) \= '' Then 2167 Do 2168 idx = idx + 1 2169 !global.!syntax.idx = Strip( !global.!langs.i ) 2170 !global.!extension.idx = Strip( !global.!extensions.i ) 2171 End 2172End 2173!global.!syntax.0 = idx 2174!global.!extension.0 = idx 2175Call dw_dialog_dismiss dialog_wait, 'apply' 2176Call dw_window_destroy win 2177 2178Call WriteBuildConf 'Updated syntax mappings' 2179 2180Return 0 2181 2182CreateMainWindow: Procedure Expose !REXXDW. !global. !!last_repository 2183/* 2184 * Create the main window on the desktop 2185 * Check if the user wants the window to be the same as last time and it was maixised... 2186 */ 2187mainstyle = !global.!windowstyle 2188maximised = 0 2189If Words( !global.!!user.!!window_pos_size ) = 4 & !global.!!user.!!preference.!!save_position = 1 Then 2190 Do 2191 Parse Var !global.!!user.!!window_pos_size xpos ypos !global.!window_width !global.!window_height 2192 If !global.!screen_width = !global.!window_width - xpos & !global.!screen_height = !global.!window_height - ypos Then 2193 Do 2194 mainstyle = dw_or( mainstyle, !REXXDW.!DW_FCF_MAXIMIZE ) 2195 maximised = 1 2196 End 2197 End 2198lockicon_size = 26 2199!global.!mainwindow = dw_window_new( !REXXDW.!DW_DESKTOP, 'QOCCA', mainstyle ) 2200/* 2201 * Generate all images used by QOCCA. We have to do this here because dwindows 2202 * under GTK 1.2 NOT using IMLIB, requires a window before an icon can be 2203 * loaded 2204 */ 2205Call SetCursorWait 2206Call GenerateIcons 2207Call dw_window_set_icon !global.!mainwindow, !global.!qoccaicon 2208/* 2209 * ...and a box within the main window. 2210 */ 2211!global.!topbox = dw_box_new( !REXXDW.!DW_VERT ) 2212Call dw_box_pack_start !global.!mainwindow, !global.!topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2213/* 2214 * This box is where the bulk of the windows goes 2215 */ 2216!global.!mainbox = dw_box_new( !REXXDW.!DW_HORZ ) 2217Call dw_box_pack_start !global.!topbox, !global.!mainbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2218/* 2219 * This box is for our bookmarks 2220 */ 2221tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 2222Call dw_box_pack_start !global.!topbox, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 2223/* 2224 * Create our bookmark details 2225 */ 2226tmp = dw_button_new( 'Go to bookmark', 0 ) 2227Call dw_box_pack_start tmpbox, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2228Call dw_signal_connect tmp, !REXXDW.!DW_CLICKED_EVENT, 'SelectBookmarkApplyCallback' 2229!global.!bookmarks_cb = dw_combobox_new( '', 0 ) 2230Call dw_box_pack_start tmpbox, !global.!bookmarks_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2231Call dw_signal_connect !global.!bookmarks_cb, !REXXDW.!DW_LIST_SELECT_EVENT, 'SelectBookmarkCallback' 2232/* 2233 * Create our file filters 2234 */ 2235!global.!filefilterbuttonapply = dw_button_new( 'Apply Filters', 0 ) 2236Call dw_box_pack_start tmpbox, !global.!filefilterbuttonapply, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2237Call dw_signal_connect !global.!filefilterbuttonapply, !REXXDW.!DW_CLICKED_EVENT, 'RefreshFilesCallback' 2238Call dw_box_pack_start tmpbox, , 5, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2239ffvbox = dw_box_new( !REXXDW.!DW_HORZ ) 2240Call dw_box_pack_start tmpbox, ffvbox, 0, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2241Do i = 1 To !global.!filefiltericons.0 2242-- !global.!filefilterbutton.i = dw_bitmapbutton_new_from_file( !global.!filefiltericonsdesc.i, 0, !global.!icondir||!global.!filefiltericons.i ) 2243 !global.!filefilterbutton.i = dw_bitmapbutton_new_from_file( '', 0, !global.!icondir||!global.!filefiltericons.i ) 2244 Call dw_box_pack_start ffvbox, !global.!filefilterbutton.i, 24, 24, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2245 Call dw_signal_connect !global.!filefilterbutton.i, !REXXDW.!DW_CLICKED_EVENT, 'ToggleFileFilterCallback', i 2246End 2247Call DisableFileFilters 2248/* 2249 * This box is for the status line. 2250 */ 2251!global.!statusbox = dw_box_new( !REXXDW.!DW_HORZ ) 2252Call dw_box_pack_start !global.!topbox, !global.!statusbox, 0, 26, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 2253/* 2254 * Create our status areas... 2255 */ 2256junk = dw_button_new( 'QOCCA:' !global.!version, 0 ) 2257Call dw_box_pack_start !global.!statusbox, junk, !REXXDW.!DW_SIZE_AUTO, 26, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2258Call dw_signal_connect junk, !REXXDW.!DW_CLICKED_EVENT, 'HelpAboutCallback' 2259!global.!systemstatus = dw_status_text_new( 'QOCCA Starting', 0 ) 2260Call dw_box_pack_start !global.!statusbox, !global.!systemstatus, 0, 26, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2261lockbox = dw_box_new( !REXXDW.!DW_HORZ ) 2262Call dw_box_pack_start !global.!statusbox, lockbox, lockicon_size, lockicon_size, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2263!global.!lock_bitmap = dw_bitmapbutton_new_from_file( 'Directory Locked', 0, !global.!icondir'lockdir' ) 2264Call dw_box_pack_start lockbox, !global.!lock_bitmap, lockicon_size, lockicon_size, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2265Call dw_window_disable !global.!lock_bitmap 2266 2267!global.!jobstatus = dw_button_new( 'Active Jobs: 0', 0 ) 2268Call dw_box_pack_start !global.!statusbox, !global.!jobstatus, !REXXDW.!DW_SIZE_AUTO, 26, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2269Call dw_signal_connect !global.!jobstatus, !REXXDW.!DW_CLICKED_EVENT, 'JobStatusCallback' 2270/* 2271 * Create our directory toolbar boxes... 2272 */ 2273!global.!dirtoolbarboxperm = dw_box_new( !REXXDW.!DW_VERT ) 2274Call dw_box_pack_start !global.!mainbox, !global.!dirtoolbarboxperm, !global.!toolbox_size, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 2275/* 2276 * Pack the 'Quit' button into the top of the toolbar 2277 */ 2278abutton = dw_bitmapbutton_new_from_file( 'Quit QOCCA', 0, !global.!icondir||'quit' ) 2279Call dw_box_pack_start !global.!dirtoolbarboxperm, abutton, !global.!toolbox_size, !global.!toolbox_size, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2280Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'QuitCallback' 2281Call dw_box_pack_start !global.!dirtoolbarboxperm, 0, !global.!toolbox_size, 5, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2282!global.!dirtoolbarbox = 0 2283!global.!dirtoolbarbutton.0 = 0 /* this ensures that we don't try and delete the buttons */ 2284/* 2285 * Create our repository notebook box... 2286 */ 2287!global.!repnotebookbox = dw_box_new( !REXXDW.!DW_VERT ) 2288Call dw_box_pack_start !global.!mainbox, !global.!repnotebookbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2289/* 2290 * Create our file toolbar boxes... 2291 */ 2292tmp = dw_box_new( !REXXDW.!DW_VERT ) 2293Call dw_box_pack_start !global.!mainbox, tmp, !global.!toolbox_size, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 2294!global.!filetoolbarboxperm = dw_box_new( !REXXDW.!DW_VERT ) 2295Call dw_box_pack_start tmp, !global.!filetoolbarboxperm, !global.!toolbox_size, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 2296abutton = dw_bitmapbutton_new_from_file( 'Help', 0, !global.!icondir||'help' ) 2297Call dw_box_pack_start !global.!filetoolbarboxperm, abutton, !global.!toolbox_size, !global.!toolbox_size, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2298Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'HelpCallback' 2299Call dw_box_pack_start !global.!filetoolbarboxperm, 0, !global.!toolbox_size, 5, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2300abutton = dw_bitmapbutton_new_from_file( 'Clear Messages', 0, !global.!icondir||'clear' ) 2301Call dw_box_pack_start tmp, abutton, !global.!toolbox_size, !global.!toolbox_size, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2302Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'ClearMessages' 2303!global.!filetoolbarbox = 0 2304!global.!filetoolbarbutton.0 = 0 /* this ensures that we don't try and delete the buttons */ 2305/* 2306 * Create our repository notebook 2307 */ 2308!global.!repnotebook = dw_notebook_new( 0, !REXXDW.!DW_TAB_TO_TOP ) 2309Call dw_box_pack_start !global.!repnotebookbox, !global.!repnotebook, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2310Call dw_signal_connect !global.!repnotebook, !REXXDW.!DW_SWITCH_PAGE_EVENT, 'SwitchRepositoryCallback' 2311/* 2312 * For each repository, we need to create the tree, file, and message boxen... 2313 */ 2314Do i = 1 To !global.!!number_repositories 2315 Call AddRepositoryPage i 2316End 2317/* 2318 * Setup callbacks 2319 */ 2320Call dw_signal_connect !global.!mainwindow, !REXXDW.!DW_DELETE_EVENT, 'QuitCallback' 2321Call dw_signal_connect !global.!mainwindow, !REXXDW.!DW_KEY_PRESS_EVENT, 'TopWindowKeyPressCallback' 2322/* 2323 * Create our menus.. 2324 */ 2325!global.!mainmenubar = dw_menubar_new( !global.!mainwindow ) 2326/* 2327 * If we have more than 1 repository, create a sub-menu with all but our current 2328 * repository to enable them to be removed - TODO 2329 * How do we recreate this men after removing a repository? 2330 */ 2331/* 2332 * Add items to the 'File' menu 2333 * Note that each menu item MUST have a unique ID, or the callbacks won't work! 2334 */ 2335menu = dw_menu_new( 0 ) 2336menuitem = dw_menu_append_item( menu, '~Add Repository', 1011, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 2337Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'AddRepositoryCallback' 2338/* 2339menuitem = dw_menu_append_item( menu, '~Remove Repository', 1012, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 2340Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'RemoveRepositoryCallback' 2341*/ 2342menuitem = dw_menu_append_item( menu, '~Quit', 1013, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 2343Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'QuitCallback' 2344/* 2345 * Add the 'File' menu to the menubar... 2346 */ 2347Call dw_menu_append_item !global.!mainmenubar, '~File', 1010, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, menu 2348/* 2349 * Add items to the 'Edit' menu 2350 * Note that each menu item MUST have a unique ID, or the callbacks won't work! 2351 */ 2352menu = dw_menu_new( 0 ) 2353menuitem = dw_menu_append_item( menu, '~User Preferences', 1021, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 2354Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'UserPreferencesCallback', 0 2355/* 2356 * Add the 'Edit' menu to the menubar... 2357 */ 2358Call dw_menu_append_item !global.!mainmenubar, '~Edit', 1020, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, menu 2359/* 2360 * Add items to the 'Help' menu 2361 * Note that each menu item MUST have a unique ID, or the callbacks won't work! 2362 */ 2363menu = dw_menu_new( 0 ) 2364menuitem = dw_menu_append_item( menu, '~Contents', 1091, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 2365Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'HelpcontentsCallback' 2366menuitem = dw_menu_append_item( menu, '~About', 1092, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 2367Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'HelpAboutCallback' 2368/* 2369 * Add the 'Help' menu to the menubar... 2370 */ 2371Call dw_menu_append_item !global.!mainmenubar, '~Help', 1090, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, menu 2372/* 2373 * If we have saved our position and size previously, use these details... 2374 */ 2375Select 2376 When maximised Then Nop 2377 When Words( !global.!!user.!!window_pos_size ) = 4 & !global.!!user.!!preference.!!save_position = 1 & \maximised Then 2378 Do 2379 Parse Var !global.!!user.!!window_pos_size xpos ypos !global.!window_width !global.!window_height 2380 If xpos < 0 Then xpos = 0 2381 If ypos < 0 Then ypos = 0 2382 Call dw_window_set_pos_size !global.!mainwindow, xpos, ypos, !global.!window_width, !global.!window_height 2383 End 2384 Otherwise 2385 Do 2386 !global.!window_width = ( !global.!screen_width % 4 ) * 3 2387 !global.!window_height = Max( ( !global.!screen_height % 4 ) * 3, (!global.!maxfilebuttons * !global.!toolbox_size) + (!global.!maxfileseparators * 5) + 90 ) 2388 Call dw_window_set_pos_size !global.!mainwindow, (!global.!screen_width % 2) - (!global.!window_width % 2), (!global.!screen_height % 2) - (!global.!window_height % 2), !global.!window_width, !global.!window_height 2389 End 2390End 2391/* 2392 * Display the main window 2393 */ 2394Call dw_window_show !global.!mainwindow 2395Call SetCursorNoWait 2396Return 2397 2398/* 2399 * Creates a new repository notebook page and creates the base objects within it. 2400 * Doesn't populate the items. 2401 */ 2402AddRepositoryPage: Procedure Expose !REXXDW. !global. !!last_repository 2403Parse Arg i 2404/* 2405 * Create our notebook page and box to pack... 2406 */ 2407!global.!repnotebookpagebox.i = dw_box_new( !REXXDW.!DW_VERT ) 2408!global.!repnotebookpage.i = dw_notebook_page_new( !global.!repnotebook, 0, !REXXDW.!DW_PAGE_TO_BACK ) 2409/* 2410 * Pack the box for the notebook page contents into the notebook page and set the 2411 * text of the notebook page tab 2412 */ 2413Call dw_notebook_pack !global.!repnotebook, !global.!repnotebookpage.i, !global.!repnotebookpagebox.i 2414Call dw_notebook_page_set_text !global.!repnotebook, !global.!repnotebookpage.i, !global.!!repository.!!name.i 2415/* 2416 * Create the tree box. don't pack it as it goes into a splitbar 2417 */ 2418!global.!treebox.i = dw_box_new( !REXXDW.!DW_VERT ) 2419!global.!tree.i = -1 /* ensures we don't try an destroy this the first time we generate the tree */ 2420/* 2421 * Create the box for files and messages. don't pack it as it goes into a splitbar 2422 */ 2423!global.!filemessagebox.i = dw_box_new( !REXXDW.!DW_VERT ) 2424/* 2425 * Create the first splitbar with tree and file boxen. 2426 */ 2427!global.!hsplitbar.i = dw_splitbar_new( !REXXDW.!DW_HORZ, !global.!treebox.i, !global.!filemessagebox.i, 0 ) 2428Call dw_box_pack_start !global.!repnotebookpagebox.i, !global.!hsplitbar.i, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2429Call dw_splitbar_set !global.!hsplitbar.i, 30.0 2430/* 2431 * Create the file box. don't pack it as it goes into a splitbar 2432 */ 2433!global.!filebox.i = dw_box_new( !REXXDW.!DW_VERT ) 2434/* 2435 * Create the message mle. don't pack it as it goes into a splitbar 2436 */ 2437!global.!mle.i = dw_mle_new( 0 ) 2438Call dw_mle_set_word_wrap !global.!mle.i, !REXXDW.!DW_DONT_WORD_WRAP 2439!global.!mle_position.i = -1 2440/* 2441 * Create the second splitbar with file and message boxen. 2442 */ 2443!global.!vsplitbar.i = dw_splitbar_new( !REXXDW.!DW_VERT, !global.!filebox.i, !global.!mle.i, 0 ) 2444Call dw_box_pack_start !global.!filemessagebox.i, !global.!vsplitbar.i, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2445Call dw_splitbar_set !global.!vsplitbar.i, 70.0 2446Call dw_mle_set_editable !global.!mle.i, !REXXDW.!DW_READONLY 2447Call dw_window_set_color !global.!mle.i, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2448/* 2449 * Create our file notebook box... 2450 */ 2451!global.!filenotebook.i = dw_notebook_new( 0, !REXXDW.!DW_TAB_TO_TOP ) 2452Call dw_box_pack_start !global.!filebox.i, !global.!filenotebook.i, 100, 100, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2453Call dw_signal_connect !global.!filenotebook.i, !REXXDW.!DW_SWITCH_PAGE_EVENT, 'SwitchFilesCallback' 2454/* 2455 * We need a notebook page for: 2456 * repository files 2457 * non-repository files 2458 * deleted files 2459 * all files 2460 */ 2461/* 2462 * First page 2463 */ 2464!global.!filenotebookpage.?repfiles.i = dw_notebook_page_new( !global.!filenotebook.i, 0, !REXXDW.!DW_PAGE_TO_BACK ) 2465/* 2466 * We need something to pack into the page... 2467 */ 2468!global.!repfilescontainerbox.i = dw_box_new( !REXXDW.!DW_VERT ) 2469/* 2470 * Now pack the box into the notebook page 2471 */ 2472Call dw_notebook_pack !global.!filenotebook.i, !global.!filenotebookpage.?repfiles.i, !global.!repfilescontainerbox.i 2473Call dw_notebook_page_set_text !global.!filenotebook.i, !global.!filenotebookpage.?repfiles.i, "Repository Files" 2474/* 2475 * Create our container in the box... 2476 */ 2477!global.!repfilescontainer.i = dw_container_new( 2000+i, !REXXDW.!DW_MULTIPLE_SELECTION ) 2478Call dw_box_pack_start !global.!repfilescontainerbox.i, !global.!repfilescontainer.i, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2479/* 2480 * Use a filesystem container. This has as the first two columns, icon and filename, followed 2481 * by our user data. 2482 */ 2483Call dw_filesystem_setup !global.!repfilescontainer.i, '!global.!repfiles_flags.', '!global.!repfiles_titles.' 2484/* 2485 * Second page... 2486 */ 2487!global.!filenotebookpage.?nonrepfiles.i = dw_notebook_page_new( !global.!filenotebook.i, 0, !REXXDW.!DW_PAGE_TO_BACK ) 2488/* 2489 * We need something to pack into the page... 2490 */ 2491!global.!nonrepfilescontainerbox.i = dw_box_new( !REXXDW.!DW_VERT ) 2492/* 2493 * Now pack the box into the notebook page 2494 */ 2495Call dw_notebook_pack !global.!filenotebook.i, !global.!filenotebookpage.?nonrepfiles.i, !global.!nonrepfilescontainerbox.i 2496Call dw_notebook_page_set_text !global.!filenotebook.i, !global.!filenotebookpage.?nonrepfiles.i, "Non Repository Files" 2497/* 2498 * Create our container in the box... 2499 */ 2500!global.!nonrepfilescontainer.i = dw_container_new( 3000+i, !REXXDW.!DW_MULTIPLE_SELECTION ) 2501Call dw_box_pack_start !global.!nonrepfilescontainerbox.i, !global.!nonrepfilescontainer.i, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2502/* 2503 * Use a filesystem container. This has as the first two columns, icon and filename, followed 2504 * by our user data. 2505 */ 2506Call dw_filesystem_setup !global.!nonrepfilescontainer.i, '!global.!nonrepfiles_flags.', '!global.!nonrepfiles_titles.' 2507/* 2508 * Make sure that this list is populated the first time we switch to this 2509 * page. 2510 */ 2511!global.!nonrepfiles.?filename.i.0 = -1 2512/* 2513 * Third page contains deleted files 2514 */ 2515!global.!filenotebookpage.?deletedfiles.i = dw_notebook_page_new( !global.!filenotebook.i, 0, !REXXDW.!DW_PAGE_TO_BACK ) 2516/* 2517 * We need something to pack into the page... 2518 */ 2519!global.!deletedfilescontainerbox.i = dw_box_new( !REXXDW.!DW_VERT ) 2520/* 2521 * Now pack the box into the notebook page 2522 */ 2523Call dw_notebook_pack !global.!filenotebook.i, !global.!filenotebookpage.?deletedfiles.i, !global.!deletedfilescontainerbox.i 2524Call dw_notebook_page_set_text !global.!filenotebook.i, !global.!filenotebookpage.?deletedfiles.i, "Deleted Files" 2525/* 2526 * Create our container in the box... 2527 */ 2528!global.!deletedfilescontainer.i = dw_container_new( 4000+i, !REXXDW.!DW_MULTIPLE_SELECTION ) 2529Call dw_box_pack_start !global.!deletedfilescontainerbox.i, !global.!deletedfilescontainer.i, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2530/* 2531 * Use a filesystem container. This has as the first two columns, icon and filename, followed 2532 * by our user data. 2533 */ 2534Call dw_filesystem_setup !global.!deletedfilescontainer.i, '!global.!deletedfiles_flags.', '!global.!deletedfiles_titles.' 2535/* 2536 * Fourth page 2537 */ 2538!global.!filenotebookpage.?allfiles.i = dw_notebook_page_new( !global.!filenotebook.i, 0, !REXXDW.!DW_PAGE_TO_BACK ) 2539/* 2540 * We need something to pack into the page... 2541 */ 2542!global.!allfilescontainerbox.i = dw_box_new( !REXXDW.!DW_VERT ) 2543/* 2544 * Now pack the box into the notebook page 2545 */ 2546Call dw_notebook_pack !global.!filenotebook.i, !global.!filenotebookpage.?allfiles.i, !global.!allfilescontainerbox.i 2547Call dw_notebook_page_set_text !global.!filenotebook.i, !global.!filenotebookpage.?allfiles.i, "All Files" 2548/* 2549 * Create our container in the box... 2550 */ 2551!global.!allfilescontainer.i = dw_container_new( 2000+i, !REXXDW.!DW_MULTIPLE_SELECTION ) 2552Call dw_box_pack_start !global.!allfilescontainerbox.i, !global.!allfilescontainer.i, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2553/* 2554 * Use a filesystem container. This has as the first two columns, icon and filename, followed 2555 * by our user data. This page is identical to repfiles!! 2556 */ 2557Call dw_filesystem_setup !global.!allfilescontainer.i, '!global.!allfiles_flags.', '!global.!allfiles_titles.' 2558/* 2559 * Make sure that this list is populated the first time we switch to this 2560 * page. 2561 */ 2562!global.!deletedfiles.?filename.i.0 = -1 2563/* 2564 * Set the first page as default 2565 */ 2566!global.!filespage.i = !global.!filenotebookpage.?repfiles.!!last_repository 2567Call dw_notebook_page_set !global.!filenotebook.i, !global.!filenotebookpage.?repfiles.1 2568Return 2569 2570/* 2571 * Project level callbacks... 2572 */ 2573AddRepositoryCallback: Procedure Expose !REXXDW. !global. !!last_repository 2574If GetNewRepository() \= 'close' Then 2575 Do 2576 /* 2577 * We now have everything in a state that we can connect to and display the 2578 * new repository. 2579 */ 2580 !global.!allowcallbacks = 0 2581 Call AddRepositoryPage !!last_repository 2582 Call dw_notebook_page_set !global.!repnotebook, !global.!repnotebookpage.!!last_repository 2583 !global.!allowcallbacks = 1 2584 Call DisplayRepository 2585 End 2586Return 0 2587 2588RemoveRepositoryCallback: Procedure Expose !REXXDW. !global. !!last_repository 2589If GetNewRepository() \= 'close' Then 2590 Do 2591 /* 2592 * We now have everything in a state that we can connect to and display the 2593 * new repository. 2594 */ 2595 !global.!allowcallbacks = 0 2596 Call AddRepositoryPage !!last_repository 2597 Call dw_notebook_page_set !global.!repnotebook, !global.!repnotebookpage.!!last_repository 2598 !global.!allowcallbacks = 1 2599 Call DisplayRepository 2600 End 2601Return 0 2602 2603HelpAboutCallback: Procedure Expose !REXXDW. !global. !!last_repository 2604window_x = !global.!window_width % 2 2605window_x = 500 2606window_y = 200 2607splashwindow = dw_window_new( !REXXDW.!DW_DESKTOP, 'About QOCCA', !global.!windowstyle ) 2608Call dw_window_set_icon splashwindow, !global.!qoccaicon 2609box = dw_box_new( !REXXDW.!DW_VERT ) 2610Call dw_box_pack_start splashwindow, box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2611Call dw_window_set_color box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2612textandimagebox = dw_box_new( !REXXDW.!DW_HORZ ) 2613Call dw_box_pack_start box, textandimagebox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 2614Call dw_window_set_color textandimagebox, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2615imagebox = dw_bitmap_new_from_file( 100, !global.!icondir'bigqocca' ) 2616Call dw_box_pack_start textandimagebox, imagebox, 64, 64, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 2617textbox = dw_box_new( !REXXDW.!DW_VERT ) 2618Call dw_box_pack_start textandimagebox, textbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 2619Call dw_window_set_color textbox, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2620/* 2621 * Display version details 2622 */ 2623t1 = dw_text_new( 'QOCCA', 0 ) 2624Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2625Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2626Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2627t1 = dw_text_new( 'Version' !global.!version, 0 ) 2628Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2629Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2630Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2631t1 = dw_text_new( 'Copyright Mark Hessling 2009', 0 ) 2632Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2633Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2634Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2635t1 = dw_text_new( Copies( '-', 30 ), 0 ) 2636Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2637Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2638Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2639Parse Version ver 2640t1 = dw_text_new( 'Rexx Version:' ver, 0 ) 2641Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2642Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2643Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2644t1 = dw_text_new( 'RexxDW Version:' dw_variable( 'VERSION' ), 0 ) 2645Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2646Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2647Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2648Call dw_environment_query 'ver.' 2649t1 = dw_text_new( 'dwindows Version:' ver.8'.'ver.9'.'ver.10 'Built:' ver.2 ver.3, 0 ) 2650Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2651Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2652Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2653t1 = dw_text_new( 'RegUtil Version:' sysutilversion() '('sysversion()')', 0 ) 2654Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2655Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2656Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2657If !global.!os = 'WIN32' Then 2658 Do 2659 t1 = dw_text_new( 'W32Util Version:' w32version(), 0 ) 2660 Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2661 Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2662 Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2663 End 2664/* 2665 * User info 2666 */ 2667t1 = dw_text_new( Copies( '-', 30 ), 0 ) 2668Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2669Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2670Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2671If userid() \= !global.!user Then userdet = userid() 'mapped to:' !global.!user 2672Else userdet = !global.!user 2673t1 = dw_text_new( 'User:' userdet 'Administrator:' !global.!administrator.!!last_repository, 0 ) 2674Call dw_box_pack_start textbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 2675Call dw_window_set_style t1, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 2676Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 2677/* 2678 * Our OK button 2679 */ 2680abutton = dw_button_new( 'OK', 0 ) 2681Call dw_box_pack_start box, abutton, window_x, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 1 2682Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', splashwindow 2683Call dw_signal_connect splashwindow, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', splashwindow 2684/* 2685 * Display the splash window 2686 */ 2687Call dw_window_set_gravity splashwindow, !REXXDW.!DW_GRAV_CENTRE, !REXXDW.!DW_GRAV_CENTRE 2688Call dw_window_set_pos_size splashwindow, 0, 0, 0, 0 2689Call dw_window_show splashwindow 2690Return 0 2691 2692HelpContentsCallback: Procedure Expose !REXXDW. !global. !!last_repository 2693Call HTMLBrowse !global.!helpdir'index.html', 'QOCCA Help' 2694Return 0 2695 2696/* 2697 * Callback from each file filter button 2698 */ 2699ToggleFileFilterCallback: Procedure Expose !REXXDW. !global. !!last_repository 2700Parse Arg win, idx 2701If !global.!filefilterstatus.!!last_repository.idx = 'off' Then 2702 Do 2703 !global.!filefilterstatus.!!last_repository.idx = '' 2704 bit = '1' 2705 status = 'ON' 2706 End 2707Else 2708 Do 2709 !global.!filefilterstatus.!!last_repository.idx = 'off' 2710 bit = '0' 2711 status = 'OFF' 2712 End 2713!global.!!repository.!!filefilters.!!last_repository = Overlay( bit, !global.!!repository.!!filefilters.!!last_repository, idx, 1 ) 2714--Call dw_window_set_bitmap !global.!filefilterbutton.idx, , !global.!icondir||!global.!filefiltericons.idx||!global.!filefilterstatus.!!last_repository.idx 2715Call dw_window_set_tooltip !global.!filefilterbutton.idx, !global.!filefiltericonsdesc.idx '-' status 2716Return 2717 2718/* 2719 * Sets the file filter buttons to enabled 2720 */ 2721EnableFileFilters: Procedure Expose !REXXDW. !global. !!last_repository 2722Call dw_window_enable !global.!filefilterbuttonapply 2723If Left( !global.!!repository.!!filefilters.!!last_repository, 1 ) = '!' Then !global.!!repository.!!filefilters.!!last_repository = Copies( '1', !global.!filefiltericons.0 ) 2724Do i = 1 To !global.!filefiltericons.0 2725 Call dw_window_enable !global.!filefilterbutton.i 2726End 2727Call ShowFileFilters 2728Return 2729 2730/* 2731 * Sets the file filter buttons to disabled 2732 */ 2733DisableFileFilters: Procedure Expose !REXXDW. !global. !!last_repository 2734Call dw_window_disable !global.!filefilterbuttonapply 2735Do i = 1 To !global.!filefiltericons.0 2736 -- turn off tooltips 2737 Call dw_window_set_tooltip !global.!filefilterbutton.i 2738 Call dw_window_disable !global.!filefilterbutton.i 2739End 2740Return 2741 2742/* 2743 * Set the appropriate file filter button image 2744 */ 2745ShowFileFilters: Procedure Expose !REXXDW. !global. !!last_repository 2746If Left( !global.!!repository.!!filefilters.!!last_repository, 1 ) = '!' Then !global.!!repository.!!filefilters.!!last_repository = Copies( '1', !global.!filefiltericons.0 ) 2747Do i = 1 To !global.!filefiltericons.0 2748 -- set the tooltip to reflect the setting 2749 If Substr( !global.!!repository.!!filefilters.!!last_repository, i, 1 ) = '1' Then 2750 Do 2751 !global.!filefilterstatus.!!last_repository.i = '' 2752 status = 'ON' 2753 End 2754 Else 2755 Do 2756 !global.!filefilterstatus.!!last_repository.i = 'off' 2757 status = 'OFF' 2758 End 2759 Call dw_window_set_tooltip !global.!filefilterbutton.i, !global.!filefiltericonsdesc.i '-' status 2760End 2761Return 2762 2763/* 2764 * Takes the !global.!allfiles. stem and removes any files which don't have the appropriate 2765 * file filter turned on 2766 */ 2767ApplyFileFiltering: Procedure Expose !REXXDW. !global. !!last_repository 2768keep_idx = '' 2769Do i = 1 To !global.!allfiles.?filestatus.!!last_repository.0 2770 status = Substr( !global.!allfiles.?filestatus.!!last_repository.i, 5 ) 2771 Do j = 1 To !global.!filefiltericons.0 2772 filter_on = Substr( !global.!!repository.!!filefilters.!!last_repository, j, 1 ) 2773 If filter_on = 1 & !global.!filefiltericons.j = status Then 2774 Do 2775 keep_idx = keep_idx i 2776 Leave 2777 End 2778 End 2779End 2780num_rows = Words( keep_idx ) 2781!global.!allfiles.?filerev.!!last_repository.0 = num_rows 2782!global.!allfiles.?fullfilename.!!last_repository.0 = num_rows 2783!global.!allfiles.?filename.!!last_repository.0 = num_rows 2784!global.!allfiles.?filepath.!!last_repository.0 = num_rows 2785!global.!allfiles.?filedate.!!last_repository.0 = num_rows 2786!global.!allfiles.?user.!!last_repository.0 = num_rows 2787!global.!allfiles.?filestatus.!!last_repository.0 = num_rows 2788!global.!allfiles.?filereminder.!!last_repository.0 = num_rows 2789!global.!allfiles.?filetype.!!last_repository.0 = num_rows 2790Do i = 1 To num_rows 2791 idx = Word( keep_idx, i ) 2792 newi = Right( i, 4 ) 2793 !global.!allfiles.?filerev.!!last_repository.i = Overlay( newi, !global.!allfiles.?filerev.!!last_repository.idx ) 2794 !global.!allfiles.?fullfilename.!!last_repository.i = Overlay( newi, !global.!allfiles.?fullfilename.!!last_repository.idx ) 2795 !global.!allfiles.?filename.!!last_repository.i = Overlay( newi, !global.!allfiles.?filename.!!last_repository.idx ) 2796 !global.!allfiles.?filepath.!!last_repository.i = Overlay( newi, !global.!allfiles.?filepath.!!last_repository.idx ) 2797 !global.!allfiles.?filedate.!!last_repository.i = Overlay( newi, !global.!allfiles.?filedate.!!last_repository.idx ) 2798 !global.!allfiles.?user.!!last_repository.i = Overlay( newi, !global.!allfiles.?user.!!last_repository.idx ) 2799 !global.!allfiles.?filestatus.!!last_repository.i = Overlay( newi, !global.!allfiles.?filestatus.!!last_repository.idx ) 2800 !global.!allfiles.?filereminder.!!last_repository.i = Overlay( newi, !global.!allfiles.?filereminder.!!last_repository.idx ) 2801 !global.!allfiles.?filetype.!!last_repository.i = Overlay( newi, !global.!allfiles.?filetype.!!last_repository.idx ) 2802End 2803Return 2804 2805/* 2806 * The callback executed when the user left-clicks on an item in the tree 2807 */ 2808DirSelectCallback: Procedure Expose !REXXDW. !global. !!last_repository 2809If !global.!allowcallbacks = 1 Then 2810 Do 2811 Parse Arg window, item, text, itemdata, data 2812 Call SetCursorWait 2813 if trace() = 'F' Then say 'DirSelectCallback: window:' window 'item:' item 'text:' text 'itemdata:' itemdata 'data:' data 2814 Parse Var itemdata parent fulldir 2815 If fulldir = '' Then !global.!current_dirname.!!last_repository = '.' 2816 Else !global.!current_dirname.!!last_repository = Substr( fulldir, 2 ) 2817 /* 2818 * Save the tree item that represents the currently selected directory 2819 */ 2820 !global.!selected_treeitem.!!last_repository = item 2821 /* 2822 * Adjust the directory toolbar 2823 */ 2824 Call AdjustDirToolbarList 2825 Call AdjustDirToolbarButtons 2826 /* 2827 * Refresh the repository files, non-rep files and deleted files 2828 * tabs. DO NOT refresh the all files tab; it takes too long unless 2829 * it is the current tab 2830 */ 2831 Call DisplayRepositoryFiles 2832 Call DisplayNonRepositoryFiles 2833 Call DisplayDeletedFiles 2834 If !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then Call DisplayAllFiles 2835 /* 2836 * If this directory is set for reserved checkout, 2837 */ 2838 Call SetLockedStatusIcon 2839 /* 2840 * Adjust the file toolbar as well! 2841 */ 2842 Call FileSelectCallback 2843 Call SetCursorNoWait 2844 End 2845Return 0 2846 2847/* 2848 * The callback executed when the user right-clicks on an item in the tree 2849 */ 2850DirMenuCallback: Procedure Expose !REXXDW. !global. !!last_repository 2851If !global.!allowcallbacks = 1 Then 2852 Do 2853 Parse Arg window, text, x, y, itemdata 2854 if trace() = 'F' Then say 'Dirmenucallback' window ',' text ',' x ',' y ',' itemdata 2855 Call DisplayDirMenu x, y 2856 End 2857Return 1 2858 2859/* 2860 * The callback executed when the user left-clicks on an item in file listing 2861 */ 2862FileSelectCallback: Procedure Expose !REXXDW. !global. !!last_repository 2863If !global.!allowcallbacks = 1 Then 2864 Do 2865 Parse Arg arg1, arg2, arg3, arg4, arg5, arg6, arg7 2866 if trace() = 'F' Then say 'FileSelectCallback' arg1','arg2','arg3','arg4','arg5','arg6','arg7 2867 Call AdjustFileToolbarList 2868 Call AdjustFileToolbarButtons 2869 End 2870Return 0 2871 2872/* 2873 * The callback executed when the user right-clicks on an item in file listing 2874 */ 2875FileMenuCallback: Procedure Expose !REXXDW. !global. !!last_repository 2876If !global.!allowcallbacks = 1 Then 2877 Do 2878 Parse Arg window, text, x, y, itemdata 2879 if trace() = 'F' Then say 'FileMenucallback' window ',' text ',' x ',' y ',' itemdata 2880 Call AdjustFileToolbarList 2881 Call DisplayFileMenu x, y 2882 End 2883Return 0 2884 2885/* 2886 * Sorts the file list based on the column heading clicked 2887 */ 2888FileSortCallback: Procedure Expose !REXXDW. !global. !!last_repository 2889Parse Arg ., column 2890Select 2891 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then 2892 Do 2893 !global.!repfile_sort_order = column 2894 /* 2895 * Toggle the sort order for the column. 2896 */ 2897 If !global.!repfile_sort_direction.column = 'ascending' Then !global.!repfile_sort_direction.column = 'descending' 2898 Else !global.!repfile_sort_direction.column = 'ascending' 2899 Call SortFileArray 2900 Call DisplayFileArray 2901 End 2902 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?nonrepfiles.!!last_repository Then 2903 Do 2904 !global.!nonrepfile_sort_order = column 2905 /* 2906 * Toggle the sort order for the column. 2907 */ 2908 If !global.!nonrepfile_sort_direction.column = 'ascending' Then !global.!nonrepfile_sort_direction.column = 'descending' 2909 Else !global.!nonrepfile_sort_direction.column = 'ascending' 2910 Call SortNonrepFileArray 2911 Call DisplayNonRepFileArray 2912 End 2913 When !global.!filespage.!!last_repository = !global.!filespage.?deletedrepfiles Then 2914 Do 2915 /* Call DisplayDeletedFiles */ 2916 End 2917 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then 2918 Do 2919 !global.!allfile_sort_order = column 2920 /* 2921 * Toggle the sort order for the column. 2922 */ 2923 If !global.!allfile_sort_direction.column = 'ascending' Then !global.!allfile_sort_direction.column = 'descending' 2924 Else !global.!allfile_sort_direction.column = 'ascending' 2925 Call SortAllFileArray 2926 Call DisplayAllFileArray 2927 End 2928 Otherwise Nop 2929End 2930Return 0 2931 2932/* 2933 * The callback executed when the user left-clicks on an item in the link tree 2934 */ 2935LinkDirSelectCallback: Procedure Expose !REXXDW. !global. !!last_repository 2936Parse Arg window, item, text, itemdata, data 2937if trace() = 'F' Then say 'LinkDirSelectCallback: window:' window 'item:' item 'text:' text 'itemdata:' itemdata 'data:' data 2938Parse Var itemdata parent fulldir 2939!global.!linkdir.?linked_dirname = fulldir 2940Return 0 2941 2942LinkDirApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 2943Parse Arg ., win, dialog 2944linked_dirname = !global.!linkdir.?linked_dirname 2945common_dirname = '/'!global.!current_dirname.!!last_repository 2946/* 2947 * Get the last directory component of the current directory 2948 */ 2949mycomm = Strip( common_dirname, 'T', '/' ) 2950lp = Lastpos( '/', mycomm ) 2951lastdir = Substr( mycomm, lp ) 2952newdir = linked_dirname || lastdir 2953mytail = mycomm 2954/* 2955 * Determine how many common, leading directories there are. This is used to reduce 2956 * the number of relative directories we need to go back up to find the linked 2957 * directory. 2958 * eg: 2959 * mycomm = /dir1/apath 2960 * newdir = /dir1/fred/apath 2961 * 2962 * Should result in ln -s ../apath . rather than ../../dir1/apath 2963 */ 2964Do i = 1 To Min( Length( mycomm ), Length( newdir ) ) 2965 If Substr( mycomm, i, 1 ) = '/' Then last_dir_pos = i 2966 If Substr( mycomm, i, 1 ) \= Substr( newdir, i, 1 ) Then Leave 2967End 2968num_common_dirs = Countstr( '/', Substr( mycomm, 1, i ) ) - 1 2969If num_common_dirs \= 0 Then mytail = Substr( mytail, last_dir_pos ) 2970/* 2971 * Add linked_dirname into !linked_dir. stem if it isn't there already, first 2972 * checking to ensure its not already in dir. stem (that's an error) 2973 */ 2974found = 0 2975Do i = 1 To !global.!repdir.!!last_repository.0 2976 If newdir = !global.!repdir.!!last_repository.i Then 2977 Do 2978 Call dw_messagebox 'Cannot link!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), 'Cannot link' quote( !global.!current_dirname.!!last_repository ) 'to' quote( linked_dirname ) 'as that directory already contains:' quote( Substr( mytail, 2 ) ) 2979 Call Directory !global.!!repository.!!working_dir.!!last_repository 2980 Return 'retry' 2981 End 2982End 2983/* 2984 * Add !global.!current_dirname.!!last_repository into !global.!current_dir. stem if it isn't there already 2985 */ 2986found = 0 2987Do i = 1 To !global.!common_dir.0 2988 If !global.!common_dir.i = common_dirname Then 2989 Do 2990 found = 1 2991 common_idx = i 2992 Leave 2993 End 2994End 2995If found = 0 Then 2996 Do 2997 ldi = !global.!common_dir.0+1 2998 !global.!common_dir.0 = ldi 2999 !global.!common_dir.ldi = common_dirname 3000 common_idx = ldi 3001 End 3002/* 3003 * See if we already have the linked dir 3004 */ 3005found = 0 3006Do i = 1 To !global.!linked_dir.0 3007 If !global.!linked_dir.i = newdir Then 3008 Do 3009 found = 1 3010 Leave 3011 End 3012End 3013If found = 0 Then 3014 Do 3015 i = !global.!linked_dir.0+1 3016 !global.!linked_dir.0 = i 3017 !global.!linked_dir.i = newdir 3018 !global.!linked_idx.0 = i 3019 !global.!linked_idx.i = common_idx 3020 End 3021 3022Select 3023 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 3024 Do 3025 /* 3026 * Now symlink the common dir to the linked dirname 3027 * eg. Linking /tmfps/common to /tmfps/app/common 3028 * cd /tmfps/app 3029 * ln -sf ../common . 3030 */ 3031 Call Directory !global.!!repository.!!shortpath.!!last_repository||linked_dirname 3032 num_dots = Countstr( '/', linked_dirname ) - num_common_dirs 3033 linkdir = Copies( '../', num_dots ) || Substr( mytail, 2 ) 3034 Address Command !global.!symlink linkdir . 3035 End 3036End 3037 3038Call Directory !global.!!repository.!!working_dir.!!last_repository 3039/* 3040 * Update the build.conf file in the repository 3041 */ 3042Call WriteBuildConf 'Linking' common_dirname 'to' newdir 3043Call dw_dialog_dismiss dialog, 'apply' 3044/* 3045 * Destroy the window 3046 */ 3047Call dw_window_destroy win 3048Call DisplayRepository 3049Return 'apply' 3050 3051/* 3052 * The callback executed when the user left-clicks on an item in the moduleselect tree 3053 */ 3054SelectDirSelectCallback: Procedure Expose !REXXDW. !global. !!last_repository 3055Parse Arg window, item, text, itemdata, data, entry 3056Parse Var itemdata parent fulldir 3057!global.!selecteddir = Substr( fulldir, 2 ) 3058Return 0 3059 3060SelectDirApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 3061Parse Arg ., win, dialog, entry 3062Call dw_window_set_text entry, !global.!selecteddir 3063Call dw_dialog_dismiss dialog, 'apply' 3064/* 3065 * Destroy the window 3066 */ 3067Call dw_window_destroy win 3068Return 'apply' 3069 3070/* 3071 * This callback handles a user-created menu item. 3072 */ 3073UserDirCommandCallback: Procedure Expose !REXXDW. !global. !!last_repository 3074If !global.!allowcallbacks = 1 Then 3075 Do 3076 Parse Arg window, idx 3077 template = GetUserSubstitutionVariables( !global.!!user.!!dirmenu.!!command.idx ) 3078 If template \= '' Then 3079 Do 3080 dircmd = Changestr( '%D%', template, GetFullWorkingDirectory( !global.!current_dirname.!!last_repository ) ) 3081 dircmd = Changestr( '%W%', dircmd, !global.!!repository.!!working_dir.!!last_repository ) 3082 dircmd = Changestr( '%%%', dircmd, '%' ) 3083 /* 3084 * Before executing the user supplied command change directory to the current_dirname 3085 */ 3086 here = Directory() 3087 Call Directory !global.!current_dirname.!!last_repository 3088 Address System !global.!background_start_nowindow dircmd !global.!background_end 3089 Call Directory here 3090 End 3091 End 3092Return 0 3093 3094UserFileCommandCallback: Procedure Expose !REXXDW. !global. !!last_repository 3095If !global.!allowcallbacks = 1 Then 3096 Do 3097 Parse Arg window, idx 3098 template = GetUserSubstitutionVariables( !global.!!user.!!filemenu.!!command.idx ) 3099 If template \= '' Then 3100 Do 3101 filecmd = Changestr( '%D%', template, GetFullWorkingDirectory( !global.!current_dirname.!!last_repository ) ) 3102 filecmd = Changestr( '%W%', filecmd, !global.!!repository.!!working_dir.!!last_repository ) 3103 filecmd = Changestr( '%%%', filecmd, '%' ) 3104 /* 3105 * Get all of the currently selected filenames... 3106 */ 3107 wd = !global.!!repository.!!working_dir.!!last_repository 3108 current_filenames = '' 3109 Do i = 1 To !global.!current_filenames.0 3110 current_filenames = current_filenames quote( wd || !global.!current_filenames.i ) 3111 End 3112 filecmd = Changestr( '%F%', filecmd, current_filenames ) 3113 /* 3114 * Before executing the user supplied command change directory to the current_dirname 3115 */ 3116 here = Directory() 3117 Call Directory !global.!current_dirname.!!last_repository 3118 Address System !global.!background_start_nowindow filecmd !global.!background_end 3119 Call Directory here 3120 End 3121 End 3122Return 0 3123 3124GetUserSubstitutionVariables: Procedure Expose !REXXDW. !global. !!last_repository 3125Parse Arg template 3126/* 3127 * Ignore %D% %W% and %F% 3128 * Count how many "reserved" variables, and count how many % (must be 2*) 3129 * Check if the template contains any substitution variables of the 3130 * form %n% where n is 1-9. 3131 */ 3132tmp_template = Changestr( '%D%', template, ' ' ) 3133tmp_template = Changestr( '%W%', tmp_template, ' ' ) 3134tmp_template = Changestr( '%F%', tmp_template, ' ' ) 3135tmp_template = Changestr( '%%%', tmp_template, ' ' ) 3136all_perc = Countstr( '%', tmp_template ) 3137If all_perc = 0 Then Return template 3138/* 3139 * There are user variables 3140 */ 3141If all_perc // 2 = 1 Then 3142 Do 3143 /* messagebox*/ 3144 Return '' 3145 End 3146!global.!usermenuvariable.0 = 0 3147Do Forever 3148 Parse Var tmp_template . '%' name '%' tmp_template 3149 If name = '' Then Leave 3150 /* 3151 * We have a variable name, do we already have it ? 3152 */ 3153 found = 0 3154 Do i = 1 To !global.!usermenuvariable.0 3155 If !global.!usermenuvariable.i = name Then 3156 Do 3157 found = 1 3158 Leave 3159 End 3160 End 3161 If \found Then 3162 Do 3163 idx = !global.!usermenuvariable.0 + 1 3164 !global.!usermenuvariable.idx = name 3165 !global.!usermenuvariable.0 = idx 3166 End 3167End 3168/* 3169 * Pop up a dialog box with a text field for each variable 3170 */ 3171title_width = 130 3172win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Set variable Values', !global.!windowstyle ) 3173Call dw_window_set_icon win, !global.!qoccaicon 3174topbox = dw_box_new( !REXXDW.!DW_VERT ) 3175Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 3176/* 3177 * Add a description of the command showing the command 3178 */ 3179tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 3180Call dw_box_pack_start topbox, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3181tmp = dw_text_new( 'Command', 0 ) 3182Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3183Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 3184tmp = dw_entryfield_new( template, 0 ) 3185Call dw_box_pack_start tmpbox, tmp, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3186Call dw_window_disable tmp 3187/* 3188 * Add the boxes and widgets for the variables... 3189 */ 3190Do i = 1 To !global.!usermenuvariable.0 3191 varnum = !global.!usermenuvariable.i 3192 tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 3193 Call dw_box_pack_start topbox, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3194 tmp = dw_text_new( varnum, 0 ) 3195 Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3196 Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 3197 saved_value = GetSavedUserVariable( !global.!usermenuvariable.i ) 3198 !global.!usermenuvariable_entry.i = dw_entryfield_new( saved_value, 0 ) 3199 Call dw_box_pack_start tmpbox, !global.!usermenuvariable_entry.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3200End 3201/* 3202 * Create OK 3203 */ 3204b1 = dw_button_new( 'OK', 0 ) 3205Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3206/* 3207 * Display the window 3208 */ 3209width = 400 3210height = ( 2 * !global.!buttonheight ) + ( ( 1 + !global.!usermenuvariable.0 ) * !global.!widgetheight ) 3211Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 3212Call dw_window_show win 3213 Call dw_main_sleep 10 3214Do Forever 3215 /* 3216 * Create a dialog for the window 3217 */ 3218 dialog_wait = dw_dialog_new( ) 3219 /* 3220 * We now have everything setup, we can connect the destroying of the top-level window 3221 * to the 'close' callback 3222 */ 3223 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GetUserSubstitutionVariablesApplyCallback', win, dialog_wait 3224 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 3225 /* 3226 * Wait for the dialog to come back 3227 */ 3228 cancel = dw_dialog_wait( dialog_wait ) 3229 /* 3230 * All successful processing done in the 'applycallback', so simply get 3231 * out of the loop if we don't have any validation issues 3232 */ 3233 If cancel \= 'retry' Then Leave 3234End 3235If cancel = 'apply' Then 3236 Do 3237 /* 3238 * As we only have an OK, we will apply the stuff now 3239 */ 3240 Do i = 1 To !global.!usermenuvariable.0 3241 varnum = !global.!usermenuvariable.i 3242 template = Changestr( '%'varnum'%', template, !global.!usermenuvalue.i ) 3243 End 3244 End 3245Else template = '' 3246Drop !global.!usermenuvariable. !global.!usermenuvalue. !global.!usermenuvariable_entry. 3247Return template 3248 3249GetUserSubstitutionVariablesApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 3250Parse Arg ., win, dialog_wait 3251/* 3252 * Get the values for each variable 3253 */ 3254Do i = 1 To !global.!usermenuvariable.0 3255 !global.!usermenuvalue.i = Strip( dw_window_get_text( !global.!usermenuvariable_entry.i ) ) 3256 Call SetSavedUserVariable !global.!usermenuvariable.i, !global.!usermenuvalue.i 3257End 3258Call dw_dialog_dismiss dialog_wait, 'apply' 3259Call dw_window_destroy win 3260Return 0 3261 3262GetSavedUserVariable: Procedure Expose !REXXDW. !global. !!last_repository 3263Parse Arg varname 3264Do i = 1 To !global.!usermenu_saved_variable_name.0 3265 If !global.!usermenu_saved_variable_name.i = varname Then Return !global.!usermenu_saved_variable_value.i 3266End 3267Return '' 3268 3269SetSavedUserVariable: Procedure Expose !REXXDW. !global. !!last_repository 3270Parse Arg varname, varvalue 3271found = 0 3272Do i = 1 To !global.!usermenu_saved_variable_name.0 3273 If !global.!usermenu_saved_variable_name.i = varname Then 3274 Do 3275 found = 1 3276 !global.!usermenu_saved_variable_value.i = varvalue 3277 Leave 3278 End 3279End 3280If \found Then 3281 Do 3282 idx = !global.!usermenu_saved_variable_name.0 + 1 3283 !global.!usermenu_saved_variable_name.idx = varname 3284 !global.!usermenu_saved_variable_value.idx = varvalue 3285 !global.!usermenu_saved_variable_name.0 = idx 3286 End 3287Return 3288 3289SwitchRepositoryCallback: Procedure Expose !REXXDW. !global. !!last_repository 3290If !global.!allowcallbacks = 1 Then 3291 Do 3292 Parse Arg window, page, itemdata 3293 if trace() = 'F' Then say 'SwitchRepositoryCallback' window ',' page ',' itemdata '|' !global.!allowcallbacks 3294 Call DisconnectFromRepository 3295 -- find the pageid to switch to. The page arg is not always 3296 -- an index; on OS/2 its a pointer 3297 Do i = 1 To !global.!!number_repositories 3298 If page = !global.!repnotebookpage.i Then Leave 3299 End 3300 !!last_repository = i 3301 Call ConnectToRepository !!last_repository 3302 /* 3303 * Disable our file filters in case we are switching to a different repository tab 3304 */ 3305 Call DisableFileFilters 3306 /* 3307 * If we haven't already loaded the repository details before, do it now 3308 * otherwise, re-read the local copy of the build.conf 3309 */ 3310 If !global.!tree.!!last_repository = -1 Then Call DisplayRepository 3311 Else 3312 Do 3313 Call ReadBuildConf 3314 Call SetRepositoryEnvs 3315 Call SetupEnvironment 3316 Call AdjustToolbars 3317 End 3318 Call PopulateBookmarks 3319 Call SetWindowTitle 3320 Call Directory !global.!!repository.!!working_dir.!!last_repository 3321 /* 3322 * If this directory is set for reserved checkout, 3323 */ 3324 Call SetLockedStatusIcon 3325 /* 3326 * if we are displaying the All FIles tab, then enable the file filters 3327 */ 3328 If !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then Call EnableFileFilters 3329 End 3330Return 0 3331 3332SwitchFilesCallback: Procedure Expose !REXXDW. !global. !!last_repository 3333If !global.!allowcallbacks = 1 Then 3334 Do 3335 Parse Arg window, page, itemdata 3336 if trace() = 'F' Then say 'SwitchFilesCallback' window ',' page ',' itemdata '|' !global.!allowcallbacks 3337 /* 3338 * page argument is return value from dw_notebook_page_new() 3339 */ 3340 !global.!filespage.!!last_repository = page 3341 /* 3342 * Because the valid buttons are different for repository and 3343 * non-repository files, we have to adjust them when we switch 3344 */ 3345 Call AdjustFileToolbarList 3346 Call AdjustFileToolbarButtons 3347 /* 3348 * If switching to the "all files" page and we haven't been here before, 3349 * go and get all the details - TODO 3350 */ 3351 If page = !global.!filenotebookpage.?allfiles.!!last_repository Then 3352 Do 3353 Call EnableFileFilters 3354 Call DisplayAllFiles 3355 End 3356 Else 3357 Do 3358 Call DisableFileFilters 3359 End 3360 End 3361Return 0 3362 3363QuitCallback: Procedure Expose !REXXDW. !global. !!last_repository 3364If !global.!!user.!!preference.!!confirm_exit = 1 Then exit = dw_messagebox( 'Exit QOCCA', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'Are you sure you want to exit QOCCA?' ) 3365Else exit = !REXXDW.!DW_MB_RETURN_YES 3366If exit = !REXXDW.!DW_MB_RETURN_YES Then 3367 Do 3368 /* 3369 * Save the last position and size of the window 3370 */ 3371 If !global.!!user.!!preference.!!save_position = 1 Then 3372 Do 3373 Parse Value dw_window_get_pos_size( !global.!mainwindow ) With posx posy sizex sizey 3374 !global.!!user.!!window_pos_size = posx posy sizex sizey 3375 End 3376 /* 3377 * Save the user's last settings... 3378 */ 3379 Call WriteUserSettingsFile 3380 /* 3381 * Disable any callbacks from now on... 3382 */ 3383 !global.!allowcallbacks = 0 3384 Call dw_window_destroy !global.!mainwindow 3385 Call CleanUpAndExit 0 3386 Call dw_exit 0 3387 Exit 0 3388 End 3389Return 1 /* returning 1 ensures dwindows ignores the event */ 3390 3391/* 3392 * Called when any key pressed in the top level window 3393 */ 3394TopWindowKeyPressCallback: Procedure Expose !REXXDW. !global. !!last_repository 3395Parse Arg window, key, virtual_key, state 3396if trace() = 'F' Then say virtual_key state !REXXDW.!DW_KC_CTRL 3397Select 3398 When window = !global.!mainwindow Then 3399 Do 3400 If (virtual_key = c2d( 'q' ) | virtual_key = 17 ) & state = !REXXDW.!DW_KC_CTRL Then Call QuitCallback 3401 End 3402 Otherwise Nop 3403End 3404Return 0 3405 3406ClearMessages: Procedure Expose !REXXDW. !global. !!last_repository 3407Call dw_window_enable !global.!mle.!!last_repository 3408Call dw_mle_set_cursor !global.!mle.!!last_repository, 0 3409Call dw_mle_delete !global.!mle.!!last_repository 3410!global.!mle_position.!!last_repository = -1 3411Return 0 3412 3413JobStatusCallback: Procedure Expose !REXXDW. !global. !!last_repository 3414/* 3415 * Create a container box with 3416 * +---------------------------------------------------+ 3417 * | Type | StartDate | StartTime | Comp | Desc | 3418 * +---------------------------------------------------+ 3419 * | build | 03/12/03 | 12:23:45 | Y | Build of..| 3420 * +---------------------------------------------------+ 3421 * | | View | | Delete | | 3422 * +---------------------------------------------------+ 3423 * | OK | 3424 * +---------------------------------------------------+ 3425 * and provide right-click menu with 'View...' and 'Delete' 3426 * 3427 */ 3428flags.0 = 5 3429flags.1 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 3430flags.2 = dw_or( !REXXDW.!DW_CFA_TIME, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 3431flags.3 = dw_or( !REXXDW.!DW_CFA_BITMAPORICON, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 3432flags.4 = dw_or( !REXXDW.!DW_CFA_BITMAPORICON, !REXXDW.!DW_CFA_CENTER, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 3433flags.5 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 3434titles.0 = 5 3435titles.1 = 'StartDate' 3436titles.2 = 'StartTime' 3437titles.3 = 'Comp' 3438titles.4 = 'Type' 3439titles.5 = 'Description' 3440win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Job Details', !global.!windowstyle ) 3441Call dw_window_set_icon win, !global.!qoccaicon 3442topbox = dw_box_new( !REXXDW.!DW_VERT ) 3443Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 3444/* 3445 * Create our container in the box... 3446 */ 3447!global.!jobscontainer = dw_container_new( 1, !REXXDW.!DW_MULTIPLE_SELECTION ) 3448Call dw_box_pack_start topbox, !global.!jobscontainer, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 3449!global.!jobscontainer.?firsttime = 1 3450/* 3451 * Use a normal container. 3452 */ 3453Call dw_container_setup !global.!jobscontainer, 'flags.', 'titles.', 0 3454 3455Call DisplayJobs 3456/* 3457 * Create View and Delete buttons... 3458 */ 3459buttonbox = dw_box_new( !REXXDW.!DW_HORZ ) 3460Call dw_box_pack_start topbox, buttonbox, 0, !global.!buttonheight+10, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3461Call dw_box_pack_start buttonbox, 0, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3462b0 = dw_button_new( 'View', 0 ) 3463Call dw_box_pack_start buttonbox, b0, 50, !global.!buttonheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 5 3464Call dw_box_pack_start buttonbox, 0, 50, !global.!buttonheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3465b1 = dw_button_new( 'Delete', 0 ) 3466Call dw_box_pack_start buttonbox, b1, 50, !global.!buttonheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 5 3467Call dw_box_pack_start buttonbox, 0, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3468 3469/* 3470 * Create OK button 3471 */ 3472b2 = dw_button_new( 'OK', 0 ) 3473Call dw_box_pack_start topbox, b2, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3474/* 3475 * Display the window 3476 */ 3477width = 640 3478height = 320 /* text_height + cb_height + 80 */ 3479Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 3480Call dw_window_show win 3481 Call dw_main_sleep 10 3482Do Forever 3483 /* 3484 * Create a dialog for the window 3485 */ 3486 dialog_wait = dw_dialog_new( ) 3487 /* 3488 * We now have everything setup, we can connect the destroying of the top-level window 3489 * to the 'close' callback 3490 */ 3491 Call dw_signal_connect b0, !REXXDW.!DW_CLICKED_EVENT, 'JobsButtonCallback', 'view' 3492 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'JobsButtonCallback', 'delete' 3493 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 3494 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 3495 /* 3496 * Wait for the dialog to come back 3497 */ 3498 cancel = dw_dialog_wait( dialog_wait ) 3499 /* 3500 * All successful processing done in the 'applycallback', so simply get 3501 * out of the loop if we don't have any validation issues 3502 */ 3503 If cancel \= 'retry' Then Leave 3504End 3505Return 1 3506 3507DisplayJobs: Procedure Expose !REXXDW. !global. !!last_repository 3508/* 3509 * Determine how many items in the container... 3510 */ 3511nativelogdir = FindNativeLogDirectory() 3512If Stream( nativelogdir, 'C','QUERY EXISTS' ) = '' Then job.0 = 0 3513Else Call SysFileTree nativelogdir || !global.!ossep'qocca_bg*.desc', 'JOB.', 'FLS' 3514If job.0 > 1 Then Call SysStemSort 'JOB.','descending', , , , 1, 20 3515Do i = 1 To job.0 3516 fulldescfile = Changestr( '/', Word( job.i, 5 ), !global.!ossep ) 3517 len = Length( fulldescfile ) 3518 descfile = Substr( fulldescfile, 2+ Length( nativelogdir ) ) 3519 Parse Var descfile 1 basefile.i '.desc' 1 . 10 date.i 18 time.i '.desc' 3520 date.i = SortedDateToDisplayDate( date.i ) 3521 /* 3522 * Check if the indicator file exists. If so, then check the return code 3523 */ 3524 indfile = nativelogdir||!global.!ossep||basefile.i 3525 compicon.i = '' 3526 If Stream( indfile, 'C', 'QUERY EXISTS' ) = '' Then completed.i = 0 3527 Else 3528 Do 3529 completed.i = 1 3530 Call Stream indfile, 'C', 'OPEN READ' 3531 rcode = Linein( indfile ) 3532 If rcode = 0 Then compicon.i = !global.!okicon 3533 Else compicon.i = !global.!noicon 3534 Call Stream indfile, 'C', 'CLOSE' 3535 End 3536 /* 3537 * Read the description file for details about the job 3538 */ 3539 Call Stream fulldescfile, 'C', 'OPEN READ' 3540 desc.i = Linein( fulldescfile ) 3541 type = Linein( fulldescfile ) 3542 type.i = type 3543 /* determine the icon ... */ 3544 If type = 'testbuild' Then type = 'build' 3545 pos = Wordpos( type, !global.!jobicons ) 3546 If pos = 0 Then typeicon.i = '' 3547 Else typeicon.i = !global.!jobicon.pos 3548 compiler.i = Linein( fulldescfile ) 3549 Call Stream fulldescfile, 'C', 'CLOSE' 3550End 3551 3552/* 3553 * Delete everything in the container so we can replace the existing files 3554 */ 3555If !global.!jobscontainer.?firsttime = 0 Then 3556 Do 3557 Call dw_signal_disconnect !global.!jobscontainer, !REXXDW.!DW_ITEM_CONTEXT_EVENT 3558 Call dw_container_clear !global.!jobscontainer, !REXXDW.!DW_DONT_REDRAW 3559 End 3560!global.!jobscontainer.?firsttime = 0 3561/* 3562 * Add the entries into the container 3563 */ 3564containermemory = dw_container_alloc( !global.!jobscontainer, job.0 ) 3565Do i = 1 To job.0 3566 Call dw_container_set_item !global.!jobscontainer, containermemory, 0, i-1, date.i 3567 time = Substr( time.i, 1, 2 )':'Substr( time.i, 3, 2 )':'Substr( time.i, 5, 2 ) 3568 Call dw_container_set_item !global.!jobscontainer, containermemory, 1, i-1, time 3569 If compicon.i \= '' Then 3570 Call dw_container_set_item !global.!jobscontainer, containermemory, 2, i-1, compicon.i 3571 If typeicon.i \= '' Then 3572 Call dw_container_set_item !global.!jobscontainer, containermemory, 3, i-1, typeicon.i 3573 Call dw_container_set_item !global.!jobscontainer, containermemory, 4, i-1, desc.i 3574 Call dw_container_set_row_title containermemory, i-1, type.i','basefile.i 3575End 3576Call dw_container_set_stripe !global.!jobscontainer, !REXXDW.!DW_CLR_WHITE, !global.!container_colour 3577Call dw_container_insert !global.!jobscontainer, containermemory, job.0 3578Call dw_container_optimize !global.!jobscontainer 3579/* 3580 * Only now can we connect our signals, because dw_set_file() causes the signals to fire!!!... 3581 */ 3582Call dw_signal_connect !global.!jobscontainer, !REXXDW.!DW_ITEM_CONTEXT_EVENT, 'JobsMenuCallback' 3583 3584Return 3585 3586/* 3587 * Create a popup menu with "View" and "Delete" items 3588 */ 3589JobsMenuCallback: Procedure Expose !REXXDW. !global. !!last_repository 3590Parse Arg window, text, x, y, itemdata 3591/* 3592 * Determine which job items are currently selected 3593 */ 3594basefiles = '' 3595selected = dw_container_query_start( !global.!jobscontainer, !REXXDW.!DW_CRA_SELECTED ) 3596Do i = 1 While selected \= '' 3597 basefiles = basefiles selected 3598 selected = dw_container_query_next( !global.!jobscontainer, !REXXDW.!DW_CRA_SELECTED ) 3599End 3600basefiles = Strip( basefiles ) 3601/* 3602 * Create our popup and display it 3603 */ 3604popup = dw_menu_new( 0 ) 3605menuitem = dw_menu_append_item( popup,'View', 1001, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 3606Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'JobsViewCallback', basefiles 3607menuitem = dw_menu_append_item( popup,'Delete', 1002, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 3608Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'JobsDeleteCallback', basefiles 3609Call dw_menu_popup popup, !global.!mainwindow, x, y 3610Return 1 3611 3612/* 3613 * Callback for Jobs Buttons 3614 */ 3615JobsButtonCallback: Procedure Expose !REXXDW. !global. !!last_repository 3616Parse Arg ., action 3617/* 3618 * Determine which job items are currently selected 3619 */ 3620basefiles = '' 3621selected = dw_container_query_start( !global.!jobscontainer, !REXXDW.!DW_CRA_SELECTED ) 3622Do i = 1 While selected \= '' 3623 basefiles = basefiles selected 3624 selected = dw_container_query_next( !global.!jobscontainer, !REXXDW.!DW_CRA_SELECTED ) 3625End 3626basefiles = Strip( basefiles ) /* don't quote filenames */ 3627Select 3628 When basefiles = '' Then Nop 3629 When action = 'view' & Words( basefiles ) = 1 Then Call JobsViewCallback '', basefiles 3630 When action = 'delete' Then Call JobsDeleteCallback '', basefiles 3631 Otherwise Nop 3632End 3633Return 1 3634 3635/* 3636 * Only one file allowed for view 3637 */ 3638JobsViewCallback: Procedure Expose !REXXDW. !global. !!last_repository 3639Parse Arg ., type','jobs 3640nativelogdir = FindNativeLogDirectory() 3641/* 3642 * Convert the .out file into .html if it doesn't already exist 3643 * Read .desc for description... 3644 */ 3645html_file = nativelogdir||!global.!ossep||jobs'.html' 3646desc_file = nativelogdir||!global.!ossep||jobs'.desc' 3647out_file = nativelogdir||!global.!ossep||jobs'.out' 3648 3649jobdatetime = Right( jobs, 14 ) 3650jobdate = Date( 'N', Left( jobdatetime, 8 ), 'S' ) 3651jobtime = Substr( jobdatetime, 9, 2 )':'Substr( jobdatetime, 11, 2 )':'Substr( jobdatetime, 13, 2 ) 3652jobdatetime = 'Job started on:' jobdate 'at' jobtime 3653 3654/*If Stream( html_file, 'C', 'QUERY EXISTS' ) = '' Then*/ 3655 Do 3656 Call Stream desc_file, 'C', 'OPEN READ' 3657 jobtitle = Linein( desc_file ) 3658 junk = Linein( desc_file ) 3659 compiler_type = Linein( desc_file ) 3660 Call Stream desc_file, 'C', 'CLOSE' 3661 3662 Call Stream out_file, 'C', 'OPEN READ' 3663 Call Stream html_file, 'C', 'OPEN WRITE REPLACE' 3664 Call Lineout html_file, '<html><head>' 3665 Call Lineout html_file, '<title>' 3666 Call Lineout html_file, jobtitle 3667 Call Lineout html_file, '</title>' 3668 Call Lineout html_file, '<style type="text/css">' 3669 Call Lineout html_file, '<!--' 3670 Call Lineout html_file, '.warning { color:#0000ff; }' 3671 Call Lineout html_file, '.error { color:#ff0000; }' 3672 Call Lineout html_file, '//-->' 3673 Call Lineout html_file, '</style>' 3674 Call Lineout html_file, '</head>' 3675 Call Lineout html_file, '<body bgcolor='!global.!color_background'>' 3676 Call Lineout html_file, '<center><h1>'jobtitle'</h1></center><pre>' 3677 Call Lineout html_file, '<center><h2>'jobdatetime'</h2></center>' 3678 Call Lineout html_file, '<hr>' 3679 Do While Lines( out_file ) > 0 3680 line = Linein( out_file ) 3681 Select 3682 When Left( line, 4 ) = Copies( '>', 4 ) Then 3683 Do 3684 Select 3685 When type = 'mods' | type = 'testbuild' Then 3686 Do 3687 Parse Var line '>>>> ' title ':' . 'qocca_bg_' loc 3688 loc = Strip( loc ) 3689 If loc = '' Then Call Lineout html_file,'</pre><h3>'Substr( line, 5 )'</h3><pre>' 3690 Else Call Lineout html_file,'</pre><a href="./qocca_bg_'loc'">'title'</a><pre>' 3691 End 3692 Otherwise Nop 3693 Do 3694 Call Lineout html_file,'</pre><h3>'Substr( line, 5 )'</h3><pre>' 3695 End 3696 End 3697 End 3698 Otherwise 3699 Do 3700 Select 3701 When type = 'make' | type = 'build' | type = 'testbuild' Then 3702 Do 3703 Parse Value ParseCompilerLine( compiler_type, line ) With modifier ',' . 3704 If modifier = '' Then 3705 Call Lineout html_file, line 3706 Else 3707 Call Lineout html_file, '<span class="'modifier'">'line'</span>' 3708 End 3709 When type = 'copy' Then 3710 Do 3711 Select 3712 When Subword( line, 1, 2 ) = 'RCS file:' Then Call Lineout html_file, '<b>'line'</b>' 3713 When Subword( line, 1, 2 ) = 'Creating directory' Then Call Lineout html_file, '<b>'line'</b>' 3714 When Subword( line, 1, 2 ) = 'Linking directory' Then Call Lineout html_file, '<b>'line'</b>' 3715 When Subword( line, 1, 2 ) = 'deleting revision' Then Call Lineout html_file, '<span class="warning">'line'</span>' 3716 Otherwise Call Lineout html_file, line 3717 End 3718 End 3719 Otherwise Call Lineout html_file, line 3720 End 3721 End 3722 End 3723 End 3724 Call Lineout html_file, '</pre></body></html>' 3725 Call Stream html_file, 'C', 'CLOSE' 3726 Call Stream out_file, 'C', 'CLOSE' 3727 End 3728Call HTMLBrowse html_file, jobtitle 3729Return 0 3730 3731HTMLBrowse: Procedure Expose !REXXDW. !global. !!last_repository 3732Parse Arg fn, title 3733-- Create a window, same size as main window with an embedded HTML widget 3734win = dw_window_new( !REXXDW.!DW_DESKTOP, title, !global.!windowstyle ) 3735Call dw_window_set_icon win, !global.!qoccaicon 3736topbox = dw_box_new( !REXXDW.!DW_VERT ) 3737Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 3738-- add box with our action buttons 3739buttonbox = dw_box_new( !REXXDW.!DW_HORZ ) 3740Call dw_box_pack_start topbox, buttonbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3741 3742sbutton = dw_button_new( "Stop", 0 ) 3743Call dw_box_pack_start buttonbox, sbutton, 30, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3744 3745bbutton = dw_button_new( "Back", 0 ) 3746Call dw_box_pack_start buttonbox, bbutton, 30, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3747 3748fbutton = dw_button_new( "Forward", 0 ) 3749Call dw_box_pack_start buttonbox, fbutton, 30, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3750 3751htmlbox = dw_box_new( !REXXDW.!DW_VERT ) 3752Call dw_box_pack_start topbox, htmlbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 3753html = dw_html_new( 11011 ) 3754Call dw_box_pack_start htmlbox, html, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 3755Call dw_html_url html, 'file://'fn 3756 3757Call dw_signal_connect sbutton, !REXXDW.!DW_CLICKED_EVENT, 'HTMLButtonCallback', !REXXDW.!DW_HTML_STOP, html 3758Call dw_signal_connect bbutton, !REXXDW.!DW_CLICKED_EVENT, 'HTMLButtonCallback', !REXXDW.!DW_HTML_GOBACK, html 3759Call dw_signal_connect fbutton, !REXXDW.!DW_CLICKED_EVENT, 'HTMLButtonCallback', !REXXDW.!DW_HTML_GOFORWARD, html 3760/* 3761 * Create OK 3762 */ 3763b1 = dw_button_new( 'OK', 0 ) 3764Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3765/* 3766 * Display the window 3767 */ 3768Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (!global.!window_width % 2), (!global.!screen_height % 2) - (!global.!window_height % 2), !global.!window_width, !global.!window_height 3769Call dw_window_show win 3770 Call dw_main_sleep 10 3771Do Forever 3772 /* 3773 * Create a dialog for the window 3774 */ 3775 dialog_wait = dw_dialog_new( ) 3776 /* 3777 * We now have everything setup, we can connect the destroying of the top-level window 3778 * to the 'close' callback 3779 */ 3780 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 3781 /* 3782 * Wait for the dialog to come back 3783 */ 3784 cancel = dw_dialog_wait( dialog_wait ) 3785 /* 3786 * All successful processing done in the 'applycallback', so simply get 3787 * out of the loop if we don't have any validation issues 3788 */ 3789 If cancel \= 'retry' Then Leave 3790End 3791Return 0 3792 3793HTMLButtonCallback: Procedure Expose !REXXDW. !global. !!last_repository 3794Parse Arg ., action, html 3795If !global.!allowcallbacks = 0 Then Return 1 3796Call dw_html_action html, action 3797Return 0 3798 3799JobsDeleteCallback: Procedure Expose !REXXDW. !global. !!last_repository 3800Parse Arg ., jobs 3801If dw_messagebox( 'Delete Jobs?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'Are you sure you want to delete the selected jobs?' ) = !REXXDW.!DW_MB_RETURN_NO Then Return 0 3802/* 3803 * we are going to delete all the files 3804 */ 3805exts.mods = '.html .out .desc .currents.html .summary.html .comments.html .differences.html .detail.html' 3806exts.testbuild = '.html .out .desc .currents.html .summary.html .comments.html .differences.html .detail.html' 3807exts.build = '.html .out .desc' 3808exts.promote = '.html .out .desc' 3809exts.copy = '.html .out .desc' 3810exts.make = '.html .out .desc .caller'!global.!shell_ext !global.!shell_ext 3811nativelogdir = FindNativeLogDirectory() 3812Do i = 1 To Words( jobs ) 3813 Parse Value Word( jobs, i ) With type ',' basefile 3814 type = Translate( type ) 3815 Do j = 1 To Words( exts.type ) 3816 ext = Word( exts.type, j ) 3817 Call SysFileDelete nativelogdir||!global.!ossep||basefile||ext 3818 End 3819 Call SysFileDelete nativelogdir||!global.!ossep||basefile 3820End 3821/* 3822 * Now rebuild the container 3823 */ 3824Call DisplayJobs 3825Return 0 3826 3827EditLabel: Procedure Expose !REXXDW. !global. !!last_repository 3828/* 3829 * Create a container box with 3830 * +-------------------+ 3831 * | Revision | File | 3832 * ------------+-------+ 3833 * | 1.3 | a.txt | 3834 * +-------------------+ 3835 * | | Edit | | 3836 * +-------------------+ 3837 * | Apply | 3838 * +-------------------+ 3839 * | Cancel | 3840 * +-------------------+ 3841 * 3842 */ 3843Parse Arg based_on, lab, labelbasefile 3844flags.0 = 2 3845flags.1 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 3846flags.2 = dw_or( !REXXDW.!DW_CFA_STRING, !REXXDW.!DW_CFA_LEFT, !REXXDW.!DW_CFA_SEPARATOR, !REXXDW.!DW_CFA_HORZSEPARATOR ) 3847titles.0 = 2 3848titles.1 = 'Revision' 3849titles.2 = 'File' 3850win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Edit Label File', !global.!windowstyle ) 3851Call dw_window_set_icon win, !global.!qoccaicon 3852topbox = dw_box_new( !REXXDW.!DW_VERT ) 3853Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 3854/* 3855 * Create our container in the box... 3856 */ 3857!global.!editlabelcontainer = dw_container_new( 1, !REXXDW.!DW_SINGLE_SELECTION ) 3858Call dw_box_pack_start topbox, !global.!editlabelcontainer, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 3859!global.!editlabelcontainer.?firsttime = 1 3860/* 3861 * Use a normal container. 3862 */ 3863Call dw_container_setup !global.!editlabelcontainer, 'flags.', 'titles.', 0 3864 3865Call DisplayLabelFile labelbasefile 3866/* 3867 * Create Edit button... 3868 */ 3869editbox = dw_box_new( !REXXDW.!DW_HORZ ) 3870Call dw_box_pack_start topbox, editbox, 0, !global.!buttonheight+10, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3871Call dw_box_pack_start editbox, 0, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3872b0 = dw_button_new( 'Edit', 0 ) 3873Call dw_box_pack_start editbox, b0, 50, !global.!buttonheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 5 3874Call dw_box_pack_start editbox, 0, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3875/* 3876 * Create Apply and cancel buttons 3877 */ 3878b1 = dw_button_new( 'Apply', 0 ) 3879Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3880b2 = dw_button_new( 'Cancel', 0 ) 3881Call dw_box_pack_start topbox, b2, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 3882/* 3883 * Display the window 3884 */ 3885width = 640 3886height = 320 /* text_height + cb_height + 80 */ 3887Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 3888Call dw_window_show win 3889 Call dw_main_sleep 10 3890Do Forever 3891 /* 3892 * Create a dialog for the window 3893 */ 3894 dialog_wait = dw_dialog_new( ) 3895 /* 3896 * We now have everything setup, we can connect the destroying of the top-level window 3897 * to the 'close' callback 3898 */ 3899 Call dw_signal_connect b0, !REXXDW.!DW_CLICKED_EVENT, 'EditLabelEditButtonCallback' 3900 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'EditLabelApplyCallback', win, dialog_wait, labelbasefile 3901 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 3902 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 3903 /* 3904 * Wait for the dialog to come back 3905 */ 3906 cancel = dw_dialog_wait( dialog_wait ) 3907 /* 3908 * All successful processing done in the 'applycallback', so simply get 3909 * out of the loop if we don't have any validation issues 3910 */ 3911 If cancel \= 'retry' Then Leave 3912End 3913Return cancel 3914 3915DisplayLabelFile: Procedure Expose !REXXDW. !global. !!last_repository 3916/* 3917 * Determine how many items in the container... 3918 */ 3919Parse Arg labelbasefile 3920inlabelworkfile = !global.!current_dirname.!!last_repository'/'labelbasefile 3921/* 3922 * Read the label file 3923 */ 3924Call Stream inlabelworkfile, 'C', 'OPEN READ' 3925idx = 0 3926Do While Lines( inlabelworkfile) > 0 3927 Parse Value Linein( inlabelworkfile ) With rev fn 3928 If rev = ';' Then Iterate 3929 idx = idx + 1 3930 !global.!editlabel.?rev.idx = rev 3931 !global.!editlabel.?file.idx = fn 3932End 3933!global.!editlabel.?rev.0 = idx 3934!global.!editlabel.?file.0 = idx 3935Call Stream inlabelworkfile, 'C', 'CLOSE' 3936 3937/* 3938 * Delete everything in the container so we can replace the existing files 3939 */ 3940If !global.!editlabelcontainer.?firsttime = 0 Then 3941 Do 3942 Call dw_signal_disconnect !global.!editlabelcontainer, !REXXDW.!DW_ITEM_CONTEXT_EVENT 3943 Call dw_container_clear !global.!editlabelcontainer, !REXXDW.!DW_DONT_REDRAW 3944 End 3945!global.!editlabelcontainer.?firsttime = 0 3946/* 3947 * Add the entries into the container 3948 */ 3949!global.!editlabelcontainer.?containermemory = dw_container_alloc( !global.!editlabelcontainer, !global.!editlabel.?rev.0 ) 3950Do i = 1 To !global.!editlabel.?rev.0 3951 Call dw_container_set_item !global.!editlabelcontainer, !global.!editlabelcontainer.?containermemory, 0, i-1, !global.!editlabel.?rev.i 3952 Call dw_container_set_item !global.!editlabelcontainer, !global.!editlabelcontainer.?containermemory, 1, i-1, !global.!editlabel.?file.i 3953 Call dw_container_set_row_title !global.!editlabelcontainer.?containermemory, i-1, i','!global.!editlabel.?file.i 3954End 3955Call dw_container_set_stripe !global.!editlabelcontainer, !REXXDW.!DW_CLR_WHITE, !global.!container_colour 3956Call dw_container_insert !global.!editlabelcontainer, !global.!editlabelcontainer.?containermemory, !global.!editlabel.?rev.0 3957Call dw_container_optimize !global.!editlabelcontainer 3958/* 3959 * Only now can we connect our signals, because dw_set_file() causes the signals to fire!!!... 3960 */ 3961Call dw_signal_connect !global.!editlabelcontainer, !REXXDW.!DW_ITEM_CONTEXT_EVENT, 'EditLabelMenuCallback' 3962 3963Return 3964 3965EditLabelApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 3966Parse Arg ., win, dialog, labelbasefile 3967/* 3968 * Write the array to the label working file 3969 */ 3970labelworkfile = !global.!current_dirname.!!last_repository'/'labelbasefile 3971Call Stream labelworkfile,'C','OPEN WRITE REPLACE' 3972Call Lineout labelworkfile, '; QOCCA Label File:' labelbasefile 'for' !global.!current_dirname.!!last_repository 3973Do i = 1 To !global.!editlabel.?file.0 3974 Call Lineout labelworkfile, !global.!editlabel.?rev.i !global.!editlabel.?file.i 3975End 3976Call Stream labelworkfile,'C','CLOSE' 3977Call dw_dialog_dismiss dialog, 'apply' 3978/* 3979 * Destroy the window 3980 */ 3981Call dw_window_destroy win 3982Return 0 3983 3984/* 3985 * Create a popup menu with "Edit" items 3986 */ 3987EditLabelMenuCallback: Procedure Expose !REXXDW. !global. !!last_repository 3988Parse Arg ., ., x, y 3989/* 3990 * Determine which config items items are currently selected 3991 */ 3992basefiles = '' 3993selected = dw_container_query_start( !global.!editlabelcontainer, !REXXDW.!DW_CRA_SELECTED ) 3994Do i = 1 While selected \= '' 3995 basefiles = basefiles selected 3996 selected = dw_container_query_next( !global.!editlabelcontainer, !REXXDW.!DW_CRA_SELECTED ) 3997End 3998basefiles = Strip( basefiles ) 3999/* 4000 * Create our popup and display it 4001 */ 4002popup = dw_menu_new( 0 ) 4003menuitem = dw_menu_append_item( popup,'Edit', 1001, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 4004Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'EditLabelEditCallback', basefiles 4005Call dw_menu_popup popup, !global.!mainwindow, x, y 4006Return 1 4007 4008/* 4009 * 4010 */ 4011EditLabelEditButtonCallback: Procedure Expose !REXXDW. !global. !!last_repository 4012/* 4013 * Determine which config items are currently selected 4014 */ 4015basefiles = '' 4016selected = dw_container_query_start( !global.!editlabelcontainer, !REXXDW.!DW_CRA_SELECTED ) 4017Do i = 1 While selected \= '' 4018 basefiles = basefiles selected 4019 selected = dw_container_query_next( !global.!editlabelcontainer, !REXXDW.!DW_CRA_SELECTED ) 4020End 4021basefiles = Strip( basefiles ) /* don't quote this string */ 4022/* 4023 * Call the edit callback 4024 */ 4025Call EditLabelEditCallback '', basefiles 4026Return 1 4027 4028EditLabelEditCallback: Procedure Expose !REXXDW. !global. !!last_repository 4029Parse Arg ., i','fn 4030/* 4031 * Get all potential revisions for the file into a combobox... 4032 */ 4033newrev = GetFileRevisions( fn, 'Change', 'rev', 'nodate', '' ) 4034If newrev \= '' Then 4035 Do 4036 !global.!editlabel.?rev.i = newrev 4037 /* 4038 * Now update the container with the new revision 4039 */ 4040 Call dw_container_set_item !global.!editlabelcontainer, !global.!editlabelcontainer.?containermemory, 0, i-1, !global.!editlabel.?rev.i 4041 End 4042Return 0 4043/* 4044 * Module level callbacks... 4045 * All module-level callbacks can be called from a button, or from 4046 * a menu item. 4047 * The arguments passed to a button callback are: window 4048 * The arguments passed to a menu callback are: window, item index 4049 * Therefore if you are passing more arguments to the callback, 4050 * then those arguments must come after window and item index. 4051 */ 4052RefreshModulesCallback: Procedure Expose !REXXDW. !global. !!last_repository 4053Call DisplayRepository 4054Return 0 4055 4056DirPropertiesCallback: Procedure Expose !REXXDW. !global. !!last_repository 4057if trace() = 'F' Then say 'got dirproperties' !global.!current_dirname.!!last_repository 4058/* 4059 * If this callback occurs on the project level "directory" then 4060 * display repository properties 4061 */ 4062If !global.!current_dirname.!!last_repository = '.' Then 4063 Do 4064 Select 4065 When !global.!!repository.!!type.!!last_repository = 'rcs' Then Call GetRCSRepository 'N', !!last_repository 4066 When !global.!!repository.!!type.!!last_repository = 'cvs' Then Call GetCVSRepository 'N', !!last_repository 4067 End 4068 End 4069Else 4070 Do 4071 Call DisplayDirProperties 4072 End 4073Return 0 4074 4075ShowModifiedStrictCallback: /* RCS */ Procedure Expose !REXXDW. !global. !!last_repository 4076if trace() = 'F' Then say 'got showmodifiedstrict' 4077Return 0 4078 4079ShowModifiedCallback: /* RCS */ Procedure Expose !REXXDW. !global. !!last_repository 4080if trace() = 'F' Then say 'got showmodified' 4081Return 0 4082 4083/* 4084 * This function lists all files that are different between the working 4085 * directory and the repository 4086 */ 4087ListModifiedCallback: Procedure Expose !REXXDW. !global. !!last_repository oserr. 4088Call SetCursorWait 4089Select 4090 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 4091 /* TODO */ 4092 Do smi = 1 To fullfilename.0 4093 file = RCSFileToFile( Substr(fullfilename.smi,5) ) 4094 Address System 'rcsdiff -q' diffflags Substr(fullfilename.smi,5) file !global.!devnull 4095 If rc \= 0 Then Call TkItemConfig mclb, smi-1, '-foreground', 'red' 4096 End 4097 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 4098 Do 4099 /* 4100 * We need to turn off cvs compression if talking to a public CVS server as newer versions of CVS 4101 * use the "inflation" method which is not compatible with the client version 4102 */ 4103 If !global.!!repository.!!public_cvs.!!last_repository = 'Y' Then cvs_compression = '' 4104 Else cvs_compression = !global.!!repository.!!cvs_compression.!!last_repository 4105 If !global.!current_dirname.!!last_repository = '' | !global.!current_dirname.!!last_repository = '.' Then 4106 Call RunOSCommand 'cvs' cvs_compression '-d'!global.!!repository.!!path.!!last_repository '-q -n update *' 4107 Else 4108 Call RunOSCommand 'cvs' cvs_compression '-d'!global.!!repository.!!path.!!last_repository '-q -n update' quote( !global.!current_dirname.!!last_repository ) 4109 Call WriteCVSOutputStemsToLogWindow 'list', '?', 'Files modified in' quote( !global.!current_dirname.!!last_repository ) 4110 /* 4111 * List any reminder files in the current directory recursively 4112 */ 4113 here = Directory() 4114 Call Directory( !global.!current_dirname.!!last_repository ) 4115 Call SysFileTree '*.qocca.reminder', 'REM.', 'FLS' 4116 If rem.0 \= 0 Then 4117 Do 4118 Call WriteMessageHeaderToLogWindow 'Reminders set' 4119 Do lmi = 1 To rem.0 4120 Parse Var rem.lmi . . . . fn 4121 fn = Translate( fn, '/', !global.!ossep ) 4122 wd = Translate( !global.!!repository.!!working_dir.!!last_repository, '/', !global.!ossep ) 4123 Parse Var fn (wd) base 'CVS/' bn '.qocca.reminder' 4124 Call WriteMessageToLogWindow ' 'base||bn, 'yellowback' 4125 End 4126 Call WriteMessageTrailerToLogWindow 'Reminders set' 4127 End 4128 Call Directory( here ) 4129 /* 4130 * If we have any errors and they indicate that there is a 4131 * mismatch between the repository and items listed in 4132 * CVS/Entries 4133 * then display them in the messages pane, and display a 4134 * dialog box requesting confirmation to "cleanup" these 4135 * entries. 4136 * This "cleaning up" is removing the selected files from 4137 * the CVS/Entries file in the user's working directory 4138 */ 4139 If oserr.0 \= 0 Then Call TidyUpCVSDeletions 4140 Drop rem. 4141 End 4142 Otherwise Nop 4143End 4144Call SetCursorNoWait 4145Return 0 4146/* 4147 * This function lists all files that are currently locked out 4148 */ 4149ListLockedCallback: Procedure Expose !REXXDW. !global. !!last_repository oserr. 4150Call SetCursorWait 4151Select 4152 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 4153 Do 4154 /* TODO */ 4155 End 4156 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 4157 Do 4158 If !global.!current_dirname.!!last_repository = '.' | !global.!current_dirname.!!last_repository = '' Then fname_offset = 1 4159 Else fname_offset = Length(!global.!current_dirname.!!last_repository)+2 4160 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list' quote(!global.!current_dirname.!!last_repository) 4161 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 4162 Address Command cmd With Output Stem item. Error Stem err. 4163 Do i = 1 To item.0 4164 Parse Var item.i 1 . 12 rev 28 user 64 . . 84 type 88 flen 91 . 92 filename +(flen) +1 locks 4165 If locks \= '' Then 4166 Do 4167 filename = Strip( Substr( filename, fname_offset ) ) 4168 Queue '('locks')' filename 4169 End 4170 End 4171 Call WriteStackToLogWindow 'default', 'Files currently locked in' quote( !global.!current_dirname.!!last_repository ) 4172 End 4173 Otherwise Nop 4174End 4175Call SetCursorNoWait 4176Return 0 4177 4178GetLatestAllCallback: Procedure Expose !REXXDW. !global. !!last_repository 4179refresh = 'N' 4180Select 4181 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 4182 Do 4183 End 4184 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 4185 Do 4186 If dw_messagebox( 'Get Latest?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'Replace all working files in this directory and below with the latest repository version ?' ) = !REXXDW.!DW_MB_RETURN_YES Then 4187 Do 4188 Call SetCursorWait 4189 Call DisplayStatus 'Getting list of all files in and under' !global.!current_dirname.!!last_repository'...' 4190 Call GetListOfCVSFilesInDirectory !!last_repository, !global.!current_dirname.!!last_repository, 0 4191 Do i = 1 To item.0 4192 Parse Var item.i . rel . . . . flen . 4193 Parse Var item.i 92 fn +(flen) +1 . 4194 /* 4195 * For any files that have changed locally, save a backup 4196 * copy in the working directory 4197 */ 4198 cvs_status = CVSStatus( fn ) 4199 If cvs_status = 'Up-to-date' | cvs_status = 'Needs Checkout' Then 4200 Do 4201 Call SysFileDelete fn 4202 End 4203 Else 4204 Do 4205 /* 4206 * Split the filename into path and file. Change the filename 4207 * only. 4208 */ 4209 pos = Lastpos( '/', fn ) 4210 If pos \= 0 Then 4211 Do 4212 pos = pos + 1 4213 Parse Var fn fnpath =(pos) fnfile 4214 newfn = fnpath'.#'fnfile'.'rel 4215 End 4216 Else 4217 Do 4218 newfn = fn 4219 End 4220 Call SysMoveObject fn, newfn 4221 End 4222 End 4223 Call DisplayStatus 'Getting latest of all files in and under' !global.!current_dirname.!!last_repository'...' 4224 Call RunOsCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout -R' quote( !global.!current_dirname.!!last_repository ) 4225 Call WriteCVSOutputStemsToLogWindow 'get',, 'Get Latest for' quote( !global.!current_dirname.!!last_repository ) 4226 Call CheckForCVSConflicts 4227 Drop oserr. osout. 4228 Call SetCursorNoWait 4229 Call DisplayStatus '' 4230 refresh = 'Y' 4231 End 4232 End 4233 Otherwise Nop 4234End 4235If refresh = 'Y' Then 4236 Do 4237 Call RefreshDirectoryIcons 4238 /* 4239 * No need to display non-repository files at this stage 4240 */ 4241 Call DisplayRepositoryFiles 4242 Call Directory !global.!!repository.!!working_dir.!!last_repository 4243 End 4244Return 0 4245 4246UpdateAllCallback: Procedure Expose !REXXDW. !global. !!last_repository 4247/* 4248 * This file option only valid for CVS 4249 */ 4250Call SetCursorWait 4251If !global.!!repository.!!enhanced_cvs.!!last_repository \= 'Y' Then 4252 Do 4253 If !global.!current_dirname.!!last_repository = '.' Then dir = '' 4254 Else dir = quote( !global.!current_dirname.!!last_repository ) 4255 End 4256Else dir = quote( !global.!current_dirname.!!last_repository ) 4257Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q update -d' dir 4258Call WriteCVSOutputStemsToLogWindow 'update','?' , 'Update All for' quote( !global.!current_dirname.!!last_repository ) 4259If !global.!!repository.!!type.!!last_repository = 'cvs' Then Call CheckForCVSConflicts 4260Drop oserr. osout. 4261Call RefreshDirectoryIcons 4262/* 4263 * No need to display non-repository files at this stage 4264 */ 4265Call DisplayRepositoryFiles 4266Call Directory !global.!!repository.!!working_dir.!!last_repository 4267Call SetCursorNoWait 4268Return 0 4269 4270GetAllCallback: Procedure Expose !REXXDW. !global. !!last_repository 4271/* 4272 * Dialog box to determine which version to get and to where 4273 * 4274 * +---------------------------------------------------+ 4275 * | Text | 4276 * | | 4277 * +---------------------------------------------------+ 4278 * | Get Version _Latest___v | 4279 * | To: __________________________ X | 4280 * +---------------------------------------------------+ 4281 */ 4282if trace() = 'F' Then say 'got getall' 4283 4284title_width = 80 4285 4286win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Get All', !global.!windowstyle ) 4287Call dw_window_set_icon win, !global.!qoccaicon 4288topbox = dw_box_new( !REXXDW.!DW_VERT ) 4289Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 4290/* 4291 * Add a disabled MLE with instructions 4292 */ 4293t1 = dw_mle_new( 0 ) 4294Call dw_box_pack_start topbox, t1, 300, 50, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 4295Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 4296Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 4297Call dw_mle_set_cursor t1, 0 4298Call dw_mle_import t1, 'Select the version of the module to get and the directory in which the module files are to be saved.' , -1 4299Call dw_window_disable t1 4300/* version */ 4301module_version_box = dw_box_new( !REXXDW.!DW_HORZ ) 4302Call dw_box_pack_start topbox, module_version_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4303tmp = dw_text_new( 'Get Version', 0 ) 4304Call dw_box_pack_start module_version_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4305Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 4306Call dw_box_pack_start module_version_box, 0, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4307Parse Value CreateModuleVersionCombobox( module_version_box, 'false', 'Latest', !global.!current_dirname.!!last_repository, 1, 'Latest' ) With module_version_cb boxtopack . 4308Call dw_box_pack_start module_version_box, boxtopack, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4309/* dest dir */ 4310dest_dir_box = dw_box_new( !REXXDW.!DW_HORZ ) 4311Call dw_box_pack_start topbox, dest_dir_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4312dest = dw_text_new( 'To', 0 ) 4313Call dw_box_pack_start dest_dir_box, dest, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4314Call dw_window_set_style dest, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 4315dest_dir_entry = dw_entryfield_new( '', 0 ) 4316Call dw_box_pack_start dest_dir_box, dest_dir_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4317abutton = dw_bitmapbutton_new_from_file( 'Browse', 0, !global.!icondir||'modulecheckedout' ) 4318Call dw_box_pack_start dest_dir_box, abutton, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4319Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericDirectorySelector', dest_dir_entry, 'Set Temporary Directory to:' 4320/* 4321 * Create Cancel and Apply buttons 4322 */ 4323b1 = dw_button_new( 'Apply', 0 ) 4324Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4325 4326b2 = dw_button_new( 'Cancel', 0 ) 4327Call dw_box_pack_start topbox, b2, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4328/* 4329 * Display the window 4330 */ 4331width = 300 4332height = 200 /* text_height + cb_height + 80 */ 4333Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 4334Call dw_window_show win 4335 Call dw_main_sleep 10 4336 4337Do Forever 4338 /* 4339 * Create a dialog for the window 4340 */ 4341 dialog_wait = dw_dialog_new( ) 4342 /* 4343 * We now have everything setup, we can connect the destroying of the top-level window 4344 * to the 'close' callback 4345 */ 4346 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GetAllApplyCallback', win, dialog_wait, module_version_cb, dest_dir_entry 4347 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 4348 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 4349 /* 4350 * Wait for the dialog to come back 4351 */ 4352 cancel = dw_dialog_wait( dialog_wait ) 4353 /* 4354 * All successful processing done in the 'applycallback', so simply get 4355 * out of the loop if we don't have any validation issues 4356 */ 4357 If cancel \= 'retry' Then Leave 4358End 4359/* 4360 * Wait for the dialog to come back 4361 */ 4362Return 0 4363 4364GetAllApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 4365Parse Arg ., window, dialog, module_version_cb, dest_dir_entry 4366destdir = dw_window_get_text( dest_dir_entry ) 4367ver = dw_window_get_text( module_version_cb ) 4368Call CreateDirectory destdir 4369/* 4370 * Get rid of the dialog 4371 */ 4372Call dw_dialog_dismiss dialog, 'apply' 4373Call dw_window_destroy window 4374 4375Call SetCursorWait 4376/* 4377 * Now get all files for the module into the specified directory 4378 */ 4379Select 4380 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 4381 Do 4382 Call WriteMessageHeaderToLogWindow 'Getting version' quote( ver ) 'of' quote( !global.!current_dirname.!!last_repository ) 4383 Call dw_main_sleep 10 /* get window updated */ 4384 If ver = 'Latest' Then 4385 Do 4386 /* 4387 * Get a list of all files in the module with their revision 4388 * numbers 4389 */ 4390 Call GetListOfCVSFilesInDirectory !!last_repository, !global.!current_dirname.!!last_repository, 0 4391 Do i = 1 To item.0 4392 Parse Var item.i . rev . . . . flen . 4393 Parse Var item.i 92 fn +(flen) +1 . 4394 item.i = rev fn 4395 End 4396 Do i = 1 To err.0 4397 Call WriteMessageToLogWindow err.i 4398 End 4399 End 4400 Else 4401 Do 4402 /* 4403 * Get the label file from the repository into the item. stem 4404 */ 4405 If Countstr( ',', ver ) \= 0 Then Parse Var ver ver_dir ',' rev 4406 labelworkfile = ver_dir'/.label-'rev 4407 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q get -p' quote( labelworkfile ) 4408 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 4409 Address System cmd With Output Stem item. Error Stem junk. 4410 End 4411 /* 4412 * We now have a stem; item. with all files and their revision numbers 4413 */ 4414 dirlen = Length( !global.!current_dirname.!!last_repository ) 4415 Do i = 1 To item.0 4416 Parse Var item.i rev fn 4417 /* 4418 * Filter out files that are not in the current directory 4419 */ 4420 If Left( fn, dirlen ) \= !global.!current_dirname.!!last_repository Then Iterate 4421 outfile = destdir||Substr( fn, dirlen+1 ) 4422 /* 4423 * Need to determine if the directory of the file exists; 4424 * if not make it before checking the file out 4425 */ 4426 outpos = Lastpos( '/', outfile ) 4427 outdir = Substr( outfile, 1, outpos-1 ) 4428 Call CreateDirectory( outdir ) 4429 Call WriteMessageToLogWindow ' getting' quote( fn ) 'to' quote( outfile ) 4430 Call dw_main_sleep 10 /* get window updated */ 4431 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q checkout -p -r'rev quote( fn ) 4432 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 4433 Address System cmd With Output Stream outfile Error Stem err. 4434 Call Stream outfile, 'C', 'CLOSE' 4435 Do j = 1 To err.0 4436 Call WriteMessageToLogWindow err.j 4437 End 4438 End 4439 Call WriteMessageTrailerToLogWindow 'Getting version' quote( ver ) 'of' quote( !global.!current_dirname.!!last_repository ) 4440 End 4441 Otherwise Nop 4442End 4443Call SetCursorNoWait 4444 4445Return 0 4446 4447 4448CheckOutAllCallback: Procedure Expose !REXXDW. !global. !!last_repository 4449/* 4450 * Checkout and lock every file that is not locked to anyone 4451 * DO NOT APPLY TO LABEL FILES 4452 */ 4453Call SetCursorWait 4454if trace() = 'F' Then say 'got checkoutall' 4455checkout = 'N' 4456Select 4457 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 4458 Do 4459 Call WriteMessageHeaderToLogWindow 'Checking out all files in' quote( !global.!current_dirname.!!last_repository ), 'default' 4460 Call dw_main_sleep 10 /* get window updated */ 4461 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list' quote( !global.!current_dirname.!!last_repository ) 4462 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 4463 Address Command cmd With Output Stem item. Error Stem err. 4464 Do i = 1 To item.0 4465 Parse Var item.i 1 . 12 rev 28 user 64 . . 84 type 88 flen 91 . 92 filename +(flen) +1 locks 4466 filename = Strip( filename ) 4467 off = Length( !global.!current_dirname.!!last_repository ) + 2 4468 basename = Substr( filename, off ) 4469 If Left( basename, 7 ) = '.label-' Then Iterate 4470 If locks = '' Then 4471 Do 4472 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout' quote( filename ) 4473 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 4474 Address Command cmd With Output FIFO '' Error FIFO '' 4475 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -l' quote( filename ) 4476 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 4477 Address Command cmd With Output FIFO '' Error FIFO '' 4478 checkout = 'Y' 4479 End 4480 Else 4481 Do 4482 Queue filename 'not checked out; locked by' locks 4483 End 4484 Call WriteStackToLogWindowNoHeaderTrailer 'default' 4485 Call dw_main_sleep 10 /* get window updated */ 4486 End 4487 Call WriteMessageTrailerToLogWindow 'Checking out all files in' quote( !global.!current_dirname.!!last_repository ), 'default' 4488 End 4489 Otherwise Nop 4490End 4491If checkout = 'Y' Then 4492 Do 4493 Call RefreshFilesCallback 4494 Call AdjustFileToolbarList 4495 Call AdjustFileToolbarButtons 4496 End 4497Call SetCursorNoWait 4498Return 0 4499 4500UndoCheckOutAllCallback: Procedure Expose !REXXDW. !global. !!last_repository 4501/* 4502 * Undo Checkout and unlock every file that is locked by us 4503 */ 4504Call SetCursorWait 4505if trace() = 'F' Then say 'got undocheckoutall' 4506undocheckout = 'N' 4507Select 4508 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 4509 Do 4510 Call WriteMessageHeaderToLogWindow 'Undoing Checkout all files in' quote( !global.!current_dirname.!!last_repository ), 'default' 4511 Call dw_main_sleep 10 /* get window updated */ 4512 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list' quote( !global.!current_dirname.!!last_repository ) 4513 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 4514 Address Command cmd With Output Stem item. Error Stem err. 4515 continue = 'N' 4516 Do i = 1 To item.0 4517 ignore_this_file = 'N' 4518 Parse Var item.i 1 . 12 rev 28 user 64 . . 84 type 88 flen 91 . 92 filename +(flen) +1 locks 4519 If Translate( locks ) = Translate( !global.!user ) Then 4520 Do 4521 filename = Strip( filename ) 4522 off = Length( !global.!current_dirname.!!last_repository ) + 2 4523 basename = Substr( filename, off ) 4524 If Left( basename, 7 ) = '.label-' Then Iterate i 4525 If continue = 'N' Then 4526 Do 4527 cvs_status = CVSStatus( filename ) 4528 If cvs_status = 'Locally Modified' | cvs_status = 'Needs Merge' | cvs_status = 'File had conflicts on merge' Then 4529 Do 4530 Call SetCursorNoWait 4531 rcode = dw_messagebox( 'Undo Checkout?', dw_or( !REXXDW.!DW_MB_YESNOCANCEL, !REXXDW.!DW_MB_QUESTION ), quote( filename ) 'has been modified locally. Do you want to lose these changes ? Select Yes to lose changes on future files; No to ask this question again; Cancel to quit the action.' ) 4532 Select 4533 When rcode = !REXXDW.!DW_MB_RETURN_YES Then continue = 'Y' 4534 When rcode = !REXXDW.!DW_MB_RETURN_CANCEL Then Return 0 4535 Otherwise ignore_this_file = 'Y' 4536 End 4537 End 4538 End 4539 Call SetCursorWait 4540 If ignore_this_file = 'N' Then 4541 Do 4542 /* 4543 * Unlock the file... 4544 */ 4545 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -u' quote( filename ) 4546 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 4547 Address Command cmd With Output FIFO '' Error FIFO '' 4548 /* 4549 * Delete the file... 4550 */ 4551 Call SysFileDelete filename 4552 /* 4553 * Get the latest... 4554 */ 4555 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout' quote( filename ) 4556 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 4557 Address Command cmd With Output FIFO '' Error FIFO '' 4558 undocheckout = 'Y' 4559 Call WriteStackToLogWindowNoHeaderTrailer 'default' 4560 Call dw_main_sleep 10 /* get window updated */ 4561 End 4562 End 4563 End 4564 Call WriteMessageTrailerToLogWindow 'Undoing Checkout all files in' quote( !global.!current_dirname.!!last_repository ), 'default' 4565 End 4566 Otherwise Nop 4567End 4568If undocheckout = 'Y' Then 4569 Do 4570 Call RefreshFilesCallback 4571 Call AdjustFileToolbarList 4572 Call AdjustFileToolbarButtons 4573 End 4574Call SetCursorNoWait 4575Return 0 4576 4577CheckInAllCallback: Procedure Expose !REXXDW. !global. !!last_repository 4578/* 4579 * -------------------------------------------------------------------- 4580 * This function checks in all files that have been checked out from a 4581 * directory and its sub-dirs. 4582 * -------------------------------------------------------------------- 4583 */ 4584if trace() = 'F' Then say 'got checkinall' 4585checkin = 'N' 4586Select 4587 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 4588 Do dummy = 1 To 1 4589 /* TODO */ 4590 Call SysFileTree !global.!current_dirname'/*,v', 'FILE.', 'FLS' 4591 If file.0 = 0 Then 4592 Do 4593 checkin = 'N' 4594 End 4595 Else 4596 Do 4597 checkin = 'Y' 4598 Parse Value Strip( GetCheckinDetails( 'Y', 'dir', !global.!current_dirname, 'Apply same text for all files') ) With cancel same . 4599 If cancel Then 4600 Do 4601 Leave 4602 End 4603 If same Then 4604 Do 4605 num = Queued() 4606 ci_lines. = '' 4607 Do i = 1 To num 4608 Parse Pull line 4609 cl_lines.i = line 4610 End 4611 cl_lines.0 = num 4612 End 4613 Call TkConfig textwin,'-state','normal' 4614 Call TkInsert textwin, 'end', d2c(10)||'Checkin All for' !global.!current_dirname||d2c(10), 'blueforebold' 4615 Call TkTcl 'update idletasks' 4616 Do j = 1 To file.0 4617 fullfilename = Word(file.j,5) 4618 file = RCSFileToFile( fullfilename ) 4619 locker = GetRCSLocker(fullfilename) 4620 If locker = !global.!user Then 4621 Do 4622 If same = 1 Then 4623 Do i = 1 To cl_lines.0 4624 Queue cl_lines.i 4625 End 4626 Call RunOsCommand 'LIFO> ci -u' file fullfilename 4627 Call WriteOutputStemsToLogWindow 'default', 'Checkin for' fullfilename 4628 End 4629 Else Call Tkinsert textwin, 'end', d2c(10)||'Checkin ignored for' fullfilename||d2c(10), 'blueforebold' 4630 Call TkSee textwin, 'end' 4631 End 4632 Call TkConfig textwin,'-state','disabled' 4633 End 4634 End 4635 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 4636 Do 4637 /* 4638 * Check if we have any reminder files in the current directory or below 4639 * that may be checked in 4640 */ 4641 continue = !REXXDW.!DW_MB_RETURN_YES 4642 here = Directory() 4643 Call Directory( !global.!current_dirname.!!last_repository ) 4644 Call SysFileTree '*.qocca.reminder', 'REM.', 'FLS' 4645 If rem.0 \= 0 Then 4646 Do 4647 Call WriteMessageHeaderToLogWindow 'Reminders set' 4648 Do i = 1 To rem.0 4649 Parse Var rem.i . . . . fn 4650 fn = Translate( fn, '/', !global.!ossep ) 4651 fn = Changestr( 'CVS/', fn, '' ) 4652 fn = Changestr( '.qocca.reminder', fn, '' ) 4653 fn = Changestr( !global.!!repository.!!working_dir.!!last_repository||!global.!current_dirname.!!last_repository'/', fn, '' ) 4654 Call WriteMessageToLogWindow ' '!global.!current_dirname.!!last_repository'/'fn, 'yellowback' 4655 End 4656 Call WriteMessageTrailerToLogWindow 'Reminders set' 4657 continue = dw_messagebox( 'Continue Checkin ?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'You have reminders on files in this directory (see log window). Do you wish to continue the Check In ?' ) 4658 End 4659 Drop rem. 4660 Call Directory( here ) 4661 /* 4662 * Get the checkin details from a new dialog box 4663 * and push the log text onto the stack, and write a 4664 * temporary file 4665 */ 4666 If continue = !REXXDW.!DW_MB_RETURN_YES Then 4667 Do 4668 Parse Value Strip( GetCheckinDetails( 'Y', 'file', !global.!current_dirname.!!last_repository, '' ) ) With cancel same . 4669 If cancel = 'apply' Then 4670 Do 4671 tmpfile = GenerateTempFile() -- we manage the cleanup ourselves 4672 Call Stream tmpfile, 'C', 'OPEN WRITE REPLACE' 4673 Do Queued() 4674 Parse Pull line 4675 Call Lineout tmpfile,line 4676 End 4677 Call Stream tmpfile, 'C', 'CLOSE' 4678 Call SetCursorWait 4679 Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -F'tmpfile quote( !global.!current_dirname.!!last_repository ) 4680 Call WriteCVSOutputStemsToLogWindow 'checkin',, 'Checkin All for' quote( !global.!current_dirname.!!last_repository ) 4681 Call SysFileDelete tmpfile -- delete our VERY temporary file 4682 Call CheckForCVSConflicts 4683 Call SetCursorNoWait 4684 Drop oserr. osout. 4685 checkin = 'Y' 4686 End 4687 End 4688 End 4689 Otherwise Nop 4690End 4691If checkin = 'Y' Then 4692 Do 4693 Call RefreshFilesCallback 4694 Call AdjustFileToolbarList 4695 Call AdjustFileToolbarButtons 4696 End 4697Return 0 4698 4699MakeCallback: Procedure Expose !REXXDW. !global. !!last_repository 4700/* 4701 * Dialog box to determine make settings 4702 * 4703 * +-------------------------------------------+ 4704 * | Text | 4705 * | | 4706 * +-------------------------------------------+ 4707 * | Make Directory __________________ | 4708 * | Make Command _________________v | 4709 * | Compiler used _________________v | 4710 * +-------------------------------------------+ 4711 */ 4712if trace() = 'F' Then say 'got make' 4713title_width = 150 4714this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 4715makecommand = Strip( FindMakeCommand( !global.!current_dirname.!!last_repository ) ) 4716debugmakecommand = Strip( FindDebugMakeCommand( !global.!current_dirname.!!last_repository ) ) 4717custommakecommand = Strip( FindCustomMakeCommand( !global.!current_dirname.!!last_repository ) ) 4718makedirectory = FindMakeDirectory( !global.!current_dirname.!!last_repository ) 4719 4720win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Make Settings', !global.!windowstyle ) 4721Call dw_window_set_icon win, !global.!qoccaicon 4722topbox = dw_box_new( !REXXDW.!DW_VERT ) 4723Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 4724/* 4725 * Add a disabled MLE with instructions 4726 */ 4727t1 = dw_mle_new( 0 ) 4728Call dw_box_pack_start topbox, t1, 400, 50, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 4729Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 4730Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 4731Call MakeHelpFocusCallback t1, 'INITIAL', t1 4732/* make directory */ 4733make_dir_box = dw_box_new( !REXXDW.!DW_HORZ ) 4734Call dw_box_pack_start topbox, make_dir_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4735tmp = dw_text_new( 'Make Directory', 0 ) 4736Call dw_box_pack_start make_dir_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4737Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 4738Call dw_box_pack_start make_dir_box, 0, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4739make_dir_entry = dw_entryfield_new( makedirectory, 0 ) 4740Call dw_box_pack_start make_dir_box, make_dir_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4741Call dw_signal_connect make_dir_entry, !REXXDW.!DW_SET_FOCUS_EVENT, 'MakeHelpFocusCallback', 'MD', t1 4742/* make command(s) */ 4743make_command_box = dw_box_new( !REXXDW.!DW_HORZ ) 4744Call dw_box_pack_start topbox, make_command_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4745tmp = dw_text_new( 'Make Command', 0 ) 4746Call dw_box_pack_start make_command_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4747Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 4748Call dw_box_pack_start make_command_box, 0, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4749make_cb = dw_combobox_new( makecommand, 0 ) 4750Call dw_box_pack_start make_command_box, make_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4751If makecommand \= '' Then Call dw_listbox_append make_cb, makecommand 4752If debugmakecommand \= '' Then Call dw_listbox_append make_cb, debugmakecommand 4753If custommakecommand \= '' Then Call dw_listbox_append make_cb, custommakecommand 4754Call dw_signal_connect make_cb, !REXXDW.!DW_SET_FOCUS_EVENT, 'MakeHelpFocusCallback', 'MC', t1 4755/* compiler combobox */ 4756compiler_box = dw_box_new( !REXXDW.!DW_HORZ ) 4757Call dw_box_pack_start topbox, compiler_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4758tmp = dw_text_new( 'Compiler Used', 0 ) 4759Call dw_box_pack_start compiler_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4760Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 4761Call dw_box_pack_start compiler_box, 0, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4762compiler_type = FindCompilerType( !global.!current_dirname.!!last_repository ) 4763compiler_cb = CreateCompilersCombobox( compiler_box, 'false', compiler_type ) 4764Call dw_box_pack_start compiler_box, compiler_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4765Call dw_signal_connect compiler_cb, !REXXDW.!DW_SET_FOCUS_EVENT, 'MakeHelpFocusCallback', 'CC', t1 4766/* 4767 * Create Cancel and Apply buttons 4768 */ 4769b1 = dw_button_new( 'Apply', 0 ) 4770Call dw_box_pack_start topbox, b1, 400, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4771 4772b2 = dw_button_new( 'Cancel', 0 ) 4773Call dw_box_pack_start topbox, b2, 400, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4774/* 4775 * Display the window 4776 */ 4777width = 450 4778height = 200 /* text_height + cb_height + 80 */ 4779Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 4780Call dw_window_show win 4781 Call dw_main_sleep 10 4782Do Forever 4783 /* 4784 * Create a dialog for the window 4785 */ 4786 dialog_wait = dw_dialog_new( ) 4787 /* 4788 * We now have everything setup, we can connect the destroying of the top-level window 4789 * to the 'close' callback 4790 */ 4791 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'MakeApplyCallback', win, dialog_wait, make_dir_entry, make_cb, compiler_cb 4792 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 4793 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 4794 /* 4795 * Wait for the dialog to come back 4796 */ 4797 cancel = dw_dialog_wait( dialog_wait ) 4798 /* 4799 * All successful processing done in the 'applycallback', so simply get 4800 * out of the loop if we don't have any validation issues 4801 */ 4802 If cancel \= 'retry' Then Leave 4803End 4804/* 4805 * Wait for the dialog to come back 4806 */ 4807Return 0 4808 4809MakeHelpFocusCallback: Procedure Expose !REXXDW. !global. !!last_repository 4810Parse Arg win, which, textwin 4811help.initial = 'Select the version to build, and whether you want to do a debug or custom build.' 4812help.md = 'Specify the directory where the make is to be run from. This is relative to the current working directory.' 4813help.mc = 'Select the command line to run to do the make. The configured command line for a non-debug, debug and custom build are available.' 4814help.cc = 'Select the compiler to use. This is used for highlighting errors and warnings in the job report.' 4815Call dw_window_enable textwin 4816Call dw_mle_set_cursor textwin, 0 4817Call dw_mle_delete textwin 4818Call dw_mle_import textwin, help.which, -1 4819Call dw_window_disable textwin 4820Return 0 4821 4822MakeApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 4823Parse Arg button, window, dialog, make_dir_entry, make_cb, compiler_cb 4824makedir = dw_window_get_text( make_dir_entry ) 4825makecommand = dw_window_get_text( make_cb ) 4826compiler_name = dw_window_get_text( compiler_cb ) 4827If makedir = '' | makedir = '.' Then makedir = '' 4828Else makedir = !global.!ossep || makedir 4829make_dir = Changestr( '/', !global.!current_dirname.!!last_repository || makedir, !global.!ossep ) 4830Call CreateDirectory make_dir 4831/* 4832 * Create our description file for job processing 4833 */ 4834desc = 'Make of' quote( !global.!current_dirname.!!last_repository ) 'using:' quote( makecommand ) 'in' quote( make_dir ) 4835type = 'make' 4836compiler_type = ConvertCompilerNameToAbbrev( compiler_name ) 4837basefile = GenerateJobBaseFile() 4838Call CreateDescriptionFile basefile, desc, type, compiler_type 4839outputfile = basefile'.out' 4840runfile = basefile||!global.!shell_ext 4841runfile_caller = basefile'.caller'!global.!shell_ext 4842 4843Call dw_window_destroy window 4844Call dw_dialog_dismiss dialog, 'apply' 4845/* 4846 * Increment the number of running jobs 4847 */ 4848Call IncrementRunningJobs basefile 4849/* 4850 * Set the "make" directory and the BUILD and VERSION env vars in this process 4851 * so that the child inherits them 4852 */ 4853here = Directory() 4854Call Directory( make_dir ) 4855Call Value !global.!buildenvvar, '0', 'ENVIRONMENT' 4856Call Value !global.!versionenvvar, 'make', 'ENVIRONMENT' 4857/* 4858 * Run the runfile in the background now 4859 */ 4860Call WriteMessageHeaderToLogWindow desc 'submitted' 4861/* 4862 * Write out the caller native shell file for execution 4863 */ 4864Call Stream runfile_caller, 'C', 'OPEN WRITE REPLACE' 4865Call Lineout runfile_caller, !global.!shell_first_line 4866Call Lineout runfile_caller, !global.!command_prefix runfile '>' outputfile '2>&1' 4867Call Lineout runfile_caller, 'exit' 4868Call Stream runfile_caller, 'C', 'CLOSE' 4869/* 4870 * Write out the commands to execute to a native shell file for execution 4871 */ 4872Call Stream runfile, 'C', 'OPEN WRITE REPLACE' 4873Call Lineout runfile, !global.!shell_first_line 4874/* split the make command into multiple lines */ 4875Do Forever 4876 Parse Var makecommand mc ';' makecommand 4877 mc = Strip( mc ) 4878 If mc = '' Then Leave 4879 Call Lineout runfile, mc 4880End 4881Call Lineout runfile, !global.!cmdecho !global.!shell_rc '>' basefile 4882Call Lineout runfile, 'exit' 4883Call Stream runfile, 'C', 'CLOSE' 4884/* 4885say .line !global.!background_start_nowindow !global.!shell_command runfile !global.!background_end With Output Append Stream outputfile Error Append Stream outputfile 4886address system 'type' runfile 4887*/ 4888Address System !global.!background_start_nowindow !global.!shell_command runfile_caller !global.!background_end 4889Call Directory( here ) 4890Call Value !global.!buildenvvar, '', 'ENVIRONMENT' 4891Call Value !global.!versionenvvar, '', 'ENVIRONMENT' 4892Return 0 4893 4894ReportModuleHistoryCallback: Procedure Expose !REXXDW. !global. !!last_repository 4895if trace() = 'F' Then say 'got reportmodulehistory' 4896/* 4897 * Dialog box to determine how and what to show mods... 4898 * 4899 * +---------------------------------------------------+ 4900 * | Text | 4901 * | | 4902 * +---------------------------------------------------+ 4903 * | Compare x Ignore whitespace| 4904 * | Earlier Version _Latest___v X Strict | 4905 * | in _Current__v | 4906 * | and | 4907 * | Later Version _Working__v x Compare Word Doc | 4908 * | in _Current__v | 4909 * | | 4910 * +---------------------------------------------------+ 4911 */ 4912if trace() = 'F' Then say 'got reportmodulehistory' 4913tryparent = 1 4914Call SetCursorWait 4915win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Report Modifications', !global.!windowstyle ) 4916Call dw_window_set_icon win, !global.!qoccaicon 4917topbox = dw_box_new( !REXXDW.!DW_VERT ) 4918Call dw_box_pack_start win, topbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 4919/* 4920 * Add a disabled MLE with instructions 4921 */ 4922t1 = dw_mle_new( 0 ) 4923Call dw_box_pack_start topbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 4924Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 4925Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 4926loc = dw_mle_import( t1, 'Select the labeled versions to report modifications made. Comparisons can be done ignoring whitespace or strictly.', -1 ) 4927Call dw_window_disable t1 4928Call dw_mle_set_cursor t1, loc 4929/* 4930 * Add a horiz box with comboboxes on left, radio buttons on right 4931 */ 4932data_box = dw_box_new( !REXXDW.!DW_HORZ ) 4933Call dw_box_pack_start topbox, data_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 4934/* 4935 * Add a vertical box for the comboboxes and add the comboboxes 4936 */ 4937cb_box = dw_box_new( !REXXDW.!DW_VERT ) 4938Call dw_box_pack_start data_box, cb_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 4939/* 4940 * comboboxes for later revision 4941 */ 4942cb1_box = dw_groupbox_new( !REXXDW.!DW_VERT, 'Compare (later revision)', !REXXDW.!DW_FONT_BOLD ) 4943Call dw_box_pack_start cb_box, cb1_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 4944cb1_h_box1 = dw_box_new( !REXXDW.!DW_HORZ ) 4945Call dw_box_pack_start cb1_box, cb1_h_box1, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4946tmp = dw_text_new( 'Version', 0 ) 4947Call dw_box_pack_start cb1_h_box1, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4948Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 4949Parse Value CreateModuleVersionCombobox( cb1_box, 'false', 'Working', !global.!current_dirname.!!last_repository, tryparent, 'Latest' ) With rev1cbox boxtopack realtagstart 4950Call dw_box_pack_start cb1_h_box1, boxtopack, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4951/* 4952 * Module selector... 4953 */ 4954tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 4955Call dw_box_pack_start cb1_box, tmpbox, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4956tmp = dw_text_new( "of", 0 ) 4957Call dw_box_pack_start tmpbox, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4958later_entry = dw_entryfield_new( !global.!current_dirname.!!last_repository, 0 ) 4959Call dw_box_pack_start tmpbox, later_entry, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4960abutton = dw_bitmapbutton_new_from_file( "Browse...", 0, !global.!icondir||'modulecheckedout' ) 4961Call dw_box_pack_start tmpbox, abutton, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4962/* MUST create repository combobox here so we can pass handle to ModuleSelector */ 4963rep1cbox = CreateRepositoryCombobox( cb1_box, 'false', 'Current Repository', rev1cbox, realtagstart, '', tryparent ) 4964Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'ModuleSelector', later_entry, 'Select Module for Later Version:', rep1cbox 4965/* 4966 * Repository selector... 4967 */ 4968cb1_h_box2 = dw_box_new( !REXXDW.!DW_HORZ ) 4969Call dw_box_pack_start cb1_box, cb1_h_box2, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4970tmp = dw_text_new( "in", 0 ) 4971Call dw_box_pack_start cb1_h_box2, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4972/* creation of combobox done above */ 4973Call dw_box_pack_start cb1_h_box2, rep1cbox, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4974/* 4975 * comboboxes for earlier revision 4976 */ 4977cb2_box = dw_groupbox_new( !REXXDW.!DW_VERT, 'with (earlier revision)', !REXXDW.!DW_FONT_BOLD ) 4978Call dw_box_pack_start cb_box, cb2_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 4979cb2_h_box1 = dw_box_new( !REXXDW.!DW_HORZ ) 4980Call dw_box_pack_start cb2_box, cb2_h_box1, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4981tmp = dw_text_new( 'Version', 0 ) 4982Call dw_box_pack_start cb2_h_box1, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4983Parse Value CreateModuleVersionCombobox( cb2_h_box1, 'false', 'Latest', !global.!current_dirname.!!last_repository, tryparent, 'Working' ) With rev2cbox boxtopack realtagstart 4984Call dw_box_pack_start cb2_h_box1, boxtopack, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4985/* 4986 * Module selector... 4987 */ 4988tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 4989Call dw_box_pack_start cb2_box, tmpbox, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4990tmp = dw_text_new( "of", 0 ) 4991Call dw_box_pack_start tmpbox, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 4992earlier_entry = dw_entryfield_new( !global.!current_dirname.!!last_repository, 0 ) 4993Call dw_box_pack_start tmpbox, earlier_entry, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4994abutton = dw_bitmapbutton_new_from_file( "Browse...", 0, !global.!icondir||'modulecheckedout' ) 4995Call dw_box_pack_start tmpbox, abutton, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 4996/* MUST create repository combobox here so we can pass handle to ModuleSelector */ 4997rep2cbox = CreateRepositoryCombobox( cb2_box, 'false', 'Current Repository', rev2cbox, realtagstart, '', tryparent ) 4998Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'ModuleSelector', earlier_entry, 'Select Module for Earlier Version:', rep2cbox 4999/* 5000 * Repository selector... 5001 */ 5002cb2_h_box2 = dw_box_new( !REXXDW.!DW_HORZ ) 5003Call dw_box_pack_start cb2_box, cb2_h_box2, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 5004tmp = dw_text_new( "in", 0 ) 5005Call dw_box_pack_start cb2_h_box2, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 5006/* creation of combobox done above */ 5007Call dw_box_pack_start cb2_h_box2, rep2cbox, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 5008/* 5009 * Add a vertical box for the two groups of radio buttons and add the radio buttons 5010 */ 5011group_box = dw_box_new( !REXXDW.!DW_VERT ) 5012Call dw_box_pack_start data_box, group_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5013 5014g1 = dw_groupbox_new( !REXXDW.!DW_VERT, 'Comparison', !REXXDW.!DW_FONT_BOLD ) 5015Call dw_box_pack_start group_box, g1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 5016compare_rb1 = dw_radiobutton_new( 'Ignore whitespace', 111 ) 5017Call dw_box_pack_start g1, compare_rb1, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 5018compare_rb2 = dw_radiobutton_new( 'Strict', 111 ) 5019Call dw_box_pack_start g1, compare_rb2, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 5020Call dw_radiobutton_set compare_rb1, !REXXDW.!DW_CHECKED 5021 5022Call dw_box_pack_start group_box, 0, 10, 10, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 5023 5024-- show all files 5025showall_compare_cb = dw_checkbox_new( 'Show All Files', 0 ) 5026Call dw_box_pack_start group_box, showall_compare_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 5027Call dw_checkbox_set showall_compare_cb, !REXXDW.!DW_UNCHECKED 5028 5029word_compare_cb = dw_checkbox_new( 'Compare Word Documents', 0 ) 5030Call dw_box_pack_start group_box, word_compare_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 5031Call dw_checkbox_set word_compare_cb, !REXXDW.!DW_UNCHECKED 5032/* 5033 * Create Cancel and Apply buttons 5034 */ 5035b1 = dw_button_new( 'Apply', 0 ) 5036Call dw_box_pack_start topbox, b1, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5037 5038b2 = dw_button_new( 'Cancel', 0 ) 5039Call dw_box_pack_start topbox, b2, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5040/* 5041 * We now have everything setup, we can connect the destroying of the top-level window 5042 * to the 'close' callback 5043 */ 5044Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 5045/* 5046 * Display the window 5047 */ 5048Call dw_window_set_gravity win, !REXXDW.!DW_GRAV_CENTRE, !REXXDW.!DW_GRAV_CENTRE 5049Call dw_window_set_pos_size win, 0, 0, 0, 0 5050Call dw_window_show win 5051 5052Do Forever 5053 /* 5054 * Create a dialog for the window 5055 */ 5056 dialog_wait = dw_dialog_new( ) 5057 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'ReportModuleHistoryApplyCallback', win, dialog_wait, rev1cbox, rev2cbox, rep1cbox, rep2cbox, compare_rb1, compare_rb2, later_entry, earlier_entry, word_compare_cb, showall_compare_cb 5058 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 5059 /* 5060 * Wait for the dialog to come back 5061 */ 5062 cancel = dw_dialog_wait( dialog_wait ) 5063 5064 If cancel \= 'retry' Then Leave 5065End 5066 5067Return 0 5068 5069LabelCallback: Procedure Expose !REXXDW. !global. !!last_repository 5070Do Forever 5071 Parse Value GetLabel() With res lab based_on overwrite_label edit_label_file 5072 Select 5073 When res = 'apply' Then 5074 Do 5075 If edit_label_file = '' Then 5076 Do 5077 Call dw_messagebox 'Error!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), 'Either new label or based-on label are blank.' 5078 Iterate 5079 End 5080 /* 5081 * Validate the label... 5082 */ 5083 Parse Value ValidLabel( lab ) With status msg 5084 If status Then Leave 5085 Call dw_messagebox 'Error!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), msg 5086 End 5087 When res = 'close' Then Return 0 5088 Otherwise Nop 5089 End 5090End 5091 5092if trace() = 'F' Then say 'got apply for label ok' 5093 5094/* 5095 * generate the label file into our working directory 5096 */ 5097Parse Value GenerateLabelFile( '', based_on, lab, overwrite_label ) With new_label_file labelbasefile 5098If new_label_file = 'N' Then Return 0 5099/* 5100 * If the user wants to edit the label file, do it here 5101 */ 5102If edit_label_file Then 5103 Do 5104 If EditLabel( based_on, lab, labelbasefile ) = 'close' Then Return 0 5105 End 5106Call SetCursorWait 5107/* 5108 * Apply the actual label now 5109 */ 5110Call ApplyLabelFile '', new_label_file, edit_label_file, lab, labelbasefile 5111/* 5112 * Refresh the current directory, so the label file shows up in a list of labels 5113 */ 5114Call RefreshFilesCallback 5115Call SetCursorNoWait 5116Return 0 5117 5118 5119GetLabel: Procedure Expose !REXXDW. !global. !!last_repository 5120/* 5121 * Get new label file. 5122 * 5123 * +---------------------------------------------------+ 5124 * | Text | 5125 * +---------------------------------------------------+ 5126 * | Based on ---------------------------------v | 5127 * | New Label ---------------------------------v | 5128 * | x Overwrite Existing Label | 5129 * | x Edit Label File | 5130 * +---------------------------------------------------+ 5131 * | Apply | 5132 * | Cancel | 5133 * +---------------------------------------------------+ 5134 * 5135 */ 5136title_width = 80 5137win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Specify Label', !global.!windowstyle ) 5138Call dw_window_set_icon win, !global.!qoccaicon 5139topbox = dw_box_new( !REXXDW.!DW_VERT ) 5140Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5141/* 5142 * Add a disabled MLE with instructions 5143 */ 5144t1 = dw_mle_new( 0 ) 5145Call dw_box_pack_start topbox, t1, 400, 50, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5146Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 5147Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 5148Call GetLabelFocusCallback t1, 'INITIAL', t1 5149/* 5150 * Add a horiz box for the based-on label 5151 */ 5152bo_box = dw_box_new( !REXXDW.!DW_HORZ ) 5153Call dw_box_pack_start topbox, bo_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5154tmp = dw_text_new( 'Based on', 0 ) 5155Call dw_box_pack_start bo_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 5156bo_cb = dw_combobox_new( 'Latest', 0 ) 5157Call dw_box_pack_start bo_box, bo_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5158Call dw_signal_connect bo_cb, !REXXDW.!DW_SET_FOCUS_EVENT, 'GetLabelFocusCallback', 'OLDLABEL', t1 5159Call dw_listbox_append bo_cb, 'Latest' 5160Do i = 1 To !global.!label.0 5161 If Left( !global.!label.idx, 13 ) \= '__testbuild__' Then Call dw_listbox_append bo_cb, !global.!label.i 5162End 5163/* 5164 * Add a horiz box for the based-on label 5165 */ 5166nl_box = dw_box_new( !REXXDW.!DW_HORZ ) 5167Call dw_box_pack_start topbox, nl_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5168tmp = dw_text_new( 'New Label', 0 ) 5169Call dw_box_pack_start nl_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 5170nl_cb = dw_combobox_new( '', 0 ) 5171Call dw_box_pack_start nl_box, nl_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5172Call dw_signal_connect nl_cb, !REXXDW.!DW_SET_FOCUS_EVENT, 'GetLabelFocusCallback', 'NEWLABEL', t1 5173Do i = 1 To !global.!label.0 5174 If Left( !global.!label.idx, 13 ) \= '__testbuild__' Then Call dw_listbox_append nl_cb, !global.!label.i 5175End 5176/* 5177 * Add checkboxes 5178 */ 5179overwrite_cb = dw_checkbox_new( 'Overwrite Existing Label', 0 ) 5180Call dw_box_pack_start topbox, overwrite_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5181edit_label_file_cb = dw_checkbox_new( 'Edit Label File', 0 ) 5182Call dw_box_pack_start topbox, edit_label_file_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5183 5184/* 5185 * Create a dialog for the window 5186 */ 5187dialog_wait = dw_dialog_new( ) 5188/* 5189 * Create Cancel and Apply buttons 5190 */ 5191b1 = dw_button_new( 'Apply', 0 ) 5192Call dw_box_pack_start topbox, b1, 400, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5193Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GetLabelApplyCallback', win, dialog_wait, bo_cb, nl_cb, overwrite_cb, edit_label_file_cb 5194 5195b2 = dw_button_new( 'Cancel', 0 ) 5196Call dw_box_pack_start topbox, b2, 400, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5197Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 5198/* 5199 * We now have everything setup, we can connect the destroying of the top-level window 5200 * to the 'close' callback 5201 */ 5202Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 5203/* 5204 * Display the window 5205 */ 5206width = 450 5207height = 250 /* text_height + cb_height + 80 */ 5208Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 5209Call dw_window_show win 5210 Call dw_main_sleep 10 5211/* 5212 * Wait for the dialog to come back 5213 */ 5214Return dw_dialog_wait( dialog_wait ) 5215 5216GetLabelFocusCallback: Procedure Expose !REXXDW. !global. !!last_repository 5217Parse Arg win, which, textwin 5218help.initial = 'Specify the label to be associated with all configuration item in this directory and below.' 5219help.oldlabel = 'Select an existing label (or latest) from the drop-down box. This will be the basis from which a new label will be generated.' 5220help.newlabel = 'Enter the new label, or select an existing label from the drop-down box. If you re-use a label, you will need to check the Overwrite Existing Label checkbox.' 5221help.overwrite = 'Select this if you wish to overwrite an existing label. Generally it is not good practice to re-use an existing label.' 5222help.editlabel = 'If you wish to change the revision number of any configuration item from the generated list, the check this box. This will display a dialog to enable you to make the required changes.' 5223Call dw_window_enable textwin 5224Call dw_mle_set_cursor textwin, 0 5225Call dw_mle_delete textwin 5226Call dw_mle_import textwin, help.which, -1 5227Call dw_window_disable textwin 5228Return 0 5229 5230BuildCallback: Procedure Expose !REXXDW. !global. !!last_repository 5231/* 5232 * Dialog box to determine build settings 5233 * 5234 * +------------------------------------+ 5235 * | Text | 5236 * | | 5237 * +------------------------------------+ 5238 * | Version _Latest___v | 5239 * | x Debug build x Custom Build | 5240 * +------------------------------------+ 5241 */ 5242win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Build Settings', !global.!windowstyle ) 5243Call dw_window_set_icon win, !global.!qoccaicon 5244topbox = dw_box_new( !REXXDW.!DW_VERT ) 5245Call dw_box_pack_start win, topbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5246/* 5247 * Add a disabled MLE with instructions 5248 */ 5249t1 = dw_mle_new( 0 ) 5250Call dw_box_pack_start topbox, t1, !REXXDW.!DW_SIZE_AUTO, 50, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5251Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 5252Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 5253Call BuildHelpFocusCallback t1, 'INITIAL', t1 5254/* 5255 * Add a horiz box for the label 5256 */ 5257bo_box = dw_box_new( !REXXDW.!DW_HORZ ) 5258Call dw_box_pack_start topbox, bo_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5259tmp = dw_text_new( 'Version to build', 0 ) 5260Call dw_box_pack_start bo_box, tmp, 100, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 5261bo_cb = dw_combobox_new( 'Latest', 0 ) 5262Call dw_box_pack_start bo_box, bo_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5263Call dw_signal_connect bo_cb, !REXXDW.!DW_SET_FOCUS_EVENT, 'BuildHelpFocusCallback', 'LABEL', t1 5264Call dw_listbox_append bo_cb, 'Latest' 5265Do i = 1 To !global.!label.0 5266 If Left( !global.!label.idx, 13 ) \= '__testbuild__' Then Call dw_listbox_append bo_cb, !global.!label.i 5267End 5268/* 5269 * Add checkboxes 5270 */ 5271overwrite_cb = dw_checkbox_new( 'Overwrite Existing Build', 0 ) 5272Call dw_box_pack_start topbox, overwrite_cb, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5273g1 = dw_groupbox_new( !REXXDW.!DW_VERT, 'Build Type', !REXXDW.!DW_FONT_BOLD ) 5274Call dw_box_pack_start topbox, g1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 5275build_rb1 = dw_radiobutton_new( 'Normal Build', 111 ) 5276Call dw_box_pack_start g1, build_rb1, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5277build_rb2 = dw_radiobutton_new( 'Debug Build', 111 ) 5278Call dw_box_pack_start g1, build_rb2, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5279build_rb3 = dw_radiobutton_new( 'Custom Build', 111 ) 5280Call dw_box_pack_start g1, build_rb3, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5281Call dw_radiobutton_set build_rb1, !REXXDW.!DW_CHECKED 5282/* 5283 * Create a dialog for the window 5284 */ 5285dialog_wait = dw_dialog_new( ) 5286/* 5287 * Create Cancel and Apply buttons 5288 */ 5289b1 = dw_button_new( 'Apply', 0 ) 5290Call dw_box_pack_start topbox, b1, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5291Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'BuildApplyCallback', win, dialog_wait, bo_cb, overwrite_cb, build_rb1, build_rb2, build_rb3 5292 5293b2 = dw_button_new( 'Cancel', 0 ) 5294Call dw_box_pack_start topbox, b2, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5295Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 5296/* 5297 * We now have everything setup, we can connect the destroying of the top-level window 5298 * to the 'close' callback 5299 */ 5300Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 5301/* 5302 * Display the window 5303 */ 5304Call dw_window_set_gravity win, !REXXDW.!DW_GRAV_CENTRE, !REXXDW.!DW_GRAV_CENTRE 5305Call dw_window_set_pos_size win, 0, 0, 0, 0 5306Call dw_window_show win 5307/* 5308 * Wait for the dialog to come back 5309 */ 5310Return dw_dialog_wait( dialog_wait ) 5311 5312BuildHelpFocusCallback: Procedure Expose !REXXDW. !global. !!last_repository 5313Parse Arg win, which, textwin 5314help.initial = 'Select the version to build, and whether you want to do a debug or custom build.' 5315help.label = 'Select the version to build' 5316Call dw_window_enable textwin 5317Call dw_mle_set_cursor textwin, 0 5318Call dw_mle_delete textwin 5319Call dw_mle_import textwin, help.which, -1 5320Call dw_window_disable textwin 5321Return 0 5322 5323BuildApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 5324Parse Arg button, window, dialog, label_box, overwrite_cb, build_rb1, build_rb2, build_rb3 5325lab = dw_window_get_text( label_box ) 5326If dw_checkbox_get( overwrite_cb ) Then overwriteflag = '-o' 5327Else overwriteflag = '' 5328Select 5329 When dw_radiobutton_get( build_rb2 ) Then buildflag = '-bdebug' 5330 When dw_radiobutton_get( build_rb3 ) Then buildflag = '-bcustom' 5331 Otherwise buildflag = '' 5332End 5333/* 5334 * Call the command-line build 5335 */ 5336desc = 'Build of version' quote( lab ) 'of' quote( !global.!current_dirname.!!last_repository ) 5337type = 'build' 5338compiler_type = FindCompilerType( !global.!current_dirname.!!last_repository ) 5339basefile = GenerateJobBaseFile() 5340Call CreateDescriptionFile basefile, desc, type, compiler_type 5341outputfile = basefile'.out' 5342cmd = !global.!qocca_command 'build -n'!global.!!repository.!!name.!!last_repository quote( '-m'!global.!current_dirname.!!last_repository ) quote( '-v'lab ) buildflag overwriteflag '-B'basefile 5343Call dw_window_destroy window 5344Call dw_dialog_dismiss dialog, 'apply' 5345/* 5346 * Increment the number of running jobs 5347 */ 5348Call IncrementRunningJobs basefile 5349/* 5350 * Run it now 5351 */ 5352Call WriteMessageHeaderToLogWindow 'Build of version' quote( lab ) 'of' quote( !global.!current_dirname.!!last_repository ) 'submitted' 5353Address System !global.!background_start_nowindow cmd !global.!background_end 5354Return 0 5355 5356PromoteCallback: Procedure Expose !REXXDW. !global. !!last_repository 5357/* 5358 * Dialog box to determine what to promote 5359 * 5360 * +-----------------------------+ 5361 * | Text | 5362 * | | 5363 * +-----------------------------+ 5364 * | Version _Working__v | 5365 * | Environment -------v | not implemented 5366 * +-----------------------------+ 5367 */ 5368if trace() = 'F' Then say 'got promote' 5369win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Promote', !global.!windowstyle ) 5370Call dw_window_set_icon win, !global.!qoccaicon 5371topbox = dw_box_new( !REXXDW.!DW_VERT ) 5372Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5373/* 5374 * Add a disabled MLE with instructions 5375 */ 5376t1 = dw_mle_new( 0 ) 5377Call dw_box_pack_start topbox, t1, 400, 50, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5378Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 5379Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 5380Call dw_mle_set_cursor t1, 0 5381Call dw_mle_import t1, 'Select the version to promote', -1 5382Call dw_window_disable t1 5383/* 5384 * Add a horiz box for the label 5385 */ 5386version_box = dw_box_new( !REXXDW.!DW_HORZ ) 5387Call dw_box_pack_start topbox, version_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5388tmp = dw_text_new( 'Version to promote', 0 ) 5389Call dw_box_pack_start version_box, tmp, 150, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 5390version_cb = dw_combobox_new( 'Latest', 0 ) 5391Call dw_box_pack_start version_box, version_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5392Call dw_listbox_append version_cb, 'Latest' 5393Do i = 1 To !global.!label.0 5394 If Left( !global.!label.idx, 13 ) \= '__testbuild__' Then Call dw_listbox_append version_cb, !global.!label.i 5395End 5396/* 5397 * Create a dialog for the window 5398 */ 5399dialog_wait = dw_dialog_new( ) 5400/* 5401 * Create Cancel and Apply buttons 5402 */ 5403b1 = dw_button_new( 'Apply', 0 ) 5404Call dw_box_pack_start topbox, b1, 400, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5405Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'PromoteApplyCallback', win, dialog_wait, version_cb 5406 5407b2 = dw_button_new( 'Cancel', 0 ) 5408Call dw_box_pack_start topbox, b2, 400, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5409Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 5410/* 5411 * We now have everything setup, we can connect the destroying of the top-level window 5412 * to the 'close' callback 5413 */ 5414Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 5415/* 5416 * Display the window 5417 */ 5418width = 450 5419height = 200 /* text_height + cb_height + 80 */ 5420Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 5421Call dw_window_show win 5422 Call dw_main_sleep 10 5423/* 5424 * Wait for the dialog to come back 5425 */ 5426Return dw_dialog_wait( dialog_wait ) 5427 5428PromoteApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 5429Parse Arg button, window, dialog, version_cb 5430lab = dw_window_get_text( version_cb ) 5431/* 5432 * Call the command-line promote 5433 */ 5434desc = 'Promote of version' quote( lab ) 'of' quote( !global.!current_dirname.!!last_repository ) 5435type = 'promote' 5436compiler_type = '.' 5437basefile = GenerateJobBaseFile() 5438Call CreateDescriptionFile basefile, desc, type, compiler_type 5439outputfile = basefile'.out' 5440cmd = !global.!qocca_command 'promote -n'!global.!!repository.!!name.!!last_repository quote( '-m'!global.!current_dirname.!!last_repository ) quote( '-v'lab ) '-B'basefile 5441 5442Call dw_window_destroy window 5443Call dw_dialog_dismiss dialog, 'apply' 5444/* 5445 * Increment the number of running jobs 5446 */ 5447Call IncrementRunningJobs basefile 5448/* 5449 * Run it now 5450 */ 5451Call WriteMessageHeaderToLogWindow 'Promote of version' quote( lab ) 'of' quote( !global.!current_dirname.!!last_repository ) 'submitted' 5452Address System !global.!background_start_nowindow cmd !global.!background_end 5453Return 0 5454 5455LinkDirCallback: Procedure Expose !REXXDW. !global. !!last_repository 5456if trace() = 'F' Then say 'got linkdir' 5457Call CreateModuleTree !!last_repository, '!link', 'Link Directory:' quote( !global.!current_dirname.!!last_repository ) 'to:' 5458Return 0 5459 5460ModuleSelector: Procedure Expose !REXXDW. !global. !!last_repository 5461Parse Arg ., entry, title, repcombobox 5462rep = dw_window_get_text( repcombobox ) 5463If rep = 'Current Repository' Then repno = !!last_repository 5464Else repno = FindRepository( rep ) 5465Call CreateModuleTree repno, '!select', title, entry 5466Return 0 5467 5468CreateModuleTree: Procedure Expose !REXXDW. !global. !!last_repository 5469Parse Arg repno, type, title, entry 5470type = Translate( type ) 5471selectcallback.!link = 'LinkDirSelectCallback' 5472applycallback.!link = 'LinkDirApplyCallback' 5473selectcallback.!select = 'SelectDirSelectCallback' 5474applycallback.!select = 'SelectDirApplyCallback' 5475Parse Value dw_window_get_pos_size( !global.!tree.!!last_repository ) With . . width height 5476Parse Value dw_window_get_pos_size( !global.!mainwindow ) With x y . . 5477win = dw_window_new( !REXXDW.!DW_DESKTOP, title, !global.!windowstyle ) 5478Call dw_window_set_icon win, !global.!qoccaicon 5479topbox = dw_box_new( !REXXDW.!DW_VERT ) 5480Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5481/* 5482 * Generate a tree matching the specified repository tree 5483 */ 5484linktreebox = dw_box_new( !REXXDW.!DW_VERT ) 5485Call dw_box_pack_start topbox, linktreebox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5486!global.!linktree = dw_tree_new( 101 ) 5487Call dw_box_pack_start linktreebox, !global.!linktree, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 1 5488/* 5489 * Setup our signals. On a tree, these MUST be done before we populate the tree. 5490 */ 5491Call dw_signal_connect !global.!linktree, !REXXDW.!DW_ITEM_SELECT_EVENT, selectcallback.type, entry 5492Select 5493 When !global.!!repository.!!type.repno = 'rcs' Then 5494 Do 5495 /* TODO */ 5496 End 5497 When !global.!!repository.!!type.repno = 'cvs' Then 5498 Do 5499 /* 5500 * Build the repository tree from the !global.!repdir. stem if we have it 5501 * or go and get the modules from the repository 5502 */ 5503 If !global.!tree.repno = -1 Then 5504 Do 5505 Call dw_messagebox 'Not implemented!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Cannot (yet) display tree of repository not previously selected.' 5506 End 5507 Else 5508 Do 5509 idx = DetermineModuleIcon( ) 5510 icon = !global.!moduleicon.idx 5511 !global.!linktreeparentitem = dw_tree_insert( !global.!linktree, '['!global.!!repository.!!name.repno']', icon, 0, '0' ) 5512 Do i = 1 To !global.!repdir.repno.0 5513 mydir = !global.!repdir.repno.i 5514 If mydir = '/admin' | mydir = '/CVSROOT' Then Iterate 5515 Parse Value DetermineModuleIconAndName( mydir ) With icon currentdir 5516 pos = Lastpos( '/', mydir ) 5517 parent = Substr( mydir, 1, pos-1 ) 5518 parentidx = FindTreeItem( parent ) 5519 If parentidx = 0 Then parentitem = !global.!linktreeparentitem 5520 Else parentitem = !global.!linktreeitem.parentidx 5521 !global.!linktreeitem.i = dw_tree_insert( !global.!linktree, currentdir, icon, parentitem, parentitem !global.!repdir.repno.i ) 5522 End 5523 End 5524 End 5525 Otherwise Nop 5526End 5527/* 5528 * Create Cancel and Apply buttons 5529 */ 5530b1 = dw_button_new( 'Apply', 0 ) 5531Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5532 5533b2 = dw_button_new( 'Cancel', 0 ) 5534Call dw_box_pack_start topbox, b2, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5535/* 5536 * Display the window 5537 */ 5538Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 5539Call dw_window_show win 5540 Call dw_main_sleep 10 5541Do Forever 5542 /* 5543 * Create a dialog for the window 5544 */ 5545 dialog_wait = dw_dialog_new( ) 5546 /* 5547 * We now have everything setup, we can connect the destroying of the top-level window 5548 * to the 'close' callback 5549 */ 5550 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, applycallback.type, win, dialog_wait, entry 5551 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 5552 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 5553 /* 5554 * Wait for the dialog to come back 5555 */ 5556 cancel = dw_dialog_wait( dialog_wait ) 5557 /* 5558 * All successful processing done in the 'applycallback', so simply get 5559 * out of the loop if we don't have any validation issues 5560 */ 5561 If cancel \= 'retry' Then Leave 5562End 5563Return 0 5564 5565CopyRepositoryCallback: Procedure Expose !REXXDW. !global. !!last_repository 5566/* 5567 * Dialog box to determine what to copy where... 5568 * 5569 * +---------------------------------------------------+ 5570 * | Text | 5571 * | | 5572 * +---------------------------------------------------+ 5573 * | Version to copy __________v | 5574 * | New Directory Base _________ X | 5575 * | Overwrite x | 5576 * +---------------------------------------------------+ 5577 */ 5578if trace() = 'F' Then say 'got copyrepository' 5579title_width = 100 5580win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Copy Repository', !global.!windowstyle ) 5581Call dw_window_set_icon win, !global.!qoccaicon 5582topbox = dw_box_new( !REXXDW.!DW_VERT ) 5583Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5584/* 5585 * Add a disabled MLE with instructions 5586 */ 5587t1 = dw_mle_new( 0 ) 5588Call dw_box_pack_start topbox, t1, 400, 50, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 5589Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 5590Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 5591Call dw_mle_set_cursor t1, 0 5592Call dw_mle_import t1, 'Select the labeled version to copy to the new repository.', -1 5593Call dw_window_disable t1 5594/* 5595 * Add a horiz box for the version 5596 */ 5597version_box = dw_box_new( !REXXDW.!DW_HORZ ) 5598Call dw_box_pack_start topbox, version_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5599tmp = dw_text_new( 'Version to copy', 0 ) 5600Call dw_box_pack_start version_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 5601version_cb = dw_combobox_new( 'Latest', 0 ) 5602Call dw_box_pack_start version_box, version_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5603Call dw_listbox_append version_cb, 'Latest' 5604Do i = 1 To !global.!label.0 5605 If Left( !global.!label.idx, 13 ) \= '__testbuild__' Then Call dw_listbox_append version_cb, !global.!label.i 5606End 5607/* dest dir */ 5608dest_dir_box = dw_box_new( !REXXDW.!DW_HORZ ) 5609Call dw_box_pack_start topbox, dest_dir_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5610tmp = dw_text_new( 'New Base Directory', 0 ) 5611Call dw_box_pack_start dest_dir_box, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5612Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 5613dest_dir_entry = dw_entryfield_new( '', 0 ) 5614Call dw_box_pack_start dest_dir_box, dest_dir_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5615abutton = dw_bitmapbutton_new_from_file( 'Browse', 0, !global.!icondir||'modulecheckedout' ) 5616Call dw_box_pack_start dest_dir_box, abutton, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5617Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericDirectorySelector', dest_dir_entry, 'Set Temporary Directory to:' 5618/* 5619 * Add checkboxes 5620 */ 5621overwrite_cb = dw_checkbox_new( 'Overwrite New Repository', 0 ) 5622Call dw_box_pack_start topbox, overwrite_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5623/* 5624 * Create a dialog for the window 5625 */ 5626dialog_wait = dw_dialog_new( ) 5627/* 5628 * Create Cancel and Apply buttons 5629 */ 5630b1 = dw_button_new( 'Apply', 0 ) 5631Call dw_box_pack_start topbox, b1, 400, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5632Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'CopyRepositoryApplyCallback', win, dialog_wait, version_cb, dest_dir_entry, overwrite_cb 5633 5634b2 = dw_button_new( 'Cancel', 0 ) 5635Call dw_box_pack_start topbox, b2, 400, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 5636Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 5637/* 5638 * We now have everything setup, we can connect the destroying of the top-level window 5639 * to the 'close' callback 5640 */ 5641Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 5642/* 5643 * Display the window 5644 */ 5645width = 450 5646height = 200 /* text_height + cb_height + 80 */ 5647Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 5648Call dw_window_show win 5649 Call dw_main_sleep 10 5650/* 5651 * Wait for the dialog to come back 5652 */ 5653Return dw_dialog_wait( dialog_wait ) 5654 5655CopyRepositoryApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 5656Parse Arg button, window, dialog, version_cb, dest_dir_entry, overwrite_cb 5657lab = dw_window_get_text( version_cb ) 5658destdir = dw_window_get_text( dest_dir_entry ) 5659overwrite = dw_checkbox_get( overwrite_cb ) 5660If overwrite Then overwrite = '-o' 5661Else overwrite = '' 5662/* 5663 * Call the command-line copy 5664 */ 5665desc = 'Copy of version' quote( lab ) 'of' quote( !global.!current_dirname.!!last_repository ) 'to' quote( destdir ) 5666type = 'copy' 5667compiler_type = '.' 5668basefile = GenerateJobBaseFile() 5669Call CreateDescriptionFile basefile, desc, type, compiler_type 5670outputfile = basefile'.out' 5671cmd = !global.!qocca_command "copy -n"!global.!!repository.!!name.!!last_repository "-m"!global.!current_dirname.!!last_repository "-v"lab '-d'destdir '-B'basefile overwrite 5672 5673Call dw_window_destroy window 5674Call dw_dialog_dismiss dialog, 'apply' 5675/* 5676 * Increment the number of running jobs 5677 */ 5678Call IncrementRunningJobs basefile 5679/* 5680 * Run it now 5681 */ 5682Call WriteMessageHeaderToLogWindow 'Copy of version' quote( lab ) 'of' quote( !global.!current_dirname.!!last_repository ) 'to' quote( destdir ) 'submitted' 5683Address System !global.!background_start_nowindow cmd !global.!background_end 5684Return 0 5685 5686AddBookmarkCallback: Procedure Expose !REXXDW. !global. !!last_repository 5687/* 5688 * Adds a bookmark 5689 */ 5690if trace() = 'F' Then say 'got addbookmark' 5691/* 5692 * Check if the bookmark already exists for this repository 5693 */ 5694found = 0 5695Do i = 1 To !global.!!user.!!bookmark.0 5696 If !global.!!user.!!bookmark_repository.i = !!last_repository & !global.!!user.!!bookmark.i = !global.!current_dirname.!!last_repository Then 5697 Do 5698 found = 1 5699 Leave 5700 End 5701End 5702If found = 0 Then 5703 Do 5704 idx = !global.!!user.!!bookmark.0 + 1 5705 !global.!!user.!!bookmark.idx = !global.!current_dirname.!!last_repository 5706 !global.!!user.!!bookmark_repository.idx = !!last_repository 5707 !global.!!user.!!bookmark.0 = idx 5708 Call PopulateBookmarks 5709 Call AdjustDirToolbarList 5710 Call AdjustDirToolbarButtons 5711 Call WriteUserSettingsFile 5712 End 5713Return 0 5714 5715DeleteBookmarkCallback: Procedure Expose !REXXDW. !global. !!last_repository 5716/* 5717 * Deletes a bookmark 5718 */ 5719if trace() = 'F' Then say 'got addbookmark' 5720/* 5721 * Check if the bookmark exists for this repository 5722 */ 5723found = 0 5724Do i = 1 To !global.!!user.!!bookmark.0 5725 If !global.!!user.!!bookmark_repository.i = !!last_repository & !global.!!user.!!bookmark.i = !global.!current_dirname.!!last_repository Then 5726 Do 5727 found = i 5728 Leave 5729 End 5730End 5731If found \= 0 Then 5732 Do 5733 Call SysStemDelete !global.!!user.!!bookmark., found 5734 Call SysStemDelete !global.!!user.!!bookmark_repository., found 5735 Call PopulateBookmarks 5736 Call AdjustDirToolbarList 5737 Call AdjustDirToolbarButtons 5738 Call WriteUserSettingsFile 5739 End 5740Return 0 5741 5742/* 5743 * File level callbacks... 5744 * All file-level callbacks can be called from a button, or from 5745 * a menu item. 5746 * The arguments passed to a button callback are: window 5747 * The arguments passed to a menu callback are: window, item index 5748 * Therefore if you are passing more arguments to the callback, 5749 * then those arguments must come after window and item index. 5750 */ 5751 5752RefreshFilesCallback: Procedure Expose !REXXDW. !global. !!last_repository 5753Select 5754 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then Call DisplayRepositoryFiles 5755 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?nonrepfiles.!!last_repository Then Call DisplayNonRepositoryFiles 5756 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?deletedfiles.!!last_repository Then Call DisplayDeletedFiles 5757 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then Call DisplayAllFiles 5758 Otherwise Nop 5759End 5760Return 0 5761 5762FilePropertiesCallback: Procedure Expose !REXXDW. !global. !!last_repository 5763/* 5764 * Display the properties of the selected file 5765 * Invalid for multiple selections 5766 */ 5767Call DisplayStatus 'Getting file properties...' 5768filepropchange = 'N' 5769Select 5770 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 5771 Do 5772 Call RunOsCommand 'rlog -t' quote( current_filenames.1 ) 5773 Call WriteOutputStemsToLogWindow 'default', 'Properties of' quote( current_filenames.1 ) 5774 Call RunOsCommand 'rlog' quote( current_filenames.1 ) 5775 Call WriteOutputStemsToLogWindow 'default', 'History for'quote( current_filenames.1 ) 5776 End 5777 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 5778 Do 5779 Select 5780 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then file = !global.!current_filenames.1 5781 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?deletedfiles.!!last_repository Then file = !global.!current_deletedfilenames.1 5782 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then file = !global.!current_filenames.1 5783 Otherwise Nop 5784 End 5785 -- Get log comments and file properties from CVS 5786 Call GetCVSFileProperties file 5787 -- Display the contents of osout. and prop. stems in a seperate window 5788 filepropchange = ShowFileHistoryWindow( file ) 5789 If !global.!filespage.!!last_repository \= !global.!filenotebookpage.?repfiles.!!last_repository Then filepropchange = 'N' 5790 End 5791 Otherwise Nop 5792End 5793/* 5794 * If the file properties were changed, refresh the current file in case the icon type 5795 * has changed, or the file is no checkoutable. 5796 */ 5797If filepropchange = 'Y' Then 5798 Do 5799 Call RefreshDirectoryIcons 5800 Call RefreshSelectedFiles 5801 Call AdjustFileToolbarList 5802 Call AdjustFileToolbarButtons 5803 End 5804Call DisplayStatus '' 5805Return 0 5806 5807AddFilesCallback: Procedure Expose !REXXDW. !global. !!last_repository 5808if trace() = 'F' Then say 'got addfiles' 5809/* 5810 * Do some validation first... 5811 */ 5812Select 5813 When !global.!!repository.!!type.!!last_repository = 'cvs' & !global.!filespage.!!last_repository = !global.!filenotebookpage.?nonrepfiles.!!last_repository Then 5814 Do 5815 /* 5816 * Don't let the user add the selected files/directories if there are 5817 * any CVS working files; ie look for CVS/Entries. Only valid for non-rep files 5818 */ 5819 continue = 1 5820 Do i = 1 To !global.!current_nonrepindexes.0 5821 Call SetCursorNoWait 5822 selected = !global.!current_nonrepindexes.i 5823 selected_file = Substr( !global.!nonrepfiles.?fullfilename.!!last_repository.selected, 5 ) 5824 filetype = Substr( !global.!nonrepfiles.?filetype.!!last_repository.selected, 5 ) 5825 If filetype = 'dir' Then 5826 Do 5827 /* 5828 * The selected directory will never be CVS; we have excluded it already. 5829 */ 5830 Call SysFileTree selected_file'/Entries', 'ENTRIES.', 'OSF' /* filename only, search subdirs, files only*/ 5831 Do j = 1 To entries.0 5832 If Right( entries.j, 12 ) = '/CVS/Entries' Then 5833 Do 5834 continue = 0 5835 Leave i /* bail out of everything */ 5836 End 5837 End 5838 Drop entries. 5839 End 5840 End 5841 If continue = 0 Then 5842 Do 5843 Call dw_messagebox 'Abort!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'At least 1 directory contains CVS working files in a "CVS" directory; delete these "CVS" directories before continuing.' 5844 Return 0 5845 End 5846 End 5847 Otherwise Nop 5848End 5849Select 5850 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?nonrepfiles.!!last_repository Then 5851 Do 5852 /* 5853 * Get each selected item from the non-repository container, and for each 5854 * item, determine if it is a file or directory. 5855 * If we added at least one directory, we need to rebuild the tree with the new 5856 * directories. 5857 * After procesing all the selected items, refresh the non-repository container. 5858 */ 5859 same = 0 5860 file_added = 0 5861 dir_added = 0 5862 Do i = 1 To !global.!current_nonrepindexes.0 5863 Call SetCursorNoWait 5864 selected = !global.!current_nonrepindexes.i 5865 selected_file = Substr( !global.!nonrepfiles.?fullfilename.!!last_repository.selected, 5 ) 5866 /* 5867 * Do not add the file if the file extension is in !global.!ignorefiles 5868 */ 5869 If IsFileTypeIgnored( selected_file ) Then Iterate i 5870 filetype = Substr( !global.!nonrepfiles.?filetype.!!last_repository.selected, 5 ) 5871 /* 5872 * Get the details for the files/directories to be checked in... 5873 */ 5874 If same = 0 Then 5875 Do 5876 Parse Value Strip( GetCheckinDetails( 'Y', 'add', selected_file, 'Same Description for all selected modules?', 'Adding:' ) ) With cancel same . 5877 If cancel = 'close' Then Leave 5878 /* 5879 * What is queued is the log message; ie the stuff that is written with the 5880 * CVS commit 5881 */ 5882 tmpfile = GenerateTempFile() -- we manage the cleanup ourselves 5883 Call Stream tmpfile, 'C', 'OPEN WRITE REPLACE' 5884 num = Queued() 5885 ci_lines. = '' 5886 Do m = 1 To num 5887 Parse Pull line 5888 cl_lines.m = line 5889 Call Lineout tmpfile, line 5890 End 5891 cl_lines.0 = num 5892 Call Stream tmpfile, 'C', 'CLOSE' 5893 End 5894 Call SetCursorWait 5895 If filetype = 'dir' Then 5896 Do 5897 /* 5898 * Add the directories(s) to the repository 5899 */ 5900 sub_modules. = '' 5901 sub_modules.0 = 0 5902 base_modules. = '' 5903 base_modules.0 = 0 5904 sub_files. = '' 5905 sub_files.0 = 0 5906 Call SysStemInsert 'base_modules.', 1+base_modules.0, selected_file 5907 /* get all directories...*/ 5908 If Stream( selected_file, 'C','QUERY EXISTS' ) = '' Then newdir.0 = 0 5909 Else Call SysFileTree selected_file'/*', 'NEWDIR.', 'DLS' 5910 Do ndi = 1 To newdir.0 5911 Call SysStemInsert 'sub_modules.', 1+sub_modules.0, Changestr( !global.!ossep, SubWord( newdir.ndi, 5 ), '/' ) 5912 End 5913 /* get all files...*/ 5914 If Stream( selected_file, 'C','QUERY EXISTS' ) = '' Then newfile.0 = 0 5915 Else Call SysFileTree selected_file'/*', 'NEWFILE.', 'LSF' 5916 Do ndi = 1 To newfile.0 5917 Call SysStemInsert 'sub_files.', 1+sub_files.0, Changestr( !global.!ossep, SubWord( newfile.ndi, 5 ), '/' ) 5918 End 5919 /* 5920 * Process all files in each directory recursively... 5921 */ 5922 Select 5923 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 5924 Do 5925 /* 5926 TODO 5927 * For each directory in base_modules AND sub_modules, determine 5928 * the files in each, and add them... 5929 * Also for each directory, need to create new directory and 'RCS' 5930 * directory in the repository 5931 * The below relies on a CVS directory and Entries, Repository, Root 5932 * files in the root working dir for the repository TODO 5933 */ 5934 End 5935 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 5936 Do 5937 /* 5938 * 'cvs add' each base module 5939 */ 5940 Call WriteMessageHeaderToLogWindow 'Adding Selected Directories' 5941 Do k = 1 To base_modules.0 5942 bm = base_modules.k 5943 sbm = Changestr( !global.!!repository.!!working_dir.!!last_repository, bm, '' ) 5944 Call WriteStringToLogWindow 'Adding' quote( sbm )'...' 5945 Call dw_main_sleep 10 /* get window updated */ 5946 Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'add -m"'!global.!addfile_text'"' quote( sbm ) 5947 If result = 0 Then Call WriteMessageToLogWindow 'OK' 5948 Else 5949 Do 5950 Call WriteMessageToLogWindow 'ERROR', 'redfore' 5951 Do wtfi = 1 To oserr.0 5952 Call WriteMessageToLogWindow ' 'oserr.wtfi, 'redfore' 5953 End 5954 End 5955 End 5956 Do k = 1 To sub_modules.0 5957 sm = sub_modules.k 5958 ssm = Changestr( !global.!!repository.!!working_dir.!!last_repository, sm, '' ) 5959 Call WriteStringToLogWindow 'Adding' quote( ssm )'...' 5960 Call dw_main_sleep 10 /* get window updated */ 5961 Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'add -m"'!global.!addfile_text'"' quote( ssm ) 5962 If result = 0 Then Call WriteMessageToLogWindow 'OK' 5963 Else 5964 Do 5965 Call WriteMessageToLogWindow 'ERROR', 'redfore' 5966 Do wtfi = 1 To oserr.0 5967 Call WriteMessageToLogWindow ' 'oserr.wtfi, 'redfore' 5968 End 5969 End 5970 End 5971 Call WriteMessageTrailerToLogWindow 'Adding Selected Directories' 5972 Call dw_main_sleep 10 /* get window updated */ 5973 /* 5974 * Now 'cvs commit' the top-level modules 5975 */ 5976 Call WriteMessageHeaderToLogWindow 'Committing Selected Directories' 5977 Do k = 1 To base_modules.0 5978 bm = base_modules.k 5979 sbm = Changestr( !global.!!repository.!!working_dir.!!last_repository, bm, '' ) 5980 Call RunOsCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -F'tmpfile quote( sbm ) 5981 Call WriteOutputStemsToLogWindow 'default', 'Commiting' quote( sbm ) 5982 Call dw_main_sleep 10 /* get window updated */ 5983 End 5984 Call WriteMessageTrailerToLogWindow 'Committing Selected Directories' 5985 Call dw_main_sleep 10 /* get window updated */ 5986 /* 5987 * For each file to be imported, 'cvs add', 'cvs commit' it 5988 * If its a binary file, add '-kb' 5989 */ 5990 Call WriteMessageHeaderToLogWindow 'Adding Selected Files' 5991 Do k = 1 To sub_files.0 5992 sf = sub_files.k 5993 /* 5994 * Do not add the file if the file extension is in !global.!ignorefiles 5995 */ 5996 If IsFileTypeIgnored( sf ) Then Iterate k 5997 /* 5998 * Check if its a binary file... 5999 */ 6000 iabf = IsBinaryFile( sf ) 6001 If iabf Then 6002 Do 6003 ibf = '-kb' 6004 Call WriteStringToLogWindow 'Adding binary file' quote( sf )'...' 6005 End 6006 Else 6007 Do 6008 ibf = '' 6009 Call WriteStringToLogWindow 'Adding text file' quote( sf )'...' 6010 End 6011 ssf = Changestr( !global.!!repository.!!working_dir.!!last_repository, sf, '' ) 6012 Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'add' ibf '-m"'!global.!addfile_text'"' quote( ssf ) 6013 If result = 0 Then 6014 Do 6015 Call RunOsCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -F'tmpfile quote( ssf ) 6016 If result = 0 Then 6017 Do 6018 Call WriteMessageToLogWindow 'OK' 6019 /* 6020 * Update description 6021 */ 6022 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -t-"'!global.!addfile_text'"' quote( ssf ) 6023 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6024 Address System cmd With Output Stem junk. Error Stem junk. 6025 End 6026 Else 6027 Do 6028 Call WriteMessageToLogWindow 'ERROR', 'redfore' 6029 Do wtfi = 1 To oserr.0 6030 Call WriteMessageToLogWindow ' 'oserr.wtfi, 'redfore' 6031 End 6032 End 6033 End 6034 Else 6035 Do 6036 Call WriteMessageToLogWindow 'ERROR', 'redfore' 6037 Do wtfi = 1 To oserr.0 6038 Call WriteMessageToLogWindow ' 'oserr.wtfi, 'redfore' 6039 End 6040 End 6041 If iabf Then 6042 Do 6043 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q admin -kb' quote( ssf ) 6044 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6045 Address Command cmd With Output Stem junk. Error Stem junk. 6046 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q update' quote( ssf ) 6047 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6048 Address Command cmd With Output Stem junk. Error Stem junk. 6049 End 6050 Call dw_main_sleep 10 /* get window updated */ 6051 End 6052 Call WriteMessageTrailerToLogWindow 'Adding Selected Files' 6053 dir_added = 1 6054 End 6055 Otherwise Nop 6056 End 6057 End 6058 Else 6059 Do 6060 Select 6061 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 6062 Do 6063 /* TODO */ 6064 If same = 0 Then 6065 Do 6066 Parse Value Strip( GetCheckinDetails( 'Y', 'add', selected_file, 'Same Description for all files', 'Checking in:' ) ) With cancel same . 6067 If cancel = 'close' Then Leave 6068 num = Queued() 6069 ci_lines. = '' 6070 Do m = 1 To num 6071 Parse Pull line 6072 cl_lines.m = line 6073 End 6074 cl_lines.0 = num 6075 End 6076 Else 6077 Do 6078 Do m = 1 To cl_lines.0 6079 Queue cl_lines.m 6080 End 6081 End 6082 basefile = Changestr( current_working_dir, selected_file, '' ) 6083 fullfilename = !global.!current_dirname'/RCS/'basefile',v' 6084 Call RunOsCommand 'LIFO> ci -u' quote( selected_file ) quote( fullfilename ) 6085 Call WriteOutputStemsToLogWindow 'default', 'Adding new file:' quote( selected_file ) 6086 End 6087 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 6088 Do 6089 /* 6090 * We either have cl_lines. stem from the most recent 6091 * GetCheckinDetails() or from the first one if "same" 6092 * comment for all files selected 6093 */ 6094 Do m = 1 To cl_lines.0 6095 Queue cl_lines.m 6096 End 6097 If filetype = 'binary file' Then kflag = '-kb' 6098 Else kflag = '' 6099 /* 6100 aaf_here = Directory() 6101 Call Directory !global.!current_working_dir.!!last_repository 6102 */ 6103 basefile = Changestr( !global.!current_working_dir.!!last_repository||!global.!ossep, Changestr( '/', selected_file, !global.!ossep ), '' ) 6104 abs_wd = Stream( Strip( !global.!!repository.!!working_dir.!!last_repository, 'T', '/'), 'C', 'QUERY EXISTS' ) 6105 basefile = Substr( basefile, Length( abs_wd ) + 2 ) 6106 Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'add' kflag '-m"'!global.!addfile_text'"' quote( basefile ) 6107 Call WriteOutputStemsToLogWindow 'default', 'Adding new' filetype':' quote( selected_file ) 6108 Call RunOsCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -F'tmpfile quote( basefile ) 6109 Call WriteOutputStemsToLogWindow 'default', 'Commiting new' filetype':' quote( selected_file ) 6110 file_added = 1 6111 /* 6112 * After an 'add', there should only be one line on the 6113 * queue 6114 */ 6115 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -t-"'!global.!addfile_text'"' quote( basefile ) 6116 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6117 Address System cmd With Output Stem osout. Error Stem oserr. 6118 Call WriteOutputStemsToLogWindow 'default', 'Updating Description for new' filetype':' quote( selected_file ) 6119 /* Call Directory aaf_here */ 6120 End 6121 Otherwise Nop 6122 End 6123 End 6124 End 6125 /* 6126 * If we have added at least one directory, refresh the repository 6127 */ 6128 If dir_added Then Call DisplayRepository 6129 Else 6130 Do 6131 If file_added Then 6132 Do 6133 Call DisplayRepositoryFiles 6134 Call DisplayNonrepositoryFiles 6135 End 6136 End 6137 Call SysFileDelete tmpfile 6138 End 6139 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?deletedfiles.!!last_repository Then 6140 Do 6141 /* 6142 * Get each selected item from the deleted files container, and for each 6143 * item "undelete" it 6144 * After procesing all the selected items, refresh the deleted files container. 6145 */ 6146 same = 0 6147 file_added = 0 6148 Select 6149 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 6150 Do 6151 Do i = 1 To !global.!current_deletedindexes.0 6152 selected = !global.!current_deletedindexes.i 6153 selected_file = Substr( !global.!deletedfiles.?fullfilename.!!last_repository.selected, 5 ) 6154 Call GetCVSRevisions !!last_repository, selected_file, 'rev' 6155 lastrev = '' 6156 Do j = 1 To Queued() 6157 Parse Pull newrev 6158 If j = 1 Then lastrev = newrev 6159 End 6160 If lastrev \= '' Then 6161 Do 6162 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'update -p -r'lastrev quote( selected_file ) 6163 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6164 Address Command cmd With Output Stream selected_file Error FIFO '' 6165 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'add' quote( selected_file ) 6166 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6167 Address Command cmd With Output FIFO '' Error FIFO '' 6168 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'ci -m"Undeleted revision' lastrev'"' quote( selected_file ) 6169 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6170 Address Command cmd With Output FIFO '' Error FIFO '' 6171 Call WriteStackToLogWindow 'cvs_status', 'Undelete for' quote( selected_file ) 6172 file_added = 1 6173 End 6174 End 6175 End 6176 Otherwise Nop 6177 End 6178 If file_added Then 6179 Do 6180 Call DisplayRepositoryFiles 6181 Call DisplayDeletedFiles 6182 End 6183 End 6184 Otherwise Nop 6185End 6186Call SetCursorNoWait 6187Return 0 6188 6189/* 6190 * View a selected revision of a file. 6191 * Only a single file is allowed to be selected to get here, hence we can 6192 * use current_filenames.1 6193 */ 6194ViewPriorCallback: Procedure Expose !REXXDW. !global. !!last_repository 6195Parse Arg window 6196rev = GetFileRevisions( !global.!current_filenames.1, 'View', 'rev tag', 'date', 'Latest' ) 6197If rev = '' Then Return 0 6198Return ViewLatestCallback( window, 0, rev ) 6199 6200ViewLatestCallback: Procedure Expose !REXXDW. !global. !!last_repository 6201/* 6202 * If the current user has the file checked out, view the checked-out 6203 * file, otherwise, check out the file and view it. 6204 * Valid for multiple selections only if NO rev arg passed 6205 */ 6206Parse Arg window, itemidx, rev 6207files_different = 0 6208workingfiles. = '' 6209workingfiles.0 = 0 6210If !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository | !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then 6211 Do 6212 If !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then doing_repfiles = 1 6213 Else doing_repfiles = 0 6214 Select 6215 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 6216 Do 6217 /* TODO - multiple filenames */ 6218 locker = GetRCSLocker( current_filenames ) 6219 If Translate( locker ) = Translate( !global.!user ) Then 6220 Do 6221 workingfile = RCSFileToFile( current_filenames ) 6222 End 6223 Else 6224 Do 6225 tmpfile = GenerateTempFile( '?????-'Translate( !global.!current_filenames.1, '_', '/' ) ) 6226 Address System 'co -p -r'rev current_filenames '>' tmpfile !global.!stderrdevnull 6227 workingfile = tmpfile 6228 End 6229 End 6230 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 6231 Do 6232 If rev \= '' Then 6233 Do 6234 /* 6235 * Only 1 file supported, so can use !global.!current_filenames.1 6236 */ 6237 Select 6238 When Words( rev ) = 3 Then rev_flag = '-D' 6239 When rev = 'Latest' Then 6240 Do 6241 rev_flag = '' 6242 rev = '' 6243 End 6244 Otherwise rev_flag = '-r' 6245 End 6246 tmpfile = GenerateTempFile( '?????-'Translate( !global.!current_filenames.1, '_', '/' ) ) 6247 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q checkout -p' rev_flag||rev quote( !global.!current_filenames.1 ) 6248 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6249 Address System cmd With Output Stream tmpfile Error Stem junk. 6250 workingfiles.0 = 1 6251 workingfiles.1 = tmpfile 6252 End 6253 Else 6254 Do 6255 /* 6256 * Save the !global.!current_filenames. array and then for each element in 6257 * the array set !global.!current_filenames. array to the single element 6258 */ 6259 Call SysStemCopy '!global.!current_filenames.', 'save_current_filenames.' 6260 Do vi = 1 To save_current_filenames.0 6261 !global.!current_filenames.1 = save_current_filenames.vi 6262 !global.!current_filenames.0 = 1 6263 workingfile = CVSFileToWorkingFile( !global.!current_filenames.1, !!last_repository ) 6264 wfi = workingfiles.0 + 1 6265 workingfiles.wfi = workingfile 6266 workingfiles.0 = wfi 6267 If Stream( workingfile, 'C', 'QUERY EXISTS' ) \= '' Then file_checked_out = 1 6268 Else file_checked_out = 0 6269 Select 6270 When !global.!offline Then Nop 6271 When file_checked_out = 0 Then 6272 Do 6273 Call GetLatestCallback 6274 End 6275 Otherwise 6276 Do 6277 cvs_status = CVSStatus( !global.!current_filenames.1 ) 6278 If cvs_status = 'Needs Patch' | cvs_status = 'Needs Merge' Then 6279 Do 6280 answer = dw_messagebox( 'Refresh ?', dw_or( !REXXDW.!DW_MB_YESNOCANCEL, !REXXDW.!DW_MB_QUESTION ), 'The working copy of' quote( !global.!current_filenames.1 ) 'is out of date. Do you want it refreshed before viewing ?' ) 6281 Select 6282 When answer = !REXXDW.!DW_MB_RETURN_YES Then Call UpdateCallback window 6283 When answer = !REXXDW.!DW_MB_RETURN_CANCEL Then Return 0 6284 Otherwise Nop 6285 End 6286 End 6287 End 6288 End 6289 End 6290 Call SysStemCopy 'save_current_filenames.', '!global.!current_filenames.' 6291 Drop save_current_filenames. 6292 End 6293 End 6294 Otherwise Return 'N' 6295 End 6296 End 6297Else 6298 Do 6299 Do i = 1 To !global.!current_nonrepindexes.0 6300 selected = !global.!current_nonrepindexes.i 6301 workingfiles.i = Substr( !global.!nonrepfiles.?fullfilename.!!last_repository.selected, 5 ) 6302 End 6303 workingfiles.0 = !global.!current_nonrepindexes.0 6304 End 6305/* 6306 * We now change to the current directory... 6307 */ 6308here = Directory() 6309Call Directory !global.!current_dirname.!!last_repository 6310/* 6311 * If using win32 file associations, run the files directly using the w32funcs 6312 * function; w32executestem() 6313 * Those files that have no association should be run with the configured text or 6314 * binary pager. 6315 * For non-win32 platform, execute text or binary pager as appropriate for each file 6316 */ 6317Select 6318 When !global.!os = 'WIN32' & !global.!!user.!!preference.!!windowsfileassociations = 1 Then 6319 Do 6320 Do i = 1 To workingfiles.0 6321 workingfiles.i = quote( Changestr( '/', workingfiles.i, !global.!ossep ) ) 6322 End 6323 Call w32executestem 'workingfiles.', 'results.' 6324 End 6325 When !global.!os = 'WIN32' Then 6326 Do 6327 /* 6328 * Determine if each file is to be executed by file associations... 6329 */ 6330 idx = 0 6331 Do i = 1 To workingfiles.0 6332 If UseFileAssociation( workingfiles.i ) Then 6333 Do 6334 idx = idx + 1 6335 wf.idx = quote( Changestr( '/', workingfiles.i, !global.!ossep ) ) 6336 idx.idx = i 6337 End 6338 End 6339 wf.0 = idx 6340 If wf.0 \= 0 Then Call w32executestem 'wf.', 'res.' 6341 /* 6342 * Apply the results of execution by file association back into the 6343 * results. stem 6344 */ 6345 results. = 0 6346 Do i = 1 To wf.0 6347 idx = idx.i 6348 results.idx = res.i 6349 End 6350 End 6351 Otherwise 6352 Do 6353 results. = 0 6354 results.0 = workingfiles.0 6355 End 6356End 6357/* 6358 * We are now using either text pager or binary pager for those files that 6359 * have a corresponding results.x = 0 6360 */ 6361/* 6362 * Check if files to be viewed are all binary or all text... 6363 */ 6364binary_files = 0 6365text_files = 0 6366text_workingfiles = '' 6367binary_workingfiles = '' 6368Do i = 1 To workingfiles.0 6369 If results.i = 0 Then 6370 Do 6371 If IsBinaryFile( workingfiles.i ) Then 6372 Do 6373 binary_workingfiles = binary_workingfiles quote( workingfiles.i ) 6374 End 6375 Else 6376 Do 6377 text_workingfiles = text_workingfiles quote( workingfiles.i ) 6378 End 6379 End 6380End 6381/* 6382 * Do we have any files left to view ? 6383 */ 6384If text_workingfiles \= '' Then 6385 Do 6386 If Strip( !global.!!user.!!textpager ) = '' Then 6387 Do 6388 Call dw_messagebox 'No viewer', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'You do not have a text viewer configured. Cannot view selected files.' 6389 End 6390 Else 6391 Do 6392 If !global.!!user.!!textpager_console Then sw = !global.!background_start_window 6393 Else sw = !global.!background_start_nowindow 6394 cmd = sw !global.!!user.!!textpager text_workingfiles !global.!background_end 6395 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6396 Address System cmd 6397 End 6398 End 6399If binary_workingfiles \= '' Then 6400 Do 6401 If Strip( !global.!!user.!!binarypager ) = '' Then 6402 Do 6403 Call dw_messagebox 'No viewer', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'You do not have a binary viewer configured. Cannot view selected files.' 6404 End 6405 Else 6406 Do 6407 If !global.!!user.!!binarypager_console Then sw = !global.!background_start_window 6408 Else sw = !global.!background_start_nowindow 6409 cmd = sw !global.!!user.!!binarypager binary_workingfiles !global.!background_end 6410 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6411 Address System cmd 6412 End 6413 End 6414 6415Drop text_workingfiles binary_workingfiles workingfiles. results. idx. wf. res. 6416/* 6417 * Change back to the working directory... 6418 */ 6419Call Directory here 6420/* 6421 * In case we checked out a different revision, refresh the files 6422 */ 6423If files_different = 1 Then Call RefreshSelectedFiles 6424Return 0 6425 6426EditLatestCallback: Procedure Expose !REXXDW. !global. !!last_repository 6427Parse Arg window 6428workingfiles. = '' 6429workingfiles.0 = 0 6430this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 6431If !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository | !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then 6432 Do 6433 If !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then doing_repfiles = 1 6434 Else doing_repfiles = 0 6435 Select 6436 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 6437 Do 6438 /* TODO - current_filenames. array processing */ 6439 locker = GetRCSLocker( !global.!current_filenames ) 6440 workingfile = RCSFileToFile( ?current.?current_filenames ) 6441 Select 6442 When locker = '' Then Call FileCommand 'checkout lock' 6443 When Translate( locker ) = Translate( !global.!user ) Then Nop 6444 Otherwise 6445 Do 6446 Call TkMessageBox '-message', 'You cannot edit a file locked by' locker,'-type','ok' 6447 Return 6448 End 6449 End 6450 End 6451 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 6452 Do 6453 /* 6454 * Save the !global.!current_filenames. array and then for each element in 6455 * the array set ?current.?current_filenames. array to the single element 6456 */ 6457 Call SysStemCopy '!global.!current_filenames.', 'save_current_filenames.' 6458 Do ei = 1 To save_current_filenames.0 6459 !global.!current_filenames.1 = save_current_filenames.ei 6460 !global.!current_filenames.0 = 1 6461 workingfile = CVSFileToWorkingFile( !global.!current_filenames.1, !!last_repository ) 6462 ignorefile = 0 6463 If Stream( workingfile, 'C', 'QUERY EXISTS' ) \= '' Then file_checked_out = 1 6464 Else file_checked_out = 0 6465 /* 6466 * If the file is a binary file, or we are in a reserved checkout directory 6467 * if not already checked out (and it can be checked out) check it out first 6468 */ 6469 checkout_first = 0 6470 If !global.!dir.!reservedcheckout.this_dir = 'Y' | !global.!reservedcheckout = 'Y' Then checkout_first = 1 6471 idx = !global.!current_indexes.ei 6472 If doing_repfiles Then ft = !global.!repfiles.?filetype.!!last_repository.idx 6473 Else ft = !global.!allfiles.?filetype.!!last_repository.idx 6474 If Substr( ft, 5, 6 ) = 'binary' Then checkout_first = 1 6475 If checkout_first Then 6476 Do 6477 /* 6478 * Check the lock status... 6479 */ 6480 If doing_repfiles Then ffn = !global.!repfiles.?fullfilename.!!last_repository.idx 6481 Else ffn = !global.!allfiles.?fullfilename.!!last_repository.idx 6482 locker = GetCVSLocker( Substr( ffn, 5 ) ) 6483 Select 6484 When locker = '' Then Call CheckoutCallback 6485 When Translate( locker ) = Translate( !global.!user ) Then Nop 6486 Otherwise 6487 Do 6488 Call dw_messagebox 'File locked.', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'You cannot edit the file. It is locked by' locker'.' 6489 ignorefile = 1 /* don't edit this one */ 6490 End 6491 End 6492 End 6493 Else 6494 Do 6495 Select 6496 When !global.!offline.!!last_repository Then Nop 6497 When file_checked_out = 0 Then 6498 Do 6499 Call GetLatestCallback 6500 End 6501 Otherwise 6502 Do 6503 cvs_status = CVSStatus( !global.!current_filenames.1 ) 6504 If cvs_status = 'Needs Patch' | cvs_status = 'Needs Merge' Then 6505 Do 6506 answer = dw_messagebox( 'Refresh ?', dw_or( !REXXDW.!DW_MB_YESNOCANCEL, !REXXDW.!DW_MB_QUESTION ), 'The working copy of' quote( !global.!current_filenames.1 ) 'is out of date. Do you want it refreshed before editing ?' ) 6507 Select 6508 When answer = !REXXDW.!DW_MB_RETURN_YES Then Call UpdateCallback window 6509 When answer = !REXXDW.!DW_MB_RETURN_CANCEL Then Return 0 6510 Otherwise Nop 6511 End 6512 End 6513 End 6514 End 6515 End 6516 /* 6517 * Add the current file into the list of working files... 6518 */ 6519 If ignorefile = 0 Then 6520 Do 6521 wfi = workingfiles.0 + 1 6522 workingfiles.wfi = workingfile 6523 workingfiles.0 = wfi 6524 End 6525 End 6526 Call SysStemCopy 'save_current_filenames.', '!global.!current_filenames.' 6527 Drop save_current_filenames. 6528 End 6529 Otherwise Return 0 6530 End 6531 End 6532Else 6533 Do 6534 Do i = 1 To !global.!current_nonrepindexes.0 6535 selected = !global.!current_nonrepindexes.i 6536 workingfiles.i = Substr( !global.!nonrepfiles.?fullfilename.!!last_repository.selected, 5 ) 6537 End 6538 workingfiles.0 = !global.!current_nonrepindexes.0 6539 End 6540/* 6541 * We now change to the current directory... 6542 */ 6543here = Directory() 6544Call Directory !global.!current_dirname.!!last_repository 6545/* 6546 * If using win32 file associations, run the files directly using the w32funcs 6547 * function; w32executestem() 6548 * Those files that have no association should be run with the configured text or 6549 * binary editor. 6550 * For non-win32 platform, execute text or binary editor as appropriate for each file 6551 */ 6552Select 6553 When !global.!os = 'WIN32' & !global.!!user.!!preference.!!windowsfileassociations = 1 Then 6554 Do 6555 Do i = 1 To workingfiles.0 6556 workingfiles.i = quote( Changestr( '/', workingfiles.i, !global.!ossep ) ) 6557 End 6558 Call w32executestem 'workingfiles.', 'results.' 6559 End 6560 When !global.!os = 'WIN32' Then 6561 Do 6562 /* 6563 * Determine if each file is to be executed by file associations... 6564 */ 6565 idx = 0 6566 Do i = 1 To workingfiles.0 6567 If UseFileAssociation( workingfiles.i ) Then 6568 Do 6569 idx = idx + 1 6570 wf.idx = quote( Changestr( '/', workingfiles.i, !global.!ossep ) ) 6571 idx.idx = i 6572 End 6573 End 6574 wf.0 = idx 6575 If wf.0 \= 0 Then Call w32executestem 'wf.', 'res.' 6576 /* 6577 * Apply the results of execution by file association back into the 6578 * results. stem 6579 */ 6580 results. = 0 6581 Do i = 1 To wf.0 6582 idx = idx.i 6583 results.idx = res.i 6584 End 6585 End 6586 Otherwise 6587 Do 6588 results. = 0 6589 results.0 = workingfiles.0 6590 End 6591End 6592/* 6593 * We are now using either text editor or binary editor for those files that 6594 * have a corresponding results.x = 0 6595 */ 6596/* 6597 * Check if files to be edited are all binary or all text... 6598 */ 6599binary_files = 0 6600text_files = 0 6601text_workingfiles = '' 6602binary_workingfiles = '' 6603Do i = 1 To workingfiles.0 6604 If results.i = 0 Then 6605 Do 6606 If IsBinaryFile( workingfiles.i ) Then 6607 Do 6608 binary_workingfiles = binary_workingfiles quote( workingfiles.i ) 6609 End 6610 Else 6611 Do 6612 text_workingfiles = text_workingfiles quote( workingfiles.i ) 6613 End 6614 End 6615End 6616/* 6617 * Do we have any files left to edit ? 6618 */ 6619If text_workingfiles \= '' Then 6620 Do 6621 If Strip( !global.!!user.!!texteditor ) = '' Then 6622 Do 6623 Call dw_messagebox 'No editor', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'You do not have a text editor configured. Cannot edit selected files.' 6624 End 6625 Else 6626 Do 6627 v_editor = !global.!!user.!!texteditor 6628 v_editor = Changestr( "%L%", v_editor, '1' ) 6629 v_editor = Changestr( "%C%", v_editor, '1' ) 6630 v_editor = Changestr( "%F%", v_editor, text_workingfiles ) 6631 If !global.!!user.!!texteditor_console Then sw = !global.!background_start_window 6632 Else sw = !global.!background_start_nowindow 6633 cmd = sw v_editor !global.!background_end 6634 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6635 Address System cmd 6636 End 6637 End 6638If binary_workingfiles \= '' Then 6639 Do 6640 If Strip( !global.!!user.!!binaryeditor ) = '' Then 6641 Do 6642 Call dw_messagebox 'No editor', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'You do not have a binary editor configured. Cannot edit selected files.' 6643 End 6644 Else 6645 Do 6646 If !global.!!user.!!binaryeditor_console Then sw = !global.!background_start_window 6647 Else sw = !global.!background_start_nowindow 6648 cmd = sw !global.!!user.!!binaryeditor binary_workingfiles !global.!background_end 6649 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6650 Address System cmd 6651 End 6652 End 6653 6654Drop text_workingfiles binary_workingfiles workingfiles. results. idx. wf. res. 6655/* 6656 * Change back to the working directory... 6657 */ 6658Call Directory here 6659Return 0 6660 6661/* 6662 * Called when double-clicking a file or prressing Enter in file list 6663 */ 6664FileDoubleClickCallback: Procedure Expose !REXXDW. !global. !!last_repository 6665Parse Arg ., index 6666Select 6667 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then 6668 Do 6669 /* 6670 * Set the "selected" rep indexes to the index passed in as a parameter 6671 */ 6672 !global.!current_repindexes.0 = 1 6673 !global.!current_repindexes.1 = index 6674 End 6675 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?nonrepfiles.!!last_repository Then 6676 Do 6677 /* 6678 * Set the "selected" norep indexes to the index passed in as a parameter 6679 */ 6680 !global.!current_nonrepindexes.0 = 1 6681 !global.!current_nonrepindexes.1 = index 6682 End 6683 Otherwise Nop 6684End 6685Call ViewLatestCallback 6686Return 0 6687 6688/* 6689 * Called from 'Get Latest' file menu 6690 * If we have a working file, check if it is locally modified. Warn if so. 6691 * If no working file, just get latest. 6692 * Refresh directory icons 6693 * Valid for multiple files. 6694 */ 6695GetLatestCallback: Procedure Expose !REXXDW. !global. !!last_repository 6696checkout = 'N' 6697Select 6698 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 6699 Do 6700 /* TODO */ 6701 End 6702 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 6703 Do 6704 Do i = 1 To !global.!current_filenames.0 6705 /* 6706 * If the file being obtained has been locally modified, ask the 6707 * user if they want to blow away any changes they have made 6708 * Not applicable if we are saving the file to a new filename 6709 * Always use "checkout -p" because this ignores CVS stickiness! 6710 */ 6711 file = !global.!current_filenames.i 6712 cvs_status = CVSStatus( file ) 6713 If cvs_status \= '' & cvs_status \= 'Up-to-date' & cvs_status \= 'Needs Checkout' Then 6714 Do 6715 blowaway = dw_messagebox( 'Get Latest?', dw_or( !REXXDW.!DW_MB_YESNOCANCEL, !REXXDW.!DW_MB_QUESTION ), quote( file ) 'has been modified locally. Do you want to lose these changes and retrieve the latest copy from the repository ?' ) 6716 Select 6717 When blowaway = !REXXDW.!DW_MB_RETURN_YES Then 6718 Do 6719 Call SysFileDelete file 6720 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout' quote( file ) 6721 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6722 Address Command cmd With Output FIFO '' Error FIFO '' 6723 Call WriteStackToLogWindow 'default', 'Get Latest of' quote( file ) 6724 checkout = 'Y' 6725 End 6726 When blowaway = !REXXDW.!DW_MB_RETURN_NO Then 6727 Do 6728 Call WriteStackToLogWindow 'default', 'Get Latest of' quote( file ) 'abandoned' 6729 End 6730 Otherwise Leave /* cancel */ 6731 End 6732 End 6733 Else 6734 Do 6735 Call RunOsCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout' quote( file ) 6736 Call WriteOutputStemsToLogWindow 'default', 'Get Latest of' quote( file ) 6737 checkout = 'Y' 6738 End 6739 End 6740 End 6741 Otherwise Nop 6742End 6743If checkout = 'Y' Then 6744 Do 6745 Call RefreshDirectoryIcons 6746 Call RefreshSelectedFiles 6747 Call AdjustFileToolbarList 6748 Call AdjustFileToolbarButtons 6749 End 6750Return 0 6751 6752/* 6753 * This function is called from the filemenu; update command 6754 * Valid for multiple selections 6755 * This command only valid for CVS 6756 */ 6757UpdateCallback: Procedure Expose !REXXDW. !global. !!last_repository 6758current_filenames = '' 6759Do i = 1 To !global.!current_filenames.0 6760 current_filenames = current_filenames quote( !global.!current_filenames.i ) 6761End 6762Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'update -d' current_filenames 6763If result \= 0 Then 6764 Do 6765 Call NotifyNoConnection 6766 Call RefreshFilesCallback 6767 Call AdjustFileToolbarList 6768 Call AdjustFileToolbarButtons 6769 End 6770Else 6771 Do 6772 Call WriteCVSOutputStemsToLogWindow 'update',, 'Update for' current_filenames 6773 If !global.!!repository.!!type.!!last_repository = 'cvs' Then Call CheckForCVSConflicts 6774 Call RefreshSelectedFiles 6775 End 6776Drop oserr. osout. current_filenames 6777Return 0 6778 6779CheckOutLatestCallback: Procedure Expose !REXXDW. !global. !!last_repository 6780Return 0 6781 6782GetPriorCallback: Procedure Expose !REXXDW. !global. !!last_repository 6783/* 6784 * Dialog box to ask user for file revision to work on 6785 * Only one file allowed to be selected for this option 6786 * 6787 * +---------------------------------------------------+ 6788 * | Text | 6789 * | | 6790 * +---------------------------------------------------+ 6791 * | File Revision: _____Latest___v | 6792 * | To: __________________________ X | 6793 * +---------------------------------------------------+ 6794 */ 6795this_file = !global.!current_filenames.1 6796win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Select File Revision for:' this_file, !global.!windowstyle ) 6797Call dw_window_set_icon win, !global.!qoccaicon 6798 6799gf = dw_box_new( !REXXDW.!DW_VERT ) 6800Call dw_box_pack_start win, gf, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 6801 6802t2 = dw_text_new( 'Select the revision of the file to Get.', 0 ) 6803Call dw_box_pack_start gf, t2, 250, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 6804 6805boxtopack = dw_box_new( !REXXDW.!DW_HORZ ) 6806Call dw_box_pack_start gf, boxtopack, 250, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 6807Parse Value CreateFileRevisionCombobox( boxtopack, 'false', 'Latest', this_file, '', 'rev tag', 'date' ) With revcbox . 6808/* 6809 * Now the destination box 6810 */ 6811db = dw_box_new( !REXXDW.!DW_HORZ ) 6812Call dw_box_pack_start gf, db, 250, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 6813 6814thisdir = GetFullWorkingDirectory( !global.!current_dirname.!!last_repository ) 6815 6816oldfile = !global.!!repository.!!working_dir.!!last_repository || this_file 6817oldfile = Changestr( '/', oldfile, !global.!ossep ) 6818 6819thisfile = Substr( oldfile, Length( thisdir ) + 2 ) 6820t1 = dw_entryfield_new( oldfile, 0 ) 6821Call dw_box_pack_start db, t1, 250-20, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 6822abutton = dw_bitmapbutton_new_from_file( 'Select Destination', 0, !global.!icondir||'modulecheckedout' ) 6823Call dw_box_pack_start db, abutton, 20, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 6824Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericFileSelector', t1, 'Get file to:', thisdir, 0, !REXXDW.!DW_FILE_SAVE 6825/* 6826 * Create a dialog for the window 6827 */ 6828dialog_wait = dw_dialog_new( ) 6829/* 6830 * Create Cancel and Apply buttons 6831 */ 6832b1 = dw_button_new( 'Apply', 0 ) 6833Call dw_box_pack_start gf, b1, 250, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 6834Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GetFileRevisionsAndDestinationApplyCallback', win, dialog_wait, revcbox, t1 6835 6836b2 = dw_button_new( 'Cancel', 0 ) 6837Call dw_box_pack_start gf, b2, 250, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 6838Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 6839/* 6840 * We now have everything setup, we can connect the destroying of the top-level window 6841 * to the 'close' callback 6842*/ 6843Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 6844/* 6845 * Display the window 6846 */ 6847width = 400 6848height = 160 6849Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 6850Call dw_window_show win 6851/* 6852 * Wait for the dialog to come back 6853 */ 6854Parse Value dw_dialog_wait( dialog_wait ) With cancel rev newfile 6855if trace() = 'F' Then say 'got rev' cancel rev ':' newfile 6856 6857/* 6858 * If the user is asking to overwrite an existing file in their working directory, 6859 * confirm this. 6860 */ 6861If newfile = oldfile Then files_different = 0 6862Else files_different = 1 6863If files_different = 0 & Stream( newfile, 'C', 'QUERY EXISTS' ) \= '' Then 6864 Do 6865 proceed = dw_messagebox( 'Overwrite File?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'Are you sure you want to overwrite the working file?' ) 6866 If proceed = !REXXDW.!DW_MB_RETURN_YES Then newfile = oldfile 6867 Else Return 0 6868 End 6869 6870If rev \= '' Then 6871 Do 6872 Select 6873 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 6874 Do 6875 /* TODO */ 6876 End 6877 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 6878 Do 6879 If Left( rev, 5 ) = 'Date:' Then rev = Date( 'N', Substr( rev, 6 ) , 'S' ) 6880 If rev \= '' & rev \= 'Latest' Then 6881 Do 6882 If Words( rev ) \= 1 Then relflag = '-D'Translate( rev, '-', ' ' ) 6883 Else relflag = '-r'rev 6884 End 6885 Else relflag = '' 6886 If Stream( thisdir, 'C', 'QUERY EXISTS' ) = '' Then 6887 Do 6888 Call dw_messagebox 'Directory non-existent', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'The directory to which you are saving the file does not exist. Cancelling action.' 6889 -- Return 0 6890 End 6891 Else 6892 Do 6893 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout -p' relflag quote( this_file ) 6894 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6895 Address Command cmd With Output Replace Stream newfile Error FIFO '' 6896 Call Stream newfile, 'C', 'CLOSE' 6897 Call WriteStackToLogWindow 'default', 'Get Revision for' quote( this_file ) 'to' newfile 6898 End 6899 End 6900 Otherwise Nop 6901 End 6902 End 6903 6904If files_different = 0 Then Call RefreshSelectedFiles 6905Return 0 6906 6907CheckOutCallback: Procedure Expose !REXXDW. !global. !!last_repository 6908checkout = 'N' 6909this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 6910If !global.!dir.!reservedcheckout.this_dir = 'Y' | !global.!reservedcheckout = 'Y' Then is_reserved_dir = 1 6911Else is_reserved_dir = 0 6912Select 6913 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 6914 Do 6915 /* TODO */ 6916 End 6917 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 6918 Do 6919 /* 6920 * It is possible the list of files contains files we cannot checkout so 6921 * do a check for each file 6922 */ 6923 Do i = 1 To !global.!current_filenames.0 6924 selected = !global.!current_indexes.i 6925 file = !global.!current_filenames.i 6926 If CanFileBeCheckedOutForLock( selected, is_reserved_dir ) Then 6927 Do 6928 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout' quote( file ) 6929 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6930 Address Command cmd With Output FIFO '' Error FIFO '' 6931 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -l' quote( file ) 6932 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6933 Address Command cmd With Output FIFO '' Error FIFO '' 6934 checkout = 'Y' 6935 End 6936 Else 6937 Do 6938 Queue 'Unable to checkout' quote( file ) 6939 End 6940 Call WriteStackToLogWindow 'default', 'Check out and lock for' quote( file ) 6941 End 6942 End 6943 Otherwise Nop 6944End 6945If checkout = 'Y' Then 6946 Do 6947 Call RefreshDirectoryIcons 6948 Call RefreshSelectedFiles 6949 Call AdjustFileToolbarList 6950 Call AdjustFileToolbarButtons 6951 End 6952Return 0 6953 6954/* 6955 * This function is called from the filemenu; undocheckout 6956 * Valid for multiple selections 6957 */ 6958UndoCheckOutCallback: Procedure Expose !REXXDW. !global. !!last_repository 6959undocheckout = 'N' 6960Select 6961 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 6962 Do 6963 /* TODO */ 6964 End 6965 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 6966 Do 6967 Do i = 1 To !global.!current_filenames.0 6968 file = !global.!current_filenames.i 6969 cvs_status = CVSStatus( file ) 6970 If cvs_status = 'Locally Modified' | cvs_status = 'Needs Merge' | cvs_status = 'File had conflicts on merge' Then 6971 Do 6972 If dw_messagebox( 'Undo Checkout?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), quote( file ) 'has been modified locally. Do you want to lose these changes ?' ) = !REXXDW.!DW_MB_RETURN_YES Then 6973 Do 6974 /* 6975 * Unlock the file... 6976 */ 6977 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -u' quote( file ) 6978 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6979 Address Command cmd With Output FIFO '' Error FIFO '' 6980 /* 6981 * Delete the file... 6982 */ 6983 Call SysFileDelete file 6984 /* 6985 * Get the latest... 6986 */ 6987 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout' quote( file ) 6988 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 6989 Address Command cmd With Output FIFO '' Error FIFO '' 6990 Call WriteStackToLogWindow 'default', 'Undo Check Out for' quote( file ) 6991 undocheckout = 'Y' 6992 End 6993 Else 6994 Do 6995 Call WriteStackToLogWindow 'default', 'Undo Check Out for' quote( file ) 'abandoned' 6996 End 6997 End 6998 Else 6999 Do 7000 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -u' quote( file ) 7001 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 7002 Address System cmd With Output FIFO '' Error FIFO '' 7003 Call WriteStackToLogWindow 'default', 'Undo Check Out for' quote( file ) 7004 undocheckout = 'Y' 7005 End 7006 End 7007 End 7008 Otherwise Nop 7009End 7010If undocheckout = 'Y' Then 7011 Do 7012 Call RefreshDirectoryIcons 7013 Call RefreshSelectedFiles 7014 Call AdjustFileToolbarList 7015 Call AdjustFileToolbarButtons 7016 End 7017Return 0 7018 7019/* 7020 * This function is called from the filemenu; checkin 7021 * Valid for multiple selections 7022 */ 7023CheckinCallback: Procedure Expose !REXXDW. !global. !!last_repository 7024same = 0 7025If !global.!current_filenames.0 > 1 Then dialog_type = 'dir' 7026Else dialog_type = 'file' 7027Select 7028 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 7029 Do cii = 1 To !global.!current_filenames.0 7030 file = RCSFileToFile( !global.!current_filenames.cii ) 7031 If Stream( file, 'C', 'QUERY EXISTS' ) = '' Then AbortText( 'Unknown file:' quote( file ) ) 7032 /* 7033 * Check if the working file is not writeable 7034 * If so, popup a dialog box asking if the 7035 * user want to checkin anyway 7036 */ 7037 If Stream( file, 'C', 'WRITABLE' ) \= 1 Then 7038 Do 7039 If TkMessageBox( '-message', 'The file you are checking in:' quote( file ) 'is not writeable. This may indicate that you are attempting to check in the wrong file. Are you sure you want to do this ?','-title', 'Checkin?', '-type', 'yesno', '-icon', 'warning') = 'yes' Then checkin = 'Y' 7040 Else checkin = 'N' 7041 End 7042 Else checkin = 'Y' 7043 /* 7044 * Check if the working file is later than the repository 7045 * file date 7046 * If so, popup a dialog box asking if the 7047 * user want to checkin anyway 7048 * etc.... 7049 */ 7050 If checkin = 'Y' Then 7051 Do 7052 /* 7053 * Get the checkin details from a new dialog box 7054 * and push the log text onto the stack 7055 */ 7056 Parse Value GetCheckinDetails( 'Y', dialog_type, file, 'Apply same text for all files', 'Checking in:' ) With cancel . 7057 If cancel = 'close' Then 7058 Do 7059 checkin = 'N' 7060 End 7061 Else 7062 Do 7063 Call RunOsCommand 'LIFO> ci -u' quote( file ) quote( current_filenames.cii ) 7064 Call WriteOutputStemsToLogWindow 'default', 'Checkin for' quote( current_filenames.cii ) 7065 End 7066 End 7067 End 7068 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 7069 Do 7070 tmpfile = GenerateTempFile() -- we delete it ourselves 7071 Do cii = 1 To !global.!current_filenames.0 7072 file = CVSFileToWorkingFile( !global.!current_filenames.cii, !!last_repository ) 7073 If Stream( file, 'C', 'QUERY EXISTS' ) = '' Then AbortText( 'Unknown file:' file ) 7074 /* 7075 * Check if the working file is not writeable 7076 * If so, popup a dialog box asking if the 7077 * user want to checkin anyway 7078 */ 7079 If Stream( file, 'C', 'WRITABLE' ) \= 1 Then 7080 Do 7081 If dw_messagebox( 'Check in?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'The file you are checking in:' quote( file ) 'is not writeable. This may indicate that you are attempting to check in the wrong file. Are you sure you want to do this ?' ) = !REXXDW.!DW_MB_RETURN_YES Then checkin = 'Y' 7082 Else checkin = 'N' 7083 End 7084 Else checkin = 'Y' 7085 /* 7086 * Ask for checkin comments for each fle unless we say we want the same comments for each file... 7087 */ 7088 If checkin = 'Y' Then 7089 Do 7090 /* 7091 * if we haven't said we want the same text for all files 7092 * checked in, Get the checkin details from a new dialog box 7093 * and push the log text onto the stack, and write a 7094 * temporary file 7095 */ 7096 If \same Then 7097 Do 7098 Parse Value Strip( GetCheckinDetails( 'Y', dialog_type, file, 'Apply same text for all files', 'Checking in:' ) ) With cancel same . 7099 If cancel = 'close' Then 7100 Do 7101 checkin = 'N' 7102 End 7103 Else 7104 Do 7105 Call Stream tmpfile, 'C', 'OPEN WRITE REPLACE' 7106 Do Queued() 7107 Parse Pull line 7108 Call Lineout tmpfile,line 7109 End 7110 Call Stream tmpfile, 'C', 'CLOSE' 7111 End 7112 End 7113 If checkin = 'Y' Then 7114 Do 7115 -- checkin could have been set to N just above 7116 Call SetCursorWait 7117 Call RunOsCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -F 'tmpfile quote( !global.!current_filenames.cii ) 7118 Call WriteCVSOutputStemsToLogWindow 'checkin',, 'Checkin for' quote( !global.!current_filenames.cii ) 7119 Call CheckForCVSConflicts 7120 Call SetCursorNoWait 7121 Drop oserr. osout. 7122 End 7123 End 7124 End 7125 Call SysFileDelete tmpfile 7126 End 7127 Otherwise Nop 7128End 7129If checkin = 'Y' Then 7130 Do 7131 Call RefreshDirectoryIcons 7132 Call RefreshSelectedFiles 7133 Call AdjustFileToolbarList 7134 Call AdjustFileToolbarButtons 7135 End 7136Return 0 7137 7138/* 7139 * Get the reminder details from a new dialog box 7140 * and write it to the reminder file 7141 */ 7142SetReminderCallback: Procedure Expose !REXXDW. !global. !!last_repository 7143reminder_file = CVSFileToReminderFile( !global.!current_filenames.1 ) 7144/* 7145 * If we have a reminder file already, read the text into !global.!reminder_text 7146 */ 7147refresh = 'N' 7148If Stream( reminder_file, 'C', 'QUERY EXISTS' ) \= '' Then 7149 Do 7150 !global.!remindertext = '' 7151 Call Stream reminder_file, 'C', 'OPEN READ' 7152 Do While Lines( reminder_file ) > 0 7153 !global.!remindertext = !global.!remindertext||Linein( reminder_file )||!global.!crlf 7154 End 7155 Call Stream reminder_file, 'C', 'CLOSE' 7156 extra_text = '' 7157 End 7158Else 7159 Do 7160 If !global.!remindertext = '' Then extra_text = '' 7161 Else extra_text = '[*** Copied from previous reminder ***]'!global.!crlf 7162 End 7163 7164Parse Value Strip( GetCheckinDetails( 'Y', 'remind', !global.!current_filenames.1, extra_text, 'Setting reminder for:' ) ) With cancel same . 7165 7166If cancel = 'close' Then 7167 Do 7168 Call WriteMessageHeaderToLogWindow 'Reminder set for' quote( !global.!current_filenames.1 ) 'cancelled.' 7169 End 7170Else 7171 Do 7172 Call Stream reminder_file, 'C', 'OPEN WRITE REPLACE' 7173 Call Charout reminder_file, !global.!remindertext 7174 Call Stream reminder_file, 'C', 'CLOSE' 7175 Call WriteMessageHeaderToLogWindow 'Reminder set for' quote( !global.!current_filenames.1 ) 7176 refresh = 'Y' 7177 End 7178 7179If refresh = 'Y' Then Call RefreshSelectedFiles 7180Return 0 7181 7182/* 7183 * This function is called from the filemenu; unremind command 7184 * Invalid for multiple selections 7185 * This command only valid for CVS 7186 */ 7187DeleteReminderCallback: Procedure Expose !REXXDW. !global. !!last_repository 7188/* 7189 * Simpy delete the reminder file if there is one... 7190 */ 7191refresh = 'N' 7192reminder_file = CVSFileToReminderFile( !global.!current_filenames.1 ) 7193If Stream( reminder_file, 'C', 'QUERY EXISTS' ) = '' Then 7194 Do 7195 Call WriteStackToLogWindow 'default', 'No reminder was set for' quote( !global.!current_filenames.1 ) 7196 End 7197Else 7198 Do 7199 If dw_messagebox( 'Delete Reminder?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'Are you sure you want to delete the reminder for' quote( !global.!current_filenames.1 )'!' ) = !REXXDW.!DW_MB_RETURN_YES Then 7200 Do 7201 Call SysFileDelete reminder_file 7202 Call WriteMessageHeaderToLogWindow 'Reminder deleted for' quote( !global.!current_filenames.1 ) 7203 refresh = 'Y' 7204 End 7205 End 7206If refresh = 'Y' Then Call RefreshSelectedFiles 7207Return 0 7208 7209/* 7210 * This function is called from the filemenu; showdifferences command 7211 * Not valid for multiple selections. Therefore current_filenames.0 MUST be 1 7212 */ 7213ShowDifferencesCallback: Procedure Expose !REXXDW. !global. !!last_repository 7214/* 7215 * Dialog box to determine how and what to show differences for... 7216 * 7217 * +---------------------------------------------------+ 7218 * | Text | 7219 * | | 7220 * +---------------------------------------------------+ 7221 * | Compare X Ignore whitespace | 7222 * | Revision _Working__v x Strict | 7223 * | in _Current__v | 7224 * | and | 7225 * | Revision _Latest___v x Output in log window | 7226 * | in _Current__v X Visual output | 7227 * | | 7228 * +---------------------------------------------------+ 7229 */ 7230text_height = 50 7231tag_types = 'tag rev' 7232Call SetCursorWait 7233/* 7234 * Check if working file exists 7235 */ 7236workingfile = CVSFileToWorkingFile( !global.!current_filenames.1, !!last_repository ) 7237If Stream( workingfile, 'C', 'QUERY EXISTS' ) \= '' Then working_file_exists = 1 7238Else working_file_exists = 0 7239/* 7240 * Create the dialog box... 7241 */ 7242win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Show differences', !global.!windowstyle ) 7243Call dw_window_set_icon win, !global.!qoccaicon 7244topbox = dw_box_new( !REXXDW.!DW_VERT ) 7245Call dw_box_pack_start win, topbox, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7246/* 7247 * Add a disabled MLE with instructions 7248 */ 7249t1 = dw_mle_new( 0 ) 7250Call dw_box_pack_start topbox, t1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7251Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 7252loc = dw_mle_import( t1, 'Select the revisions of the file to compare. Comparisons can be done ignoring whitespace or strictly. Results can be displayed in the Messages Pane or in a graphical display tool.', -1 ) 7253Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 7254Call dw_mle_set_cursor t1, loc 7255Call dw_window_disable t1 7256/* 7257 * Add a horiz box with comboboxes on left, radio buttons on right 7258 */ 7259data_box = dw_box_new( !REXXDW.!DW_HORZ ) 7260Call dw_box_pack_start topbox, data_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7261/* 7262 * Add a vertical box for the comboboxes and add the comboboxes 7263 */ 7264cb_box = dw_box_new( !REXXDW.!DW_VERT ) 7265Call dw_box_pack_start data_box, cb_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7266/* 7267 * comboboxes for later revision 7268 */ 7269cb1_box = dw_groupbox_new( !REXXDW.!DW_VERT, 'Compare (later revision)', !REXXDW.!DW_FONT_BOLD ) 7270Call dw_box_pack_start cb_box, cb1_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 7271cb1_h_box1 = dw_box_new( !REXXDW.!DW_HORZ ) 7272Call dw_box_pack_start cb1_box, cb1_h_box1, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7273tmp = dw_text_new( "Revision ", 0 ) 7274Call dw_box_pack_start cb1_h_box1, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7275Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 7276boxtopack = dw_box_new( !REXXDW.!DW_HORZ ) 7277Call dw_box_pack_start cb1_h_box1, boxtopack, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7278If working_file_exists Then 7279 Parse Value CreateFileRevisionCombobox( boxtopack, 'false', 'Working', !global.!current_filenames.1, 'Latest', tag_types, 'date' ) With rev1cbox realtagstart 7280Else 7281 Parse Value CreateFileRevisionCombobox( boxtopack, 'false', 'Latest', !global.!current_filenames.1, '', tag_types, 'date' ) With rev1cbox realtagstart 7282cb1_h_box2 = dw_box_new( !REXXDW.!DW_HORZ ) 7283Call dw_box_pack_start cb1_box, cb1_h_box2, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7284tmp = dw_text_new( "in ", 0 ) 7285Call dw_box_pack_start cb1_h_box2, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7286Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 7287rep1cbox = CreateRepositoryCombobox( cb1_box, 'false', 'Current Repository', rev1cbox, realtagstart, !global.!current_filenames.1, tag_types ) 7288Call dw_box_pack_start cb1_h_box2, rep1cbox, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7289 7290cb2_box = dw_groupbox_new( !REXXDW.!DW_VERT, 'with (earlier revision)', !REXXDW.!DW_FONT_BOLD ) 7291Call dw_box_pack_start cb_box, cb2_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 7292cb2_h_box1 = dw_box_new( !REXXDW.!DW_HORZ ) 7293Call dw_box_pack_start cb2_box, cb2_h_box1, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7294tmp = dw_text_new( "Revision ", 0 ) 7295Call dw_box_pack_start cb2_h_box1, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7296Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 7297boxtopack = dw_box_new( !REXXDW.!DW_HORZ ) 7298Call dw_box_pack_start cb2_h_box1, boxtopack, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7299If working_file_exists Then 7300 Parse Value CreateFileRevisionCombobox( boxtopack, 'false', 'Latest', !global.!current_filenames.1, 'Working', tag_types, 'date' ) With rev2cbox realtagstart 7301Else 7302 Parse Value CreateFileRevisionCombobox( boxtopack, 'false', 'Latest', !global.!current_filenames.1, '', tag_types, 'date' ) With rev2cbox realtagstart 7303cb2_h_box2 = dw_box_new( !REXXDW.!DW_HORZ ) 7304Call dw_box_pack_start cb2_box, cb2_h_box2, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7305tmp = dw_text_new( "in ", 0 ) 7306Call dw_box_pack_start cb2_h_box2, tmp, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7307Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 7308rep2cbox = CreateRepositoryCombobox( cb2_box, 'false', 'Current Repository', rev2cbox, realtagstart, !global.!current_filenames.1, tag_types ) 7309Call dw_box_pack_start cb2_h_box2, rep2cbox, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 7310 7311/* 7312 * Add a vertical box for the two groups of radio buttons and add the radio buttons 7313 */ 7314group_box = dw_box_new( !REXXDW.!DW_VERT ) 7315Call dw_box_pack_start data_box, group_box, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7316 7317g1 = dw_groupbox_new( !REXXDW.!DW_VERT, 'Comparison', !REXXDW.!DW_FONT_BOLD ) 7318Call dw_box_pack_start group_box, g1, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 7319compare_rb1 = dw_radiobutton_new( 'Ignore whitespace', 111 ) 7320Call dw_box_pack_start g1, compare_rb1, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 7321compare_rb2 = dw_radiobutton_new( 'Strict', 111 ) 7322Call dw_box_pack_start g1, compare_rb2, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 7323Call dw_radiobutton_set compare_rb1, !REXXDW.!DW_CHECKED 7324 7325g2 = dw_groupbox_new( !REXXDW.!DW_VERT, 'Output to', !REXXDW.!DW_FONT_BOLD ) 7326Call dw_box_pack_start group_box, g2, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 7327output_rb1 = dw_radiobutton_new( 'Log window', 222 ) 7328Call dw_box_pack_start g2, output_rb1, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 7329output_rb2 = dw_radiobutton_new( 'Visual', 222 ) 7330Call dw_box_pack_start g2, output_rb2, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 7331Call dw_radiobutton_set output_rb2, !REXXDW.!DW_CHECKED 7332/* 7333 * Create Cancel and Apply buttons 7334 */ 7335b1 = dw_button_new( 'Apply', 0 ) 7336Call dw_box_pack_start topbox, b1, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7337 7338b2 = dw_button_new( 'Cancel', 0 ) 7339Call dw_box_pack_start topbox, b2, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7340/* 7341 * Display the window 7342 */ 7343Call dw_window_set_gravity win, !REXXDW.!DW_GRAV_CENTRE, !REXXDW.!DW_GRAV_CENTRE 7344Call dw_window_set_pos_size win, 0, 0, 0, 0 7345Call dw_window_show win 7346 7347Do Forever 7348 /* 7349 * Create a dialog for the window 7350 */ 7351 dialog_wait = dw_dialog_new( ) 7352 /* 7353 * We now have everything setup, we can connect the destroying of the top-level window 7354 * to the 'close' callback 7355 */ 7356 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'ShowDifferencesApplyCallback', win, dialog_wait, rev1cbox, rev2cbox, rep1cbox, rep2cbox, compare_rb1, compare_rb2, output_rb1, output_rb2 7357 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 7358 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 7359 /* 7360 * Wait for the dialog to come back 7361 */ 7362/* Parse Value dw_dialog_wait( dialog_wait ) With cancel ':' rev1 ':' rev2 ':' rep1 ':' rep2 ':' rep1_idx ':' rep2_idx ':' difftype ':' outputtype*/ 7363if trace() = 'F' Then say cancel rev1 rev2 rep1 rep2 rep1_idx rep2_idx difftype outputtype 7364 cancel = dw_dialog_wait( dialog_wait ) 7365 /* 7366 * All successful processing done in the 'applycallback', so simply get 7367 * out of the loop if we don't have any validation issues 7368 */ 7369 If cancel \= 'retry' Then Leave 7370End 7371/* 7372 * If we selected 'Cancel' return now 7373If cancel = 'close' Then Return 0 7374 */ 7375Return 0 7376 7377ShowAnnotationsCallback: Procedure Expose !REXXDW. !global. !!last_repository 7378/* 7379 * +-----------------------------------------------------------------+-+ 7380 * + Rel | User | Date | Line| contents | | 7381 * +------------------------------------------------------------------+-+ 7382 * + | | | | |^| 7383 * + | | | | |v| 7384 * +------------------------------------------------------------------+ + 7385 * + Line:___________ |< >| | 7386 * +-----------------------------------------------------------------+ + 7387 */ 7388/* 7389 * Get the revision of the file to show 7390 */ 7391Call SetCursorWait 7392Call DisplayStatus 'Preparing annotations...' 7393 7394rev = GetFileRevisions( !global.!current_filenames.1, 'Show Annotations', 'rev tag', 'date', 'Latest' ) 7395If rev = '' Then Return 0 7396/* 7397 * Read the file into a stem, parse all lines of the stem to determine the 7398 * width of all of the text boxes... 7399 */ 7400Select 7401 When Words( rev ) = 3 Then rev_flag = '-D'rev 7402 When rev = 'Latest' Then rev_flag = '' 7403 Otherwise rev_flag = '-r'rev 7404End 7405If !REXXDW.!GTK_MAJOR_VERSION > 1 Then 7406 Do 7407 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q annotate' rev_flag quote( !global.!current_filenames.1 ) '| iconv -f ISO-8859-1 -t UTF-8' 7408 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 7409 Address System cmd With Output Stem file. Error Stem err. 7410 End 7411Else 7412 Do 7413 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q annotate' rev_flag quote( !global.!current_filenames.1 ) 7414 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 7415 Address Command cmd With Output Stem file. Error Stem err. 7416 End 7417If file.0 = 0 Then 7418 Do 7419 Return 0 7420 End 7421 7422/* 7423 * If there is a valid syntax for the file's extension, use this 7424 */ 7425pos = Lastpos( '.', !global.!current_filenames.1 ) 7426If pos \= 0 & !global.!have_highlight Then 7427 Do 7428 syntax = FindSyntax( Substr( !global.!current_filenames.1, pos+1 ) ) 7429 If syntax = '' Then syntax_flags = '' 7430 Else syntax_flags = '-S' syntax 7431 End 7432Else syntax_flags = '' 7433 7434/* 7435 * If we can use syntax highlighting, then do so 7436 */ 7437If syntax_flags \= '' Then 7438 Do 7439 tmpfile = GenerateTempFile( '??shan??' ) 7440 Call Stream tmpfile, 'C', 'OPEN WRITE REPLACE' 7441 !global.!showannotations.!have_syntax = 1 7442 End 7443Else !global.!showannotations.!have_syntax = 0 7444 7445max_rel = 0 7446max_user = 0 7447max_date = 9 7448max_line = 0 7449max_numb = 4 /* length of header label */ 7450/* 7451 * Do some calculation of maximum widths of the columns and copy the 7452 * local stem into a global one so that the callbacks can see the data 7453 * Date is fixed length, and the linenumber will be the length of file.0 7454 */ 7455If Length( file.0 ) > max_numb Then max_numb = Length( file.0 ) 7456Do i = 1 To file.0 7457 Parse Var file.i rel '(' user date '): ' line 7458 !global.!showannotations.1.i = Strip( rel ) 7459 !global.!showannotations.2.i = Strip( user ) 7460 !global.!showannotations.3.i = Strip( date ) 7461 !global.!showannotations.4.i = Right( i, max_numb ) 7462 If syntax_flags = '' Then !global.!showannotations.5.i = line 7463 Else Call Lineout tmpfile, line 7464/* Else Call Lineout tmpfile,dw_convert('ISO-8859-1', 'UTF-8', line )*/ 7465/* Else Call Lineout tmpfile,Changestr( ' ', line, ' ')*/ 7466/* WARNING **: Invalid UTF8 string passed to pango_layout_set_text() */ 7467 If Length( !global.!showannotations.1.i ) > max_rel Then max_rel = Length( !global.!showannotations.1.i ) 7468 If Length( !global.!showannotations.2.i ) > max_user Then max_user = Length( !global.!showannotations.2.i ) 7469 If Length( line ) > max_line Then max_line = Length( line ) 7470End 7471!global.!showannotations.1.0 = file.0 7472!global.!showannotations.2.0 = file.0 7473!global.!showannotations.3.0 = file.0 7474!global.!showannotations.4.0 = file.0 7475!global.!showannotations.5.0 = file.0 7476!global.!showannotations.!max_width.1 = max_rel 7477!global.!showannotations.!max_width.2 = max_user 7478!global.!showannotations.!max_width.3 = max_date 7479!global.!showannotations.!max_width.4 = max_numb 7480!global.!showannotations.!max_width.5 = max_line 7481Drop file. 7482/* 7483 * Close the temporary file if we are processing syntax 7484 */ 7485If syntax_flags \= '' Then 7486 Do 7487 Call Stream tmpfile, 'C', 'CLOSE' 7488 Call DisplayStatus 'Syntax highlighting...' 7489 Parse Value GetHighlightedLines( tmpfile, syntax_flags, '!GLOBAL.!SHOWANNOTATIONS.5.' ) With !global.!showannotations.!default_fore !global.!showannotations.!default_back 7490 Call SysFileDelete tmpfile 7491 Drop high. 7492 End 7493Else 7494 Do 7495 !global.!showannotations.!default_fore = !REXXDW.!DW_CLR_BLACK 7496 !global.!showannotations.!default_back = !REXXDW.!DW_CLR_WHITE 7497 End 7498 7499title.1 = 'Rel' 7500title.2 = 'User' 7501title.3 = 'Date' 7502title.4 = 'Line' 7503title.5 = 'File Contents' 7504 7505/* 7506 * Build our window and all the boxes 7507 */ 7508scrollbarwidth = 14 7509scrollbarheight = 14 7510scrollbarspace = !global.!widgetheight - scrollbarheight 7511win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Annotations for' !global.!current_filenames.1'('rev')', !global.!windowstyle ) 7512Call dw_window_set_icon win, !global.!qoccaicon 7513topbox = dw_box_new( !REXXDW.!DW_VERT ) 7514Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7515 7516depth = dw_color_depth_get() 7517/* 7518 * Work out font sizing 7519 */ 7520junk = dw_render_new( 0 ) 7521Call dw_window_set_font junk, !global.!fixedfont 7522Parse Value dw_font_text_extents_get( junk, , "g(" ) With font_width font_height 7523Call dw_window_destroy junk 7524font_width = ( font_width / 2 ) % 1 -- ensure font is whole number 7525!global.!showannotations.!font_width = font_width 7526!global.!showannotations.!font_height = font_height 7527!global.!showannotations.!current_row = 0 7528!global.!showannotations.!current_col = 0 7529 7530spinbutton_title_width = 70 7531spinbutton_width = (max_rel*font_width) + (max_user*font_width) + (max_date*font_width) + (max_numb*font_width) - 40 7532 7533tophbox = dw_box_new( !REXXDW.!DW_HORZ ) 7534Call dw_box_pack_start topbox, tophbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7535/* 7536 * A vertical box for the fixed width render boxes and the line number spinbutton 7537 */ 7538fixedbox = dw_box_new( !REXXDW.!DW_VERT ) 7539Call dw_box_pack_start tophbox, fixedbox, 0, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7540/* 7541 * A horizontal box for the fixed width columns 7542 */ 7543hbox = dw_box_new( !REXXDW.!DW_HORZ ) 7544Call dw_box_pack_start fixedbox, hbox, 0, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7545/* 7546 * Columns for fixed columns... 7547 */ 7548Do i = 1 To 4 7549 /* 7550 * Pack some empty space before the column 7551 */ 7552 Call dw_box_pack_start hbox, 0, 5, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7553 box = dw_box_new( !REXXDW.!DW_VERT ) 7554 !global.!showannotations.!pixmap_width.i = !global.!showannotations.!max_width.i*font_width 7555 Call dw_box_pack_start hbox, box, !global.!showannotations.!pixmap_width.i, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7556 header = dw_text_new( title.i, i ) 7557 Call dw_box_pack_start box, header, !global.!showannotations.!pixmap_width.i, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7558 Call dw_window_set_style header, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 7559 !global.!showannotations.!pixmapbox.i = dw_render_new( i+10 ) 7560 Call dw_window_set_font !global.!showannotations.!pixmapbox.i, !global.!fixedfont 7561 Call dw_box_pack_start box, !global.!showannotations.!pixmapbox.i, !global.!showannotations.!pixmap_width.i, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7562End 7563/* 7564 * Spinbutton 7565 */ 7566spinbuttonbox = dw_box_new( !REXXDW.!DW_HORZ ) 7567Call dw_box_pack_start fixedbox, spinbuttonbox, spinbutton_width+spinbutton_title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7568linebutton = dw_button_new( 'Goto Line:', 0 ) 7569Call dw_box_pack_start spinbuttonbox, linebutton, spinbutton_title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7570sb = dw_spinbutton_new( '', 0 ) 7571Call dw_box_pack_start spinbuttonbox, sb, spinbutton_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7572Call dw_spinbutton_set_limits sb, !global.!showannotations.5.0, 1 7573Call dw_spinbutton_set_pos sb, 1 7574/* 7575 * Build our boxes for the file contents 7576 */ 7577hbox = dw_box_new( !REXXDW.!DW_HORZ ) 7578Call dw_box_pack_start tophbox, hbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7579 7580vertbox = dw_box_new( !REXXDW.!DW_VERT ) 7581Call dw_box_pack_start hbox, vertbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7582 7583header = dw_text_new( title.5, 0 ) 7584Call dw_box_pack_start vertbox, header, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7585Call dw_window_set_style header, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 7586 7587!global.!showannotations.!pixmap_width.5 = !global.!showannotations.!max_width.5*font_width 7588 7589/* create render box for filedetails pixmap */ 7590!global.!showannotations.!pixmapbox.5 = dw_render_new( 0 ) 7591Call dw_box_pack_start vertbox, !global.!showannotations.!pixmapbox.5, font_width, font_height, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7592Call dw_window_set_font !global.!showannotations.!pixmapbox.5, !global.!fixedfont 7593 7594/* create horizonal scrollbar */ 7595!global.!showannotations.!hbar = dw_scrollbar_new( !REXXDW.!DW_HORZ, 0 ) 7596Call dw_box_pack_start vertbox, !global.!showannotations.!hbar, 0, scrollbarheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7597Call dw_box_pack_start vertbox, 0, 0, scrollbarspace, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7598 7599vscrollbox = dw_box_new( !REXXDW.!DW_VERT ) 7600Call dw_box_pack_start hbox, vscrollbox, scrollbarwidth, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7601/* Pack an area of empty space above the scrollbar */ 7602Call dw_box_pack_start vscrollbox, 0, scrollbarwidth, scrollbarspace+scrollbarheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7603!global.!showannotations.!vbar = dw_scrollbar_new( !REXXDW.!DW_VERT, 0 ) 7604Call dw_box_pack_start vscrollbox, !global.!showannotations.!vbar, scrollbarwidth, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 7605/* Pack an area of empty space below the scrollbar */ 7606Call dw_box_pack_start vscrollbox, 0, scrollbarwidth, scrollbarspace+scrollbarheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7607/* 7608 * Create default pixmaps and connect our signals 7609 */ 7610Do i = 1 To 5 7611 !global.!showannotations.!pixmap.i = dw_pixmap_new( !global.!showannotations.!pixmapbox.i, font_width, font_height, depth ) 7612 Call dw_signal_connect !global.!showannotations.!pixmapbox.i, !REXXDW.!DW_EXPOSE_EVENT, 'ShowAnnotationsExposeCallback', i 7613 Call dw_signal_connect !global.!showannotations.!pixmapbox.i, !REXXDW.!DW_CONFIGURE_EVENT, 'ShowAnnotationsConfigureCallback', i 7614End 7615 7616Call dw_signal_connect !global.!showannotations.!hbar, !REXXDW.!DW_VALUE_CHANGED_EVENT, 'ShowAnnotationsValueChangedCallback' 7617Call dw_signal_connect !global.!showannotations.!vbar, !REXXDW.!DW_VALUE_CHANGED_EVENT, 'ShowAnnotationsValueChangedCallback' 7618-- connect keypress to toplevel window 7619Call dw_signal_connect win, !REXXDW.!DW_KEY_PRESS_EVENT, 'ShowAnnotationsKeyPressCallback', win 7620/* 7621* Create a dialog for the window 7622*/ 7623dialog_wait = dw_dialog_new( ) 7624/* 7625* Create Done button 7626*/ 7627b1 = dw_button_new( 'OK', 0 ) 7628Call dw_box_pack_start topbox, b1, 400, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 7629Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 7630/* 7631 * We now have everything setup, we can connect the destroying of the top-level window 7632 * to the 'close' callback 7633 */ 7634Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 7635Call dw_signal_connect linebutton, !REXXDW.!DW_CLICKED_EVENT, 'ShowAnnotationsGotoLineCallback', sb 7636/* 7637 * Set the Goto Line button be the default for ENTER 7638 */ 7639Call dw_window_click_default sb, linebutton 7640/* 7641 * Reset status 7642 */ 7643Call SetCursorNoWait 7644Call DisplayStatus '' 7645/* 7646 * Display the window 7647 */ 7648width = (!global.!screen_width % 3) * 2 7649height = (!global.!screen_height % 3) * 2 7650Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 7651Call dw_window_show win 7652/* 7653 * Wait for the dialog to come back 7654 */ 7655Call dw_dialog_wait dialog_wait 7656 7657Drop !global.!showannotations.!rel. !global.!showannotations.!user. !global.!showannotations.!date. !global.!showannotations.!line. 7658Return 0 7659 7660ShowAnnotationsGotoLineCallback: Procedure Expose !REXXDW. !global. !!last_repository 7661Parse Arg button, line_sb 7662lineno = dw_spinbutton_get_pos( line_sb ) - 1 7663lineno = lineno - (!global.!showannotations.!rows % 2) 7664If lineno < 0 Then lineno = 0 7665Call ShowAnnotationsValueChangedCallback !global.!showannotations.!vbar, lineno 7666Return 0 7667 7668ShowAnnotationsConfigureCallback: Procedure Expose !REXXDW. !global. !!last_repository 7669Parse Arg win, width, height, box 7670if trace() = 'F' Then say 'got ShowAnnotationsConfigureCallback' win width height box 7671depth = dw_color_depth_get() 7672 7673!global.!showannotations.!rows = height % !global.!showannotations.!font_height 7674!global.!showannotations.!height = height 7675 7676/* Destroy the old pixmap */ 7677Call dw_pixmap_destroy !global.!showannotations.!pixmap.box 7678 7679If box = 5 Then 7680 Do 7681 !global.!showannotations.!viewport_cols = width % !global.!showannotations.!font_width 7682 !global.!showannotations.!viewport_width = width 7683 End 7684/* Create new pixmap with the current sizes */ 7685!global.!showannotations.!pixmap.box = dw_pixmap_new( !global.!showannotations.!pixmapbox.box, !global.!showannotations.!pixmap_width.box, !global.!showannotations.!height, depth ) 7686/* Update scrollbar ranges with new values if its the file contents box */ 7687If box = 5 Then 7688 Do 7689 Call dw_scrollbar_set_range !global.!showannotations.!hbar, !global.!showannotations.!max_width.5, !global.!showannotations.!viewport_cols 7690 Call dw_scrollbar_set_range !global.!showannotations.!vbar, !global.!showannotations.5.0, !global.!showannotations.!rows 7691 End 7692 7693/* Redraw the window */ 7694Call DisplayAnnotations box 7695Return 0 7696 7697ShowAnnotationsExposeCallback: Procedure Expose !REXXDW. !global. !!last_repository 7698Parse Arg win, junk, junk, junk, junk, box 7699if trace() = 'F' Then say 'got ShowAnnotationsExposeCallback' box 7700pixmap = !global.!showannotations.!pixmap.box 7701If box = 5 Then x = !global.!showannotations.!current_col * !global.!showannotations.!font_width 7702Else x = 0 7703 7704Parse Value dw_window_get_pos_size( win ) With . . width height 7705 7706Call dw_pixmap_bitblt win, , 0, 0, width, height, , pixmap, x, 0 7707Call dw_flush 7708Return 0 7709 7710ShowAnnotationsValueChangedCallback: Procedure Expose !REXXDW. !global. !!last_repository 7711Parse Arg win, value 7712If win = !global.!showannotations.!vbar Then 7713 Do 7714 !global.!showannotations.!current_row = value 7715 Call dw_scrollbar_set_pos !global.!showannotations.!vbar, value 7716 End 7717Else 7718 Do 7719 !global.!showannotations.!current_col = value 7720 Call dw_scrollbar_set_pos !global.!showannotations.!hbar, value 7721 End 7722 7723Do i = 1 To 5 7724 Call DisplayAnnotations i 7725End 7726Return 0 7727 7728/* 7729 * Handle keypress events for ShowAnnotations 7730 * Trap those that adjust the vertical position of the file; PgUp, PgDn, Up, Down 7731 * Return 1 to indicate we have handled the key, otherwise return 0 to pass on to 7732 * the focus window; in this case the spinbutton where the linenumber can be specified. 7733 */ 7734ShowAnnotationsKeyPressCallback: Procedure Expose !REXXDW. !global. !!last_repository 7735Parse Arg window, key, virtual_key, state, topwin 7736max_rows = !global.!showannotations.1.0 7737rcode = 0 7738Select 7739 When window = topwin Then 7740 Do 7741 Select 7742 When virtual_key = !REXXDW.!DW_VK_PRIOR Then 7743 Do 7744 pos = Max( 0, !global.!showannotations.!current_row - !global.!showannotations.!rows ) 7745 Call ShowAnnotationsValueChangedCallback !global.!showannotations.!vbar, pos 7746 Call ShowAnnotationsValueChangedCallback !global.!showannotations.!vbar, pos 7747 rcode = 1 7748 End 7749 When virtual_key = !REXXDW.!DW_VK_NEXT Then 7750 Do 7751 pos = Min( max_rows - !global.!showannotations.!rows, !global.!showannotations.!current_row + !global.!showannotations.!rows ) 7752 If pos > 0 Then 7753 Do 7754 Call ShowAnnotationsValueChangedCallback !global.!showannotations.!vbar, pos 7755 Call ShowAnnotationsValueChangedCallback !global.!showannotations.!vbar, pos 7756 End 7757 rcode = 1 7758 End 7759 When virtual_key = !REXXDW.!DW_VK_UP Then 7760 Do 7761 pos = Max( 0, !global.!showannotations.!current_row - 1 ) 7762 Call ShowAnnotationsValueChangedCallback !global.!showannotations.!vbar, pos 7763 Call ShowAnnotationsValueChangedCallback !global.!showannotations.!vbar, pos 7764 rcode = 1 7765 End 7766 When virtual_key = !REXXDW.!DW_VK_DOWN Then 7767 Do 7768 pos = Min( max_rows - !global.!showannotations.!rows, !global.!showannotations.!current_row + 1 ) 7769 If pos > 0 Then 7770 Do 7771 Call ShowAnnotationsValueChangedCallback !global.!showannotations.!vbar, pos 7772 Call ShowAnnotationsValueChangedCallback !global.!showannotations.!vbar, pos 7773 End 7774 rcode = 1 7775 End 7776 Otherwise Nop 7777 End 7778 End 7779 Otherwise Nop 7780End 7781Return rcode 7782 7783DisplayAnnotations: Procedure Expose !REXXDW. !global. !!last_repository 7784Parse Arg box 7785if trace() = 'F' Then say 'got displayannotations' box 7786If box = 5 Then Call dw_color_foreground_set !global.!showannotations.!default_back 7787Else Call dw_color_foreground_set !REXXDW.!DW_CLR_WHITE 7788Call dw_draw_rect 0, !global.!showannotations.!pixmap.box, !REXXDW.!DW_FILL, 0, 0, !global.!showannotations.!pixmap_width.box, !global.!showannotations.!height 7789Call dw_color_background_set !REXXDW.!DW_CLR_WHITE 7790Call dw_color_foreground_set !REXXDW.!DW_CLR_BLACK 7791Do i = 1 To !global.!showannotations.!rows+1 While(i+!global.!showannotations.!current_row) < !global.!showannotations.box.0 + 1 7792 y = (i-1)*!global.!showannotations.!font_height 7793 fileline = i + !global.!showannotations.!current_row 7794 If !global.!showannotations.!have_syntax & box = 5 Then Call WriteAnnotationsTextLine y, !global.!showannotations.box.fileline 7795 Else Call dw_draw_text 0, !global.!showannotations.!pixmap.box, 0, y, !global.!showannotations.box.fileline 7796End 7797Call ShowAnnotationsExposeCallback !global.!showannotations.!pixmapbox.box, 0, 0, 0, 0, box 7798Return 7799 7800WriteAnnotationsTextLine: Procedure Expose !REXXDW. !global. !!last_repository 7801Parse Arg y, fileline 7802/* 7803 * Start each line with the default colour and font 7804 */ 7805Call dw_color_background_set !global.!showannotations.!default_back 7806Call dw_color_foreground_set !REXXDW.!DW_CLR_BLACK 7807If !REXXDW.!GTK_MAJOR_VERSION < 2 Then Call dw_window_set_font !global.!showannotations.!pixmapbox.5, !global.!fixedfont 7808/* 7809 * Now split the line up at each <span> 7810 */ 7811x = 0 7812Do Forever 7813 If Left( fileline, 13 ) = '<span class="' Then 7814 Do 7815 Parse Var fileline '<span class="hl ' class '">' fragment '</span>' fileline 7816 Call dw_color_foreground_set !global.!syntax.!color.class 7817 If !REXXDW.!GTK_MAJOR_VERSION < 2 Then Call dw_window_set_font !global.!showannotations.!pixmapbox.5, !global.!syntax.!font.class 7818 End 7819 Else 7820 Do 7821 Parse Var fileline fragment '<span class="hl ' fileline 7822 If Strip( fileline ) \= '' Then fileline = '<span class="hl 'fileline 7823 Call dw_color_foreground_set !global.!showannotations.!default_fore 7824 If !REXXDW.!GTK_MAJOR_VERSION < 2 Then Call dw_window_set_font !global.!showannotations.!pixmapbox.5, !global.!fixedfont 7825 End 7826 fragment = ConvertHTMLMnemonics( fragment ) 7827 Call dw_draw_text 0, !global.!showannotations.!pixmap.5, x, y, fragment 7828 x = x + !global.!showannotations.!font_width * Length( fragment ) 7829 If fileline = '' Then Leave 7830End 7831Return 7832 7833/* 7834 * This function is called from the filemenu; Delete From Repository command 7835 * Admin command only 7836 * Valid for multiple selections. 7837 * Only valid for Repository and Non-repository files 7838 */ 7839DeleteFromRepositoryCallback: Procedure Expose !REXXDW. !global. !!last_repository 7840If !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then 7841 Do 7842 /* 7843 * This is done when deleting from the repository... 7844 */ 7845 If dw_messagebox( 'Delete ?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'Do you want to delete the selected files from the repository?' ) = !REXXDW.!DW_MB_RETURN_NO Then Return 0 7846 Select 7847 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 7848 Do 7849 Call SysFileDelete !global.!current_filenames.1 7850 Call WriteStackToLogWindow 'default', quote( !global.!current_filenames.1 ) 'permanently deleted' 7851 Call RefreshFilesCallback 7852 End 7853 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 7854 Do 7855 current_filenames = '' 7856 Do i = 1 To !global.!current_filenames.0 7857 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'delete -f' quote( !global.!current_filenames.i ) 7858 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 7859 Address Command cmd With Output FIFO '' Error FIFO '' 7860 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -m "*** File Deleted ***"' quote( !global.!current_filenames.i ) 7861 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 7862 Address Command cmd With Output FIFO '' Error FIFO '' 7863 current_filenames = current_filenames quote( !global.!current_filenames.i ) 7864 End 7865 Call WriteStackToLogWindow 'default', current_filenames 'deleted' 7866 Call RefreshFilesCallback 7867 Call DisplayDeletedFiles 7868 End 7869 Otherwise Nop 7870 End 7871 End 7872Else 7873 Do 7874 /* 7875 * This is done when deleting from working directory... 7876 */ 7877 If dw_messagebox( 'Delete ?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'Do you want to delete the selected files from your working directory?' ) = !REXXDW.!DW_MB_RETURN_NO Then Return 0 7878 current_filenames = '' 7879 /* 7880 * For each selected file or directory, try and delete it. 7881 */ 7882 Do i = 1 To !global.!current_nonrepindexes.0 7883 selected = !global.!current_nonrepindexes.i 7884 selected_file = Substr( !global.!nonrepfiles.?fullfilename.!!last_repository.selected, 5 ) 7885 filetype = Substr( !global.!nonrepfiles.?filetype.!!last_repository.selected, 5 ) 7886 If filetype = 'dir' Then Address Command !global.!cmddelr quote( selected_file ) 7887 Else Call SysFileDelete selected_file 7888 current_filenames = current_filenames quote( !global.!current_nonrepfilenames.i ) 7889 End 7890 /* 7891 * If we deleted at least one file, list it. 7892 */ 7893 If current_filenames \= ''Then Call WriteStackToLogWindow 'default', current_filenames 'deleted' 7894 Call RefreshFilesCallback 7895 End 7896Return 0 7897 7898/* 7899 * These callbacks are not called directly by a button, or a menu. 7900 */ 7901GetFileRevisionsApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 7902Parse Arg button, window, dialog, combobox 7903str = dw_window_get_text( combobox ) 7904if trace() = 'F' Then say 'got getfilerevisionsapply' 'value' str 'from' combobox 7905Call dw_window_destroy window 7906/* 7907 * If the user wants to select a date... 7908 */ 7909If Left( str, 5 ) = 'Date:' Then str = 'Date:'Date( 'S', SubWord( str, 2 ), 'N' ) 7910Call dw_dialog_dismiss dialog, 'apply' str 7911Return 0 7912 7913GetFileRevisionsAndDestinationApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 7914Parse Arg button, window, dialog, combobox, entrybox 7915str = dw_window_get_text( combobox ) 7916dest = dw_window_get_text( entrybox ) 7917If dest = '' Then 7918 Do 7919 Call dw_messagebox 'No destination', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'No destination was selected.' 7920 Call dw_window_destroy window 7921 Call dw_dialog_dismiss dialog, '' 7922 Return 0 7923 End 7924/* 7925 * If the user wants to select a date... 7926 */ 7927If Left( str, 5 ) = 'Date:' Then str = 'Date:'Date( 'S', SubWord( str, 2 ), 'N' ) 7928Call dw_window_destroy window 7929Call dw_dialog_dismiss dialog, 'apply' str dest 7930Return 0 7931 7932GenericDirectorySelector: Procedure Expose !REXXDW. !global. !!last_repository 7933Parse Arg button, entrybox, title 7934/* 7935 * dw_file_browse() at least under Windows changes directory! 7936 */ 7937here = Directory() 7938dir = Strip( dw_file_browse( title, '', , !REXXDW.!DW_DIRECTORY_OPEN ) ) 7939If dir \= '' Then Call dw_window_set_text entrybox, dir 7940Call Directory here 7941Return 0 7942 7943GenericFileSelector: Procedure Expose !REXXDW. !global. !!last_repository 7944Parse Arg button, entrybox, title, default_dir, converttoshort, mode, extension 7945if trace() = 'F' Then say 'default' default_dir 7946/* 7947 * dw_file_browse() at least under Windows changes directory! 7948 */ 7949here = Directory() 7950dir = Strip( dw_file_browse( title, default_dir, extension, mode ) ) 7951If dir \= '' Then 7952 Do 7953 If !global.!os = 'WIN32' & converttoshort Then 7954 Do 7955 dir = w32sysshortfilename( dir ) 7956 End 7957 Call dw_window_set_text entrybox, dir 7958 End 7959Call Directory here 7960Return 0 7961 7962GetFileRevisionsDateSelector: Procedure Expose !REXXDW. !global. !!last_repository 7963Parse Arg button, entrybox 7964date = Strip( SelectDate() ) 7965If date \= '' Then 7966 Do 7967 date = 'Date:' date 7968 Call dw_window_set_text entrybox, date 7969 End 7970Return 0 7971 7972DateSelectorApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 7973Parse Arg button, window, dialog, day_sb, month_cb, year_sb 7974day = Right( dw_spinbutton_get_pos( day_sb ), 2, 0 ) 7975mon = Right( 1 + dw_listbox_selected( month_cb ), 2, 0 ) 7976year = dw_spinbutton_get_pos( year_sb ) 7977Call dw_window_destroy window 7978/* 7979 * Check the date is valid 7980 */ 7981Signal on Syntax Name ds_syntax 7982return_date = Date( 'N', year||mon||day, 'S' ) 7983if trace() = 'F' Then say 'return date' return_date 7984Call dw_dialog_dismiss dialog, 'apply' return_date 7985Signal ds_cont 7986ds_syntax: 7987Call dw_messagebox 'Invalid Date', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), 'The date selected is invalid.' 7988Call dw_dialog_dismiss dialog, '' 7989Signal Off Syntax 7990ds_cont: 7991Return 0 7992 7993CalendarSelectorApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 7994Parse Arg ., window, dialog, cal 7995/* 7996 * Get the date value 7997 */ 7998newdate = dw_calendar_get_date( cal ) 7999Call dw_dialog_dismiss dialog, 'apply' Date( 'N', newdate, 'S' ) 8000/* 8001 * Destroy the window 8002 */ 8003Call dw_window_destroy window 8004Return 0 8005 8006/* 8007 * Callback for checkin, add, and setreminder 8008 */ 8009GetCheckinDetailsApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 8010Parse Arg ., window, dialog, text_handle, cb_handle, want_text_win, type 8011if trace() = 'F' Then say 'window' window 'text_handle' text_handle 'cb_handle' cb_handle 'want_text_win' want_text_win 'type' type 8012cancel = 'apply' 8013If want_text_win = 'Y' & cancel = 'apply'Then 8014 Do 8015 Select 8016 When type = 'add' Then 8017 Do 8018 !global.!addfile_text = dw_window_get_text( text_handle ) 8019 If !global.!addfile_text = '' Then 8020 Do 8021 Call dw_messagebox 'No comment', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'You must enter a description.' 8022 cancel = 'retry' 8023 End 8024 Else 8025 Do 8026 cancel = 'apply' 8027 End 8028 End 8029 When type = 'remind' Then 8030 Do 8031 !global.!remindertext = dw_mle_export( text_handle ) 8032 cancel = 'apply' 8033 End 8034 Otherwise 8035 Do 8036 !global.!checkin_text = dw_mle_export( text_handle ) 8037 If !global.!checkin_text = '' Then 8038 Do 8039 Call dw_messagebox 'No comment', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), 'You must enter a comment.' 8040 cancel = 'retry' 8041 End 8042 Else 8043 Do 8044 cancel = 'apply' 8045 Queue !global.!checkin_text 8046 End 8047 End 8048 End 8049 End 8050If type = 'dir' | type = 'delete' | type = 'add' Then same = dw_checkbox_get( cb_handle ) 8051Else same = 0 8052 8053Call dw_dialog_dismiss dialog, cancel same 8054If cancel = 'apply' Then Call dw_window_destroy window 8055Return 0 8056 8057ShowDifferencesApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 8058Parse Arg button, window, dialog, rev1cbox, rev2cbox, rep1cbox, rep2cbox, compare_rb1, compare_rb2, output_rb1, output_rb2 8059rev1 = dw_window_get_text( rev1cbox ) 8060rev2 = dw_window_get_text( rev2cbox ) 8061rep1 = dw_window_get_text( rep1cbox ) 8062rep2 = dw_window_get_text( rep2cbox ) 8063If dw_radiobutton_get( compare_rb1 ) Then difftype = 'ignorewhitespace' 8064Else difftype = '' 8065If dw_radiobutton_get( output_rb1 ) Then outputtype = 'logwindow' 8066Else outputtype = '' 8067/* 8068 * Get the repository indexes 8069 */ 8070rep1_idx = 0 8071rep2_idx = 0 8072Do i = 1 To !global.!!number_repositories 8073 If !global.!!repository.!!name.i = rep1 Then rep1_idx = i 8074 If !global.!!repository.!!name.i = rep2 Then rep2_idx = i 8075End 8076If rep1 = 'Current Repository' Then rep1_idx = !!last_repository 8077If rep2 = 'Current Repository' Then rep2_idx = !!last_repository 8078If rev1 \= 'Latest' & rev1 \= 'Working' & rep1_idx \= !!last_repository Then 8079 Do 8080 Call dw_messagebox 'Warning', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), "You can only compare the 'Latest' or 'Working' revision in another repository." 8081 Call dw_dialog_dismiss dialog, 'retry' 8082 Return 0 8083 End 8084If rev2 \= 'Latest' & rev2 \= 'Working' & rep2_idx \= !!last_repository Then 8085 Do 8086 Call dw_messagebox 'Warning', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), "You can only compare the 'Latest' or 'Working' revision in another repository." 8087 Call dw_dialog_dismiss dialog, 'retry' 8088 Return 0 8089 End 8090If rep1 = rep2 & rev1 = rev2 Then 8091 Do 8092 Call dw_messagebox 'Warning', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), "You can't compare the same revision of the same file." 8093 Call dw_dialog_dismiss dialog, 'retry' 8094 Return 0 8095 End 8096Call dw_dialog_dismiss dialog, 'apply' 8097/*Call dw_dialog_dismiss dialog, 'apply:'rev1':'rev2':'rep1':'rep2':'rep1_idx':'rep2_idx':'comp':'out*/ 8098Call dw_window_destroy window 8099/* 8100 * Run the differences now... 8101 */ 8102If difftype = 'ignorewhitespace' Then diffflags = '-bw' 8103Else diffflags = '' 8104 8105Call SetCursorWait 8106/* 8107 * get file 1 8108 */ 8109If Left( rev1, 5 ) = 'Date:' Then 8110 Do 8111 rev1 = SubWord( rev1, 2 ) 8112 rev1_val = '-D'Translate( rev1, '-', ' ' ) 8113 End 8114Else rev1_val = '-r'rev1 8115label1 = rep1':' !global.!current_filenames.1'('rev1')' 8116tmptmp1 = Translate( Changestr( ':', label1, '-???' ), '_', '/' ) 8117Select 8118 When !global.!!repository.!!type.rep1_idx = 'rcs' Then 8119 Do 8120 /* TODO */ 8121 If rev1 = 'Working' Then 8122 Do 8123 file1 = RCSFileToFile( current_filenames.1, rep1_idx ) 8124 End 8125 Else 8126 Do 8127 Address System 'co -p'rev1 quote( current_filenames.1 ) '>' file1 !global.!stderrdevnull 8128 Call Stream file1, 'C', 'CLOSE' 8129 End 8130 End 8131 When !global.!!repository.!!type.rep1_idx = 'cvs' Then 8132 Do 8133 /* 8134 * Save the current value of CVS_RSH because we have to put it 8135 * back to the saved value after we check out the files... 8136 */ 8137 save_rsh = Value( 'CVS_RSH', , 'ENVIRONMENT' ) 8138 /* 8139 * Checkout rev1... 8140 */ 8141 Select 8142 When rev1 = 'Working' Then 8143 Do 8144 If !REXXDW.!GTK_MAJOR_VERSION > 1 Then 8145 Do 8146 file1 = GenerateTempFile( tmptmp1 ) 8147 Address System 'cat' quote( !global.!current_filenames.1 ) '| iconv -f ISO-8859-1 -t UTF-8' With Output Stream file1 Error Stem junk. 8148 Call Stream file1, 'C', 'CLOSE' 8149 End 8150 Else 8151 file1 = CVSFileToWorkingFile( !global.!current_filenames.1, rep1_idx ) 8152 End 8153 When rev1 = 'Latest' Then 8154 Do 8155 file1 = GenerateTempFile( tmptmp1 ) 8156 Call SetCVSEnvVars rep1_idx 8157 If !REXXDW.!GTK_MAJOR_VERSION > 1 Then 8158 Do 8159 cmd = 'cvs' !global.!!repository.!!cvs_compression.rep1_idx '-d'!global.!!repository.!!path.rep1_idx 'checkout -p' quote( !global.!current_filenames.1 ) '| iconv -f ISO-8859-1 -t UTF-8' 8160 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8161 Address System cmd With Output Stream file1 Error Stem junk. 8162 End 8163 Else 8164 Do 8165 cmd = 'cvs' !global.!!repository.!!cvs_compression.rep1_idx '-d'!global.!!repository.!!path.rep1_idx 'checkout -p' quote( !global.!current_filenames.1 ) 8166 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8167 Address Command cmd With Output Stream file1 Error Stem junk. 8168 End 8169 Call Stream file1, 'C', 'CLOSE' 8170 End 8171 Otherwise 8172 Do 8173 file1 = GenerateTempFile( tmptmp1 ) 8174 Call SetCVSEnvVars rep1_idx 8175 If !REXXDW.!GTK_MAJOR_VERSION > 1 Then 8176 Do 8177 cmd = 'cvs' !global.!!repository.!!cvs_compression.rep1_idx '-d'!global.!!repository.!!path.rep1_idx 'checkout -p' rev1_val quote( !global.!current_filenames.1 ) '| iconv -f ISO-8859-1 -t UTF-8' 8178 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8179 Address System cmd With Output Stream file1 Error Stem junk. 8180 End 8181 Else 8182 Do 8183 cmd = 'cvs' !global.!!repository.!!cvs_compression.rep1_idx '-d'!global.!!repository.!!path.rep1_idx 'checkout -p' rev1_val quote( !global.!current_filenames.1 ) 8184 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8185 Address Command cmd With Output Stream file1 Error Stem junk. 8186 End 8187 Call Stream file1, 'C', 'CLOSE' 8188 End 8189 End 8190 /* 8191 * Put back CVS_RSH value saved above... 8192 */ 8193 Call Value 'CVS_RSH', save_rsh, 'ENVIRONMENT' 8194 End 8195 Otherwise Nop 8196End 8197/* 8198 * get file 2 8199 */ 8200If Left( rev2, 5 ) = 'Date:' Then 8201 Do 8202 rev2 = SubWord( rev2, 2 ) 8203 rev2_val = '-D'Translate( rev2, '-', ' ' ) 8204 End 8205Else rev2_val = '-r'rev2 8206label2 = rep2':' !global.!current_filenames.1'('rev2')' 8207tmptmp2 = Translate( Changestr( ':', label2, '-???' ), '_', '/' ) 8208Select 8209 When !global.!!repository.!!type.rep2_idx = 'rcs' Then 8210 Do 8211 /* TODO */ 8212 If rev2 = 'Latest' Then 8213 Do 8214 Address System 'co -p' quote( current_filenames.1 ) '>' file2 !global.!stderrdevnull 8215 End 8216 Else 8217 Do 8218 Address System 'co -p'rev2 quote( current_filenames.1 ) '>' file2 !global.!stderrdevnull 8219 End 8220 End 8221 When !global.!!repository.!!type.rep2_idx = 'cvs' Then 8222 Do 8223 /* 8224 * Save the current value of CVS_RSH because we have to put it 8225 * back to the saved value after we check out the files... 8226 */ 8227 save_rsh = Value( 'CVS_RSH', , 'ENVIRONMENT' ) 8228 /* 8229 * Checkout rev2... 8230 */ 8231 Select 8232 When rev2 = 'Working' Then 8233 Do 8234 If !REXXDW.!GTK_MAJOR_VERSION > 1 Then 8235 Do 8236 file2 = GenerateTempFile( tmptmp2 ) 8237 Address System 'cat' quote( !global.!current_filenames.1 ) '| iconv -f ISO-8859-1 -t UTF-8' With Output Stream file2 Error Stem junk. 8238 Call Stream file2, 'C', 'CLOSE' 8239 End 8240 Else 8241 file2 = CVSFileToWorkingFile( !global.!current_filenames.1, rep2_idx ) 8242 End 8243 When rev2 = 'Latest' Then 8244 Do 8245 file2 = GenerateTempFile( tmptmp2 ) 8246 Call SetCVSEnvVars rep2_idx 8247 If !REXXDW.!GTK_MAJOR_VERSION > 1 Then 8248 Do 8249 cmd = 'cvs' !global.!!repository.!!cvs_compression.rep2_idx '-d'!global.!!repository.!!path.rep2_idx 'checkout -p' quote( !global.!current_filenames.1 ) '| iconv -f ISO-8859-1 -t UTF-8' 8250 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8251 Address System cmd With Output Stream file2 Error Stem junk. 8252 End 8253 Else 8254 Do 8255 cmd = 'cvs' !global.!!repository.!!cvs_compression.rep2_idx '-d'!global.!!repository.!!path.rep2_idx 'checkout -p' quote( !global.!current_filenames.1 ) 8256 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8257 Address Command cmd With Output Stream file2 Error Stem junk. 8258 End 8259 Call Stream file2, 'C', 'CLOSE' 8260 End 8261 Otherwise 8262 Do 8263 file2 = GenerateTempFile( tmptmp2 ) 8264 Call SetCVSEnvVars rep2_idx 8265 If !REXXDW.!GTK_MAJOR_VERSION > 1 Then 8266 Do 8267 cmd = 'cvs' !global.!!repository.!!cvs_compression.rep2_idx '-d'!global.!!repository.!!path.rep2_idx 'checkout -p' rev2_val quote( !global.!current_filenames.1 ) '| iconv -f ISO-8859-1 -t UTF-8' 8268 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8269 Address System cmd With Output Stream file2 Error Stem junk. 8270 End 8271 Else 8272 Do 8273 cmd = 'cvs' !global.!!repository.!!cvs_compression.rep2_idx '-d'!global.!!repository.!!path.rep2_idx 'checkout -p' rev2_val quote( !global.!current_filenames.1 ) 8274 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8275 Address Command cmd With Output Stream file2 Error Stem junk. 8276 End 8277 Call Stream file2, 'C', 'CLOSE' 8278 End 8279 End 8280 /* 8281 * Put back CVS_RSH value saved above... 8282 */ 8283 Call Value 'CVS_RSH', save_rsh, 'ENVIRONMENT' 8284 End 8285 Otherwise Nop 8286End 8287file1 = Changestr( '/', file1, !global.!ossep ) 8288file2 = Changestr( '/', file2, !global.!ossep ) 8289/* 8290 * Win32 .doc differences... 8291 */ 8292If !global.!os = 'WIN32' & Translate( Right( !global.!current_filenames.1, 4 ) ) = '.DOC' Then 8293 Do 8294 /* 8295 * check if either of the files to be compared is the working copy, and if so 8296 * whether that file is currently open in Word with changes that haven't been made 8297 * If this is the case, inform the user we can save the file before the comparison 8298 * Irrespective of the answer, copy the working file to a temporary file before the 8299 * comparison i done 8300 */ 8301 If rev1 = 'Working' Then 8302 Do 8303 If CheckIfFileChangedInWord( file1 ) Then 8304 Do 8305 Call SetCursorNoWait 8306 Return 0 8307 End 8308 -- copy the working file to the temporary file 8309 wfile1 = Changestr( '/', GenerateTempFile( tmptmp1 ), !global.!ossep ) 8310 Address System !global.!cmdcopy quote( file1 ) quote( wfile1 ) !global.!devnull 8311 file1 = wfile1 8312 End 8313 If rev2 = 'Working' Then 8314 Do 8315 If CheckIfFileChangedInWord( file2 ) Then 8316 Do 8317 Call SetCursorNoWait 8318 Return 0 8319 End 8320 -- copy the working file to the temporary file 8321 wfile2 = Changestr( '/', GenerateTempFile( tmptmp2 ), !global.!ossep ) 8322 Address System !global.!cmdcopy quote( file2 ) quote( wfile2 ) !global.!devnull 8323 file2 = wfile2 8324 End 8325 file1 = ConvertWordDocumentToText( file1, 0 ) 8326 If file1 = '' Then 8327 Do 8328 Call SetCursorNoWait 8329 Return 0 8330 End 8331 Call AddTempFileForCleanup file1 8332 file2 = ConvertWordDocumentToText( file2, 0 ) 8333 If file2 = '' Then 8334 Do 8335 Call SetCursorNoWait 8336 Return 0 8337 End 8338 Call AddTempFileForCleanup file2 8339 End 8340/* 8341 * Do the diff now... 8342 */ 8343If outputtype = 'logwindow' Then 8344 Do 8345 Call RunOsCommand !global.!cmddiff diffflags quote( file1 ) quote( file2 ) 8346 Call WriteOutputStemsToLogWindow 'default', 'Differences between' label1 'and' label2 8347 End 8348Else 8349 Do 8350 /* 8351 * If there is a valid syntax for the file's extension, use this 8352 */ 8353 pos = Lastpos( '.', !global.!current_filenames.1 ) 8354 If pos \= 0 Then 8355 Do 8356 syntax = FindSyntax( Substr( !global.!current_filenames.1, pos+1 ) ) 8357 If syntax = '' Then syntax_flags = '' 8358 Else syntax_flags = '-S'syntax 8359 /* 8360 * Now if the user has a default theme, use it 8361 */ 8362 If Left( !global.!!user.!!style, 1 ) \= '!' & !global.!!user.!!style \= '' & syntax_flags \= '' Then syntax_flags = syntax_flags '-s'!global.!!user.!!style 8363 End 8364 Else syntax_flags = '' 8365 If Left( !global.!!user.!!preference.!!tabspaces, 1 ) = '!' | !global.!!user.!!preference.!!tabspaces = 0 Then tabspaces_flag = '' 8366 Else tabspaces_flag = '-c'!global.!!user.!!preference.!!tabspaces 8367 /* 8368 * Call the external differences program 8369 */ 8370 If !global.!!user.!!diffprog = '' | Left( !global.!!user.!!diffprog, 1 ) = '!' Then 8371 Do 8372 If !global.!os = 'OSX' & !global.!rexxdiff_by_env_variable = 1 Then 8373 Do 8374 /* 8375 * MacOS X leopard does not allow arguments to be passed to an application started with "open" 8376 * command, so we have to set env variables for our args. rexxdiff, then will check for 8377 * these set env variables. 8378 */ 8379 Call Value 'REXXDIFF_ARG1', '-f'file1, 'ENVIRONMENT' 8380 Call Value 'REXXDIFF_ARG2', '-F'file2, 'ENVIRONMENT' 8381 Call Value 'REXXDIFF_ARG3', '-t'label1, 'ENVIRONMENT' 8382 Call Value 'REXXDIFF_ARG4', '-T'label2, 'ENVIRONMENT' 8383 i = 4 8384 If syntax_flags \= '' Then 8385 Do j = 1 To Words( syntax_flags ) 8386 flag = Word( syntax_flags, j ) 8387 i = i + 1 8388 Call Value 'REXXDIFF_ARG'i, flag, 'ENVIRONMENT' 8389 End 8390 If tabspaces_flag \= '' Then 8391 Do 8392 i = i + 1 8393 Call Value 'REXXDIFF_ARG'i, tabspaces_flag, 'ENVIRONMENT' 8394 End 8395 If diffflags \= '' Then 8396 Do 8397 i = i + 1 8398 Call Value 'REXXDIFF_ARG'i, diffflags, 'ENVIRONMENT' 8399 End 8400 Call Value 'REXXDIFF_ARGS', i, 'ENVIRONMENT' 8401 diffcmd = !global.!rexxdiff 8402 End 8403 Else 8404 Do 8405 diffcmd = !global.!rexxdiff '-f'quote( file1 ) '-F'quote( file2 ) '-t'quote( label1 ) '-T'quote( label2 ) syntax_flags tabspaces_flag diffflags 8406 End 8407 End 8408 Else 8409 Do 8410 diffcmd = Changestr( '%F1%', !global.!!user.!!diffprog, file1 ) 8411 diffcmd = Changestr( '%F2%', diffcmd, file2 ) 8412 diffcmd = Changestr( '%T1%', diffcmd, label1 ) 8413 diffcmd = Changestr( '%T2%', diffcmd, label2 ) 8414 End 8415 cmd = !global.!background_start_nowindow diffcmd !global.!background_end 8416 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8417 Address System cmd 8418 End 8419 8420Call SetCursorNoWait 8421Return 0 8422 8423/* 8424 * Determines if the supplied files are currently open in word 8425 */ 8426IsWordOpen: Procedure Expose !REXXDW. !global. !!last_repository 8427app = w32CreateObject("Word.Application") 8428num = w32GetProperty( app, 'Documents.Count' ) 8429Call w32ReleaseObject app 8430Return num -- will return the number of files open; 0 if no files open or we just started word 8431 8432/* 8433 * Determines if the supplied file is currently open in word and if there are unsaved changes 8434 */ 8435CheckIfFileChangedInWord: Procedure Expose !REXXDW. !global. !!last_repository 8436Parse Arg fn 8437cancel = 0 8438app = w32CreateObject("Word.Application") 8439documents = w32getproperty( app, 'Documents' ) 8440Call w32ReleaseObject app 8441Do Forever 8442 odoc = w32olenext( documents ) 8443 If odoc = 0 Then Leave 8444 fp = w32getproperty( odoc, 'FullName' ) 8445 If Translate( fn ) = Translate( fp ) & w32getproperty( odoc, 'Saved' ) = 0 Then 8446 Do 8447 -- document is open and has unsaved changes, ask if the file is to be saved 8448 rcode = dw_messagebox( 'Save file?', dw_or( !REXXDW.!DW_MB_YESNOCANCEL, !REXXDW.!DW_MB_QUESTION ), quote( fn ) 'has not been saved. Do you want the file saved before the comparison? Select Yes to have the file saved; No to compare without saving; Cancel to quit the action.' ) 8449 Select 8450 When rcode = !REXXDW.!DW_MB_RETURN_NO Then Nop 8451 When rcode = !REXXDW.!DW_MB_RETURN_CANCEL Then cancel = 1 8452 Otherwise 8453 Do 8454 -- save the file 8455 Call w32CallProc odoc, 'Save' 8456 End 8457 End 8458 End 8459 Call w32ReleaseObject odoc 8460End 8461Return cancel 8462 8463/* 8464 * Opens a Word Document and saves it as a text file for Show Differences 8465 */ 8466ConvertWordDocumentToText: Procedure Expose !REXXDW. !global. !!last_repository 8467Parse Arg docfile, batch 8468/* 8469 * Get the version of Word 8470 */ 8471app = w32CreateObject("Word.Application") 8472ver = w32GetProperty( app, 'Version' ) 8473Call w32ReleaseObject app 8474 8475wrd = w32CreateObject("Word.Basic") 8476Call w32CallProc wrd, "FileOpen", 's', docfile 8477 8478If rc \= 0 Then 8479 Do 8480 If \batch Then 8481 Do 8482 Call dw_messagebox 'Conversion Error', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), 'Unable to convert Word document:' docfile 'to text.' 8483 End 8484 Call w32CallProc wrd, "FileClose" 8485 Call w32ReleaseObject wrd 8486 Return '' 8487 End 8488 8489out = docfile'.txt' 8490Select 8491 When ver = '11.0removeme' Then Call w32CallProc wrd, "FileSaveAs", , out, 2, 0, , 0, , 0, 0, 0, 0, 0, 0, 1, 1 8492 Otherwise Call w32CallProc wrd, "FileSaveAs", 'si' , out, 2 8493End 8494If rc \= 0 Then 8495 Do 8496 If \batch Then 8497 Do 8498 Call dw_messagebox 'Conversion Error', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), 'Unable to convert Word document to text.' W32OLEGetError() 8499 End 8500 Call w32CallProc wrd, "FileClose" 8501 Call w32ReleaseObject wrd 8502 Return '' 8503 End 8504Call w32CallProc wrd, "FileClose" 8505Call w32ReleaseObject wrd 8506/* 8507 * When there are tables in the word document, the columns are separated by LF characters. These are treated as separate lines 8508 * by the Rexx interpreter, but are treated as embedded charcaters by the qdiff.exe. We need to ensure all single LF are converted to CRLF. 8509 * Simply read the file into memory, and write it out again. 8510 */ 8511Call Stream out, 'C', 'OPEN READ' 8512Do i = 1 While Lines( out ) > 0 8513 line.i = Linein( out ) 8514 line.0 = i 8515End 8516Call Stream out, 'C', 'CLOSE' 8517Call Stream out, 'C', 'OPEN WRITE REPLACE' 8518Do i = 1 To line.0 8519 Call Lineout out, line.i 8520End 8521Call Stream out, 'C', 'CLOSE' 8522Drop line. 8523Return out 8524 8525ReportModuleHistoryApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 8526Parse Arg button, window, dialog, rev1cbox, rev2cbox, rep1cbox, rep2cbox, compare_rb1, compare_rb2, later_entry, earlier_entry, word_compare_cb, showall_compare_cb 8527rev1 = dw_window_get_text( rev1cbox ) 8528rev2 = dw_window_get_text( rev2cbox ) 8529rep1 = dw_window_get_text( rep1cbox ) 8530rep2 = dw_window_get_text( rep2cbox ) 8531mod1 = dw_window_get_text( later_entry ) 8532mod2 = dw_window_get_text( earlier_entry ) 8533wc = dw_checkbox_get( word_compare_cb ) 8534sa = dw_checkbox_get( showall_compare_cb ) 8535If dw_radiobutton_get( compare_rb1 ) Then diffflags = '-w' 8536Else diffflags = '' 8537 8538If rep1 = 'Current Repository' Then rep1 = !global.!!repository.!!name.!!last_repository 8539If rep2 = 'Current Repository' Then rep2 = !global.!!repository.!!name.!!last_repository 8540 8541If comp = 'ignorewhitespace' Then diffflags = '-w' 8542Else diffflags = '' 8543 8544If wc = 1 Then wcflag = '-W' 8545Else wcflag = '' 8546 8547If sa = 1 Then saflag = '-A' 8548Else saflag = '' 8549 8550desc = 'Report differences between' rep1':'mod1'('rev1')' 'and' rep2':'mod2'('rev2')' 8551type = 'mods' 8552compiler_type = '.' 8553/* 8554 * Create the basefile and the job description file 8555 */ 8556basefile = GenerateJobBaseFile() 8557Call CreateDescriptionFile basefile, desc, type, compiler_type 8558cmd = !global.!qocca_command 'mods -n'rep1 '-N'rep2 quote( '-m'mod1 ) quote( '-M'mod2 ) quote( '-v'rev1 ) quote( '-V'rev2 ) '-B'basefile '-p' diffflags wcflag saflag 8559outputfile = basefile'.out' 8560basedir = Changestr( !global.!ossep, !global.!!repository.!!working_dir.!!last_repository || !global.!current_dirname.!!last_repository, '/' ) 8561/* 8562 * Increment the active jobs 8563 */ 8564Call IncrementRunningJobs basefile 8565/* 8566 * Run it now, redirecting output to the outputfile 8567 */ 8568Call WriteMessageHeaderToLogWindow desc 'submitted' 8569Call WriteMessageToLogWindow ' Command to run:' cmd 8570Call WriteMessageTrailerToLogWindow desc 'submitted' 8571Address System !global.!background_start_nowindow cmd !global.!background_end 8572Call dw_window_destroy window 8573Call dw_dialog_dismiss dialog, 'apply' 8574 8575Return 0 8576 8577GenericCloseCallback: Procedure Expose !REXXDW. !global. !!last_repository 8578Parse Arg ., window, dialog 8579Call dw_window_destroy window 8580If dialog \= '' Then Call dw_dialog_dismiss dialog, 'close' 8581Return 0 8582 8583FilePropertiesApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository !det. 8584Parse Arg button, window, dialog, file_type_combo, desc_entry, fn, old_type, old_desc, locks_cb 8585/* 8586 * If we are an administrator and the description has changed, update it in the 8587 * repository. 8588 */ 8589filepropchange = 'N' 8590If !global.!administrator.!!last_repository = 'Y' Then 8591 Do 8592 new_desc = dw_window_get_text( desc_entry ) 8593 idx = dw_listbox_selected( file_type_combo ) 8594 new_type = dw_listbox_get_text( file_type_combo, idx ) 8595 if trace() = 'F' Then say new_type':'old_type 8596 Select 8597 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 8598 Do 8599 If locks_cb = 'LOCKS_CB' Then unlock = 0 8600 Else 8601 Do 8602 unlock = dw_checkbox_get( locks_cb ) 8603 End 8604 /* 8605 * CVS can't run admin with no working file... 8606 */ 8607 If new_desc \= old_desc | new_type \= old_type | unlock Then 8608 Do 8609 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout' quote( fn ) 8610 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8611 Address Command cmd With Output Stem junk. Error Stem junk. 8612 Call RefreshDirectoryIcons 8613 End 8614 If new_desc \= old_desc Then 8615 Do 8616 Queue new_desc 8617 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -t' quote( fn ) 8618 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8619 Address Command cmd With Input FIFO '' Output Stem osout. Error Stem oserr. 8620 Call WriteOutputStemsToLogWindow 'default', 'Updating module description for' quote( fn ) 8621 filepropchange = 'Y' 8622 End 8623 If new_type \= old_type Then 8624 Do 8625 comment = 'Changing file type for' quote( fn ) 'to' new_type 8626 If new_type = 'Binary' Then new_type = 'b' 8627 Else new_type = 'kv' 8628 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -k'new_type quote( fn ) 8629 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8630 Address Command cmd With Output Stem osout. Error Stem oserr. 8631 Call WriteOutputStemsToLogWindow 'default', comment 8632 filepropchange = 'Y' 8633 End 8634 If unlock Then 8635 Do 8636 Parse Var !det.!lock . ':' rev 8637 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'admin -u'Strip( rev ) quote( fn ) 8638 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 8639 Address Command cmd With Output Stem osout. Error Stem oserr. 8640 Call WriteOutputStemsToLogWindow 'default', 'Unlocking module:' quote( fn ) 8641 filepropchange = 'Y' 8642 End 8643 End 8644 Otherwise Nop 8645 End 8646 End 8647if trace() = 'F' Then say 'got filepropertiesdone for' window 8648Call dw_window_destroy window 8649Call dw_dialog_dismiss dialog, 'apply' filepropchange 8650Return 0 8651 8652GetLabelApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 8653Parse Arg button, window, dialog, bo_box, nl_box, overwrite_cb, edit_label_file_cb 8654based_on = dw_window_get_text( bo_box ) 8655lab = dw_window_get_text( nl_box ) 8656overwrite_label = dw_checkbox_get( overwrite_cb ) 8657edit_label_file = dw_checkbox_get( edit_label_file_cb ) 8658Call dw_window_destroy window 8659Call dw_dialog_dismiss dialog, 'apply' lab based_on overwrite_label edit_label_file 8660Return 0 8661 8662/* 8663 * End of callbacks 8664 */ 8665DisplayDirProperties: Procedure Expose !REXXDW. !global. !!last_repository 8666/* 8667 * Directory properties... (from build.conf) 8668 * 8669 * +--------------------------------------------------------------+ 8670 * | Text | 8671 * | | 8672 * +--------------------------------------------------------------+ 8673 * | UNIX | W32 | OS/2 | BeOS | Amiga | | 8674 * |------+-----+------+------+-------+---------------------------| 8675 * | Make Directory: ________________________________ | !dir.!makedirectory.this_dir.!platform 8676 * | Make Command: ________________________________ | !dir.!makecommand.this_dir.!platform 8677 * | Debug Make Command: ________________________________ | !dir.!debugmakecommand.this_dir.!platform 8678 * | Custom Make Command: ________________________________ | !dir.!custommakecommand.this_dir.!platform 8679 * | Build Command: ________________________________ | !dir.!buildcommand.this_dir.!platform 8680 * | Debug Build Command: ________________________________ | !dir.!debugbuildcommand.this_dir.!platform 8681 * | Custom Build Command: ________________________________ | !dir.!custombuildcommand.this_dir.!platform 8682 * | Promote Command: ________________________________ | !dir.!promotecommand.this_dir.!platform 8683 * | Install Script: ________________________________ | !dir.!installcommand.this_dir.!platform 8684 * | Install Dirs: ________________________________ | !dir.!installdirs.this_dir.!platform 8685 * | Default Compiler: _______________________________v | !dir.!compiler.this_dir.!platform 8686 * | Email Template: ________________________________ | !dir.!emailer.this_dir.!platform 8687 * +--------------------------------------------------------------+ 8688 * | Reserved Checkout: X | !dir.!reservedcheckout.this_dir 8689 * +--------------------------------------------------------------+ 8690 * | Cancel | 8691 * +--------------------------------------------------------------+ 8692 * | Apply | 8693 * +--------------------------------------------------------------+ 8694 * 8695 * On success, updates build.conf 8696 * 8697 */ 8698/* 8699 * If our current platform is not already in the list of platforms, add it now so we can create 8700 * an empty page 8701 */ 8702If Wordpos( !global.!os, !global.!platforms ) = 0 Then !global.!platforms = !global.!platforms !global.!os 8703num_platforms = Words( !global.!platforms ) 8704this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 8705win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Edit Directory Properties for:' !global.!current_dirname.!!last_repository, !global.!windowstyle ) 8706Call dw_window_set_icon win, !global.!qoccaicon 8707topbox = dw_box_new( !REXXDW.!DW_VERT ) 8708Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 8709/* 8710 * Add a disabled MLE with instructions 8711 */ 8712t1 = dw_mle_new( 0 ) 8713Call dw_box_pack_start topbox, t1, 400, 50, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8714Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 8715Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 8716Call DirpropertiesHelpFocusCallback t1, 'INITIAL', t1 8717/* 8718 * Add a notebook 8719 */ 8720!global.!dirnotebookbox = dw_box_new( !REXXDW.!DW_VERT ) 8721Call dw_box_pack_start topbox, !global.!dirnotebookbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 8722/* 8723 * Create our repository notebook 8724 */ 8725!global.!dirnotebook = dw_notebook_new( 0, !REXXDW.!DW_TAB_TO_TOP ) 8726Call dw_box_pack_start !global.!dirnotebookbox, !global.!dirnotebook, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 8727Call dw_signal_connect !global.!dirnotebook, !REXXDW.!DW_SWITCH_PAGE_EVENT, 'SwitchDirectoryCallback' 8728/* 8729 * For each platform, we need to create a notebook tab page 8730 */ 8731Do i = 1 To num_platforms 8732 Call AddDirectoryPage i, t1, this_dir 8733End 8734/* 8735 * Create reserved checkout checkbox 8736 */ 8737tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8738Call dw_box_pack_start topbox, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8739!global.!dirproperties.?rc_cb = dw_checkbox_new( 'Reserved Checkout', 0 ) 8740Call dw_box_pack_start tmpbox, !global.!dirproperties.?rc_cb, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8741If !global.!dir.!reservedcheckout.this_dir = 'Y' Then Call dw_checkbox_set !global.!dirproperties.?rc_cb, !REXXDW.!DW_CHECKED 8742Else Call dw_checkbox_set !global.!dirproperties.?rc_cb, !REXXDW.!DW_UNCHECKED 8743/* 8744 * Create Cancel and Apply buttons 8745 */ 8746b1 = dw_button_new( 'Apply', 0 ) 8747Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8748 8749b2 = dw_button_new( 'Cancel', 0 ) 8750Call dw_box_pack_start topbox, b2, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8751/* 8752 * Save us passing this to the callbacks 8753 */ 8754!global.!dirproperties.?this_dir = this_dir 8755/* 8756 * Display the window 8757 */ 8758width = 500 8759height = 520 /* text_height + cb_height + 80 */ 8760Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 8761Call dw_window_show win 8762 Call dw_main_sleep 10 8763Do Forever 8764 /* 8765 * Create a dialog for the window 8766 */ 8767 dialog_wait = dw_dialog_new( ) 8768 /* 8769 * We now have everything setup, we can connect the destroying of the top-level window 8770 * to the 'close' callback 8771 */ 8772 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'DirPropertiesApplyCallback', win, dialog_wait 8773 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 8774 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 8775 /* 8776 * Wait for the dialog to come back 8777 */ 8778 cancel = dw_dialog_wait( dialog_wait ) 8779 /* 8780 * All successful processing done in the 'applycallback', so simply get 8781 * out of the loop if we don't have any validation issues 8782 */ 8783 If cancel \= 'retry' Then Leave 8784End 8785 8786Return 0 8787 8788AddDirectoryPage: Procedure Expose !REXXDW. !global. !!last_repository 8789Parse Arg i, t1, this_dir 8790title_width = 150 8791/* 8792 * Create our notebook page and box to pack... 8793 */ 8794!global.!dirnotebookpagebox.i = dw_box_new( !REXXDW.!DW_VERT ) 8795!global.!dirnotebookpage.i = dw_notebook_page_new( !global.!dirnotebook, 0, !REXXDW.!DW_PAGE_TO_BACK ) 8796/* 8797 * Pack the box for the notebook page contents into the notebook page and set the 8798 * text of the notebook page tab 8799 */ 8800Call dw_notebook_pack !global.!dirnotebook, !global.!dirnotebookpage.i, !global.!dirnotebookpagebox.i 8801Call dw_notebook_page_set_text !global.!dirnotebook, !global.!dirnotebookpage.i, Word( !global.!platforms, i ) 8802/* 8803 * Add the boxes and widgets for the left column... 8804 */ 8805/* make directory */ 8806tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8807Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8808tmp = dw_text_new( 'Make Directory', 0 ) 8809Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8810Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8811If Left( !global.!dir.!makedirectory.this_dir.i, 1 ) = '!' Then oldvalue = '' 8812Else oldvalue = !global.!dir.!makedirectory.this_dir.i 8813!global.!dirproperties.?md.i = dw_entryfield_new( oldvalue, 0 ) 8814Call dw_box_pack_start tmpbox, !global.!dirproperties.?md.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8815Call dw_signal_connect !global.!dirproperties.?md.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'MD', t1 8816/* make command */ 8817tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8818Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8819tmp = dw_text_new( 'Make Command', 0 ) 8820Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8821Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8822If Left( !global.!dir.!makecommand.this_dir.i, 1 ) = '!' Then oldvalue = '' 8823Else oldvalue = !global.!dir.!makecommand.this_dir.i 8824!global.!dirproperties.?mc.i = dw_entryfield_new( oldvalue, 0 ) 8825Call dw_box_pack_start tmpbox, !global.!dirproperties.?mc.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8826Call dw_signal_connect !global.!dirproperties.?mc.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'MC', t1 8827/* debug make command */ 8828tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8829Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8830tmp = dw_text_new( 'Debug Make Command', 0 ) 8831Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8832Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8833If Left( !global.!dir.!debugmakecommand.this_dir.i, 1 ) = '!' Then oldvalue = '' 8834Else oldvalue = !global.!dir.!debugmakecommand.this_dir.i 8835!global.!dirproperties.?dmc.i = dw_entryfield_new( oldvalue, 0 ) 8836Call dw_box_pack_start tmpbox, !global.!dirproperties.?dmc.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8837Call dw_signal_connect !global.!dirproperties.?dmc.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'DMC', t1 8838-- custom make command 8839tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8840Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8841tmp = dw_text_new( 'Custom Make Command', 0 ) 8842Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8843Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8844If Left( !global.!dir.!custommakecommand.this_dir.i, 1 ) = '!' Then oldvalue = '' 8845Else oldvalue = !global.!dir.!custommakecommand.this_dir.i 8846!global.!dirproperties.?cmc.i = dw_entryfield_new( oldvalue, 0 ) 8847Call dw_box_pack_start tmpbox, !global.!dirproperties.?cmc.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8848Call dw_signal_connect !global.!dirproperties.?cmc.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'DMC', t1 8849/* build command */ 8850tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8851Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8852tmp = dw_text_new( 'Build Command', 0 ) 8853Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8854Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8855If Left( !global.!dir.!buildcommand.this_dir.i, 1 ) = '!' Then oldvalue = '' 8856Else oldvalue = !global.!dir.!buildcommand.this_dir.i 8857!global.!dirproperties.?bc.i = dw_entryfield_new( oldvalue, 0 ) 8858Call dw_box_pack_start tmpbox, !global.!dirproperties.?bc.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8859Call dw_signal_connect !global.!dirproperties.?bc.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'BC', t1 8860/* debug build command */ 8861tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8862Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8863tmp = dw_text_new( 'Debug Build Command', 0 ) 8864Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8865Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8866If Left( !global.!dir.!debugbuildcommand.this_dir.i, 1 ) = '!' Then oldvalue = '' 8867Else oldvalue = !global.!dir.!debugbuildcommand.this_dir.i 8868!global.!dirproperties.?dbc.i = dw_entryfield_new( oldvalue, 0 ) 8869Call dw_box_pack_start tmpbox, !global.!dirproperties.?dbc.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8870Call dw_signal_connect !global.!dirproperties.?dbc.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'DBC', t1 8871-- custom build command 8872tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8873Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8874tmp = dw_text_new( 'Custom Build Command', 0 ) 8875Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8876Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8877If Left( !global.!dir.!custombuildcommand.this_dir.i, 1 ) = '!' Then oldvalue = '' 8878Else oldvalue = !global.!dir.!custombuildcommand.this_dir.i 8879!global.!dirproperties.?cbc.i = dw_entryfield_new( oldvalue, 0 ) 8880Call dw_box_pack_start tmpbox, !global.!dirproperties.?cbc.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8881Call dw_signal_connect !global.!dirproperties.?cbc.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'DBC', t1 8882/* promote directory */ 8883tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8884Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8885tmp = dw_text_new( 'Promote Directory', 0 ) 8886Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8887Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8888If Left( !global.!dir.!promotedirectory.this_dir.i, 1 ) = '!' Then oldvalue = '' 8889Else oldvalue = !global.!dir.!promotedirectory.this_dir.i 8890!global.!dirproperties.?pd.i = dw_entryfield_new( oldvalue, 0 ) 8891Call dw_box_pack_start tmpbox, !global.!dirproperties.?pd.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8892Call dw_signal_connect !global.!dirproperties.?pd.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'PD', t1 8893/* promote command */ 8894tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8895Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8896tmp = dw_text_new( 'Promote Command', 0 ) 8897Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8898Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8899If Left( !global.!dir.!promotecommand.this_dir.i, 1 ) = '!' Then oldvalue = '' 8900Else oldvalue = !global.!dir.!promotecommand.this_dir.i 8901!global.!dirproperties.?pc.i = dw_entryfield_new( oldvalue, 0 ) 8902Call dw_box_pack_start tmpbox, !global.!dirproperties.?pc.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8903Call dw_signal_connect !global.!dirproperties.?pc.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'PC', t1 8904/* install command */ 8905tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8906Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8907tmp = dw_text_new( 'Install Script', 0 ) 8908Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8909Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8910If Left( !global.!dir.!installcommand.this_dir.i, 1 ) = '!' Then oldvalue = '' 8911Else oldvalue = !global.!dir.!installcommand.this_dir.i 8912!global.!dirproperties.?is.i = dw_entryfield_new( oldvalue, 0 ) 8913Call dw_box_pack_start tmpbox, !global.!dirproperties.?is.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8914Call dw_signal_connect !global.!dirproperties.?is.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'IS', t1 8915/* install directories */ 8916tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8917Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8918tmp = dw_text_new( 'Install Directories', 0 ) 8919Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8920Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8921If Left( !global.!dir.!installdirs.this_dir.i, 1 ) = '!' Then oldvalue = '' 8922Else oldvalue = !global.!dir.!installdirs.this_dir.i 8923!global.!dirproperties.?id.i = dw_entryfield_new( oldvalue, 0 ) 8924Call dw_box_pack_start tmpbox, !global.!dirproperties.?id.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8925Call dw_signal_connect !global.!dirproperties.?id.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'ID', t1 8926/* default compiler */ 8927tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8928Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8929tmp = dw_text_new( 'Default Compiler', 0 ) 8930Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8931Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8932If Left( !global.!dir.!compiler.this_dir.i, 1 ) = '!' Then oldvalue = '' 8933Else oldvalue = !global.!dir.!compiler.this_dir.i 8934!global.!dirproperties.?dc.i = CreateCompilersCombobox( tmpbox, 'false', oldvalue ) 8935Call dw_box_pack_start tmpbox, !global.!dirproperties.?dc.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8936/* email template */ 8937tmpbox = dw_box_new( !REXXDW.!DW_HORZ ) 8938Call dw_box_pack_start !global.!dirnotebookpagebox.i, tmpbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8939tmp = dw_text_new( 'Email Template', 0 ) 8940Call dw_box_pack_start tmpbox, tmp, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8941Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 8942If Left( !global.!dir.!emailer.this_dir.i, 1 ) = '!' Then oldvalue = '' 8943Else oldvalue = !global.!dir.!emailer.this_dir.i 8944!global.!dirproperties.?em.i = dw_entryfield_new( oldvalue, 0 ) 8945Call dw_box_pack_start tmpbox, !global.!dirproperties.?em.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 8946Call dw_signal_connect !global.!dirproperties.?em.i, !REXXDW.!DW_SET_FOCUS_EVENT, 'DirPropertiesHelpFocusCallback', 'EM', t1 8947/* 8948 * Set the tab for the current platform to be the default 8949 */ 8950platform_index = Wordpos( !global.!os, !global.!platforms ) 8951Call dw_notebook_page_set !global.!dirnotebook, platform_index-1 8952 8953Return 0 8954 8955DirPropertiesApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 8956Parse Arg ., window, dialog 8957num_platforms = Words( !global.!platforms ) 8958this_dir = !global.!dirproperties.?this_dir 8959/* 8960 * We have valid responses, get the new values for all platforms... 8961 */ 8962Do i = 1 To num_platforms 8963 !global.!dir.!makedirectory.this_dir.i = dw_window_get_text( !global.!dirproperties.?md.i ) 8964 !global.!dir.!makecommand.this_dir.i = dw_window_get_text( !global.!dirproperties.?mc.i ) 8965 !global.!dir.!debugmakecommand.this_dir.i = dw_window_get_text( !global.!dirproperties.?dmc.i ) 8966 !global.!dir.!custommakecommand.this_dir.i = dw_window_get_text( !global.!dirproperties.?cmc.i ) 8967 !global.!dir.!buildcommand.this_dir.i = dw_window_get_text( !global.!dirproperties.?bc.i ) 8968 !global.!dir.!debugbuildcommand.this_dir.i = dw_window_get_text( !global.!dirproperties.?dbc.i ) 8969 !global.!dir.!custombuildcommand.this_dir.i = dw_window_get_text( !global.!dirproperties.?cbc.i ) 8970 !global.!dir.!promotedirectory.this_dir.i = dw_window_get_text( !global.!dirproperties.?pd.i ) 8971 !global.!dir.!promotecommand.this_dir.i = dw_window_get_text( !global.!dirproperties.?pc.i ) 8972 !global.!dir.!installcommand.this_dir.i = dw_window_get_text( !global.!dirproperties.?is.i ) 8973 !global.!dir.!installdirs.this_dir.i = dw_window_get_text( !global.!dirproperties.?id.i ) 8974 !global.!dir.!compiler.this_dir.i = ConvertCompilerNameToAbbrev( dw_window_get_text( !global.!dirproperties.?dc.i ) ) 8975 !global.!dir.!emailer.this_dir.i = dw_window_get_text( !global.!dirproperties.?em.i ) 8976End 8977!global.!dir.!makedirectory.this_dir.0 = num_platforms 8978!global.!dir.!makecommand.this_dir.0 = num_platforms 8979!global.!dir.!debugmakecommand.this_dir.0 = num_platforms 8980!global.!dir.!custommakecommand.this_dir.0 = num_platforms 8981!global.!dir.!buildcommand.this_dir.0 = num_platforms 8982!global.!dir.!debugbuildcommand.this_dir.0 = num_platforms 8983!global.!dir.!custombuildcommand.this_dir.0 = num_platforms 8984!global.!dir.!promotedirectory.this_dir.0 = num_platforms 8985!global.!dir.!promotecommand.this_dir.0 = num_platforms 8986!global.!dir.!installcommand.this_dir.0 = num_platforms 8987!global.!dir.!installdirs.this_dir.0 = num_platforms 8988!global.!dir.!compiler.this_dir.0 = num_platforms 8989!global.!dir.!emailer.this_dir.0 = num_platforms 8990/* 8991 * If the reserved checkout item has changed, we want to update the directory tree 8992 */ 8993If dw_checkbox_get( !global.!dirproperties.?rc_cb ) Then !global.!dir.!reservedcheckout.this_dir = 'Y' 8994Else !global.!dir.!reservedcheckout.this_dir = 'N' 8995If Wordpos( this_dir, !global.!targets ) = 0 Then !global.!targets = !global.!targets this_dir 8996/* 8997 * Write the new build.conf 8998 */ 8999Call WriteBuildConf 'Added make and/or install details for' !global.!current_dirname.!!last_repository 9000/* 9001 * Change the icon for the directory in the tree 9002 */ 9003Parse Value dw_tree_item_get_data( !global.!tree.!!last_repository, !global.!selected_treeitem.!!last_repository ) With parentitem mydir 9004mydir = Strip( mydir, 'B', '"' ) 9005Parse Value DetermineModuleIconAndName( mydir ) With icon currentdir 9006Call dw_tree_item_change !global.!tree.!!last_repository, !global.!selected_treeitem.!!last_repository, currentdir, icon 9007/* 9008 * In case our directory has changed to/from reserved checkout 9009 */ 9010Call SetLockedStatusIcon 9011/* 9012 * We will also update the directory toolbar buttons... 9013 */ 9014Call AdjustDirToolbarList 9015Call AdjustDirToolbarButtons 9016/* 9017 * ...and the file toolbar buttons... 9018 */ 9019Call AdjustFileToolbarList 9020Call AdjustFileToolbarButtons 9021/* 9022 * Close the window and dialog and return 9023 */ 9024Call dw_window_destroy window 9025Call dw_dialog_dismiss dialog, 'apply' 9026 9027Return 0 9028 9029DirPropertiesHelpFocusCallback: Procedure Expose !REXXDW. !global. !!last_repository 9030Parse Arg win, which, textwin 9031help.initial = 'For each platform that is to be a buildable target, enter the details below.' 9032help.md = "Enter the directory where a make is to be done from. This directory is a relative directory specification from the module directory; generally something as simple as 'make'." 9033help.mc = "Enter the command used to make the module on this platform. This is the command executed when the 'Make' command is selected. Multiple commands can be separated by ';' on UNIX or '&&' on Win32. Leaving this empty will prevent this module from being a target of a make." 9034help.dmc = "Enter the command used to do a debug make of the module on this platform. This is the command executed when the 'Debug Make' command is selected. Multiple commands can be separated by ';' on UNIX or '&&' on Win32." 9035help.cmc = "Enter the command used to do a custom make of the module on this platform. This is the command executed when the 'Custom Make' command is selected. Multiple commands can be separated by ';' on UNIX or '&&' on Win32." 9036help.bc = "Enter the command used to build the module on this platform. This is the command executed when the 'Build' command is selected. Multiple commands can be separated by ';' on UNIX or '&&' on Win32. Leaving this empty will prevent this module from being a target of a build." 9037help.dbc = "Enter the command used to do a debug build of the module on this platform. This is the command executed when the 'Debug Build' command is selected. Multiple commands can be separated by ';' on UNIX or '&&' on Win32." 9038help.cbc = "Enter the command used to do a custom build of the module on this platform. This is the command executed when the 'Custom Build' command is selected. Multiple commands can be separated by ';' on UNIX or '&&' on Win32." 9039help.pc = "Enter the command used to promote the module on this platform. This is the command executed when the 'Promote' command is selected. Multiple commands can be separated by ';' on UNIX or '&&' on Win32. Leaving this empty will prevent this module from being a target of a promote. Specify %V% as the substitution token for the version, and %D% for the install directories." 9040help.is = 'Enter the name and path of the installation script to be run when installing on this platform. The file should be specified relative to the directory you are configuring; eg. install/install.sh.', 9041 ' Leaving this empty will prevent this directory being a target of an install.' 9042help.id = 'Enter the directories (relative to the module directory) that are to be included in a promote.' 9043help.dc = 'From the drop down box, select the compiler to be used as the default compiler for this target.' 9044help.em = "Enter the command used to email (via SMTP) various users of the repository. Indicate where the filename in the command appears with %F%, a recipient by %R%, and subject by %S%." 9045help.rc = "Check this button if you want all files in this directory subject to reserved checkout." 9046Call dw_window_enable textwin 9047Call dw_mle_set_cursor textwin, 0 9048Call dw_mle_delete textwin 9049Call dw_mle_import textwin, help.which, -1 9050Call dw_window_disable textwin 9051Return 0 9052 9053AbortText: Procedure Expose !REXXDW. !global. !!last_repository 9054Parse Arg msg 9055Say msg 9056If RxFuncQuery( 'DW_DropFuncs' ) = 0 Then Call dw_DropFuncs 9057/* 9058 * Cleanup OLE 9059 */ 9060If !global.!loadedw32util = 1 Then 9061 Do 9062 Call w32olecleanup 9063 Call w32dropfuncs 9064 End 9065Exit 1 9066 9067novalue: 9068say 'got a novalue' 9069Exit 1 9070 9071ParseCompilerLine: Procedure Expose !REXXDW. !global. !!last_repository 9072Parse Arg compiler_type, line 9073/* 9074 * Check if the line is a warning... 9075 */ 9076f = '' 9077l = '' 9078c = '' 9079m = '' 9080If Datatype( !global.!compiler_template.??warning.compiler_type.0 ) \= 'NUM' Then Return '' 9081Do i = 1 To !global.!compiler_template.??warning.compiler_type.0 9082 tmp = !global.!compiler_template.??warning.compiler_type.i 9083 If tmp \= '' Then 9084 Do 9085 Interpret 'Parse Var line' tmp 9086 /* 9087 * Only matters if message and filename are not empty 9088 */ 9089 If m \= '' & f \= '' Then 9090 Do 9091 modifier = 'warning' 9092 Return modifier','f','l','c','m 9093 End 9094 End 9095End 9096/* 9097 * Check if the line is an error... 9098 */ 9099Do i = 1 To !global.!compiler_template.??error.compiler_type.0 9100 tmp = !global.!compiler_template.??error.compiler_type.i 9101 If tmp \= '' Then 9102 Do 9103 Interpret 'Parse Var line' tmp 9104 /* 9105 * Only matters if message and filename are not empty 9106 */ 9107 If m \= '' & f \= '' Then 9108 Do 9109 modifier = 'error' 9110 Return modifier','f','l','c','m 9111 End 9112 End 9113End 9114Return '' 9115 9116/* 9117 * List of compilers; their names, and templates for warnings and errors. 9118 * Only the parameters 'm' and 'f' are significant 9119 */ 9120SetCompilerTemplates: Procedure Expose !REXXDW. !global. !!last_repository 9121!global.!compiler_template.??COMPILER_TYPES = 'NONE GCC VC WCCWIN32 WCCQNX JAVAC DELPHI4 CSHARP' 9122!global.!compiler_template.??COMPILER_NAME.NONE = 'None' 9123!global.!compiler_template.??COMPILER_NAME.GCC = 'GNU C/C++' 9124!global.!compiler_template.??COMPILER_NAME.VC = 'Microsoft Visual C++' 9125!global.!compiler_template.??COMPILER_NAME.WCCWIN32 = 'Watcom C++ on Win32' 9126!global.!compiler_template.??COMPILER_NAME.WCCQNX = 'Watcom C++ on QNX' 9127!global.!compiler_template.??COMPILER_NAME.JAVAC = 'Java Compiler' 9128!global.!compiler_template.??COMPILER_NAME.DELPHI4 = 'Borland Delphi 4' 9129!global.!compiler_template.??COMPILER_NAME.CSHARP = 'C#' 9130!global.!compiler_template.??WARNING.NONE.0 = 0 9131!global.!compiler_template.??WARNING.GCC.0 = 2 9132!global.!compiler_template.??WARNING.GCC.1 = "f ':' l ':' c ': warning:' m" 9133!global.!compiler_template.??WARNING.GCC.2 = "f ':' l ': warning:' m" 9134!global.!compiler_template.??ERROR.NONE.0 = 0 9135!global.!compiler_template.??ERROR.GCC.0 = 1 9136!global.!compiler_template.??ERROR.GCC.1 = "f ':' l ':' m" 9137!global.!compiler_template.??WARNING.VC.0 = 1 9138!global.!compiler_template.??WARNING.VC.1 = "f '(' l ') : warning' . ':' m" 9139!global.!compiler_template.??ERROR.VC.0 = 2 9140!global.!compiler_template.??ERROR.VC.1 = "f '(' l ') : error' . ':' m" 9141!global.!compiler_template.??ERROR.VC.2 = "f '(' l ') : fatal error' . ':' m" 9142!global.!compiler_template.??WARNING.WCCWIN32.0 = 1 9143!global.!compiler_template.??WARNING.WCCWIN32.1 = "f '(' l '): Warning!' . ':' m" 9144!global.!compiler_template.??ERROR.WCCWIN32.0 = 1 9145!global.!compiler_template.??ERROR.WCCWIN32.1 = "f '(' l '): Error!' . ':' m" 9146!global.!compiler_template.??WARNING.WCCQNX.0 = 1 9147!global.!compiler_template.??WARNING.WCCQNX.1 = "f '(' l '): Warning!' . ':' m" 9148!global.!compiler_template.??ERROR.WCCQNX.0 = 1 9149!global.!compiler_template.??ERROR.WCCQNX.1 = "f '(' l '): Error!' . ':' m" 9150!global.!compiler_template.??WARNING.JAVAC.0 = 0 9151!global.!compiler_template.??ERROR.JAVAC.0 = 1 9152!global.!compiler_template.??ERROR.JAVAC.1 = "f ':' l ':' m" 9153!global.!compiler_template.??WARNING.DELPHI4.0 = 1 9154!global.!compiler_template.??WARNING.DELPHI4.1 = "f '(' l ') Warning:' m" 9155!global.!compiler_template.??ERROR.DELPHI4.0 = 2 9156!global.!compiler_template.??ERROR.DELPHI4.1 = "f '(' l ') Error:' m" 9157!global.!compiler_template.??ERROR.DELPHI4.2 = "f '(' l ') Fatal:' m" 9158!global.!compiler_template.??WARNING.CSHARP.0 = 1 9159!global.!compiler_template.??WARNING.CSHARP.1 = ". '[compile]' f '(' l ',' c '): warning' . ':' m" 9160!global.!compiler_template.??ERROR.CSHARP.0 = 2 9161!global.!compiler_template.??ERROR.CSHARP.1 = ". '[compile]' f '(' l ',' c '): error' . ':' m" 9162!global.!compiler_template.??ERROR.CSHARP.2 = ". '[compile] error ' f ':' m" 9163Return 9164 9165FindRepository: Procedure Expose !REXXDW. !global. !!last_repository 9166Parse Arg repository 9167If Left( !global.!!number_repositories, 1 ) = '!' Then Return 0 9168Do i = 1 To !global.!!number_repositories 9169 If !global.!!repository.!!name.i = repository Then Return i 9170End 9171Return 0 9172 9173SetRepositoryEnvs: Procedure Expose !REXXDW. !global. !!last_repository 9174Select 9175 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 9176 Do 9177 9178 Call SetCVSEnvVars !!last_repository 9179 Call Directory !global.!!repository.!!working_dir.!!last_repository 9180 /* 9181 * While we're here, we will check to see if there is a toplevel; ie in 9182 * !global.!!repository.!!working_dir.!!last_repository a CVS directory and the 9183 * appropriate admin files. If not create the missing stuff. 9184 */ 9185 cvsdir = Directory()||!global.!ossep'CVS' 9186 If Stream( cvsdir, 'C', 'QUERY EXISTS' ) = '' Then 9187 Do 9188 Call CreateDirectory( cvsdir ) 9189 End 9190 cvsentries = cvsdir||!global.!ossep'Entries' 9191 If Stream( cvsentries, 'C', 'QUERY EXISTS' ) = '' Then 9192 Do 9193 Call Stream cvsentries, 'C', 'OPEN WRITE REPLACE' 9194 Call Lineout cvsentries, 'D' 9195 Call Stream cvsentries, 'C', 'CLOSE' 9196 End 9197 cvsroot = cvsdir||!global.!ossep'Root' 9198 If Stream( cvsroot, 'C', 'QUERY EXISTS' ) = '' Then 9199 Do 9200 Call Stream cvsroot, 'C', 'OPEN WRITE REPLACE' 9201 Call Lineout cvsroot, !global.!!repository.!!path.!!last_repository 9202 Call Stream cvsroot, 'C', 'CLOSE' 9203 End 9204 cvsrepository = cvsdir||!global.!ossep'Repository' 9205 If Stream( cvsrepository, 'C', 'QUERY EXISTS' ) = '' Then 9206 Do 9207 Call Stream cvsrepository, 'C', 'OPEN WRITE REPLACE' 9208 Call Lineout cvsrepository,'.' 9209 Call Stream cvsrepository, 'C', 'CLOSE' 9210 End 9211 End 9212 Otherwise Nop 9213End 9214Return 9215 9216/* 9217 * Sets environment variables for CVS. DO NOT Expose !!last_repository 9218 */ 9219SetCVSEnvVars: Procedure Expose !REXXDW. !global. !!last_repository 9220Parse Arg repno 9221/*Call Value 'CVSROOT', !global.!!repository.!!path.repno, 'ENVIRONMENT'*/ 9222If !global.!!repository.!!contype.repno = 'rsh' Then Call Value 'CVS_RSH', 'rsh', 'ENVIRONMENT' 9223Else 9224 Do 9225 If Datatype( !global.!!repository.!!cvsport.repno ) = 'NUM' Then 9226 Do 9227 If !global.!!repository.!!cvsport.repno = 2401 Then cvs_rsh = 'ssh' 9228 Else cvs_rsh = 'sshcvs' 9229 End 9230 Else cvs_rsh = 'ssh' 9231 Call Value 'CVS_PORT', !global.!!repository.!!cvsport.repno, 'ENVIRONMENT' 9232 Call Value 'CVS_RSH', cvs_rsh, 'ENVIRONMENT' 9233 End 9234Return 9235 9236ConnectToRepository: Procedure Expose !REXXDW. !global. !!last_repository 9237Parse Arg newrepno 9238Return 9239 9240DisconnectFromRepository: Procedure Expose !REXXDW. !global. !!last_repository 9241Return 9242 9243/* 9244 * -------------------------------------------------------------------- 9245 * This function reads the configuration file. The configuration 9246 * file consists of lines of the form: 9247 * keyword = value 9248 * which are simply interpreted. 9249 * Blank lines and comment lines (starting with ';') are ignored 9250 * -------------------------------------------------------------------- 9251 */ 9252GetConfigurationFile: Procedure Expose !REXXDW. !global. !!last_repository 9253/* 9254 * Check out for readonly, the build.conf from the admin directory. Then 9255 * read the contents of build.conf into global variables. 9256 */ 9257!global.!working_conf = Translate( !global.!!repository.!!working_dir.!!last_repository'admin'!global.!ossep'build.conf', !global.!ossep, '/' ) 9258_root = !global.!!repository.!!shortpath.!!last_repository 9259Select 9260 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 9261 Do 9262 Call CreateDirectory !global.!!repository.!!working_dir.!!last_repository'admin' 9263 rcsfile = _root'/admin/RCS/build.conf,v' 9264 Address System 'co -f' rcsfile !global.!working_conf !global.!devnull 9265 If rc \= 0 Then AbortText('Unable to check out configuration file:' rcsfile) 9266 /* 9267 * Now have build.conf in !global.!working_conf file 9268 */ 9269 End 9270 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 9271 Do 9272 !global.!offline.!!last_repository = 0 9273 /* 9274 * Check global ?offline flag (set from -o command line option) 9275 */ 9276 If \!global.!offline Then 9277 Do 9278 /* 9279 * Try and checkout admin/build.conf 9280 */ 9281 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q checkout admin/build.conf' 9282 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 9283 Address Command cmd With Output Stem osout. Error Stem oserr. 9284 If rc \= 0 Then 9285 Do 9286 If !global.!!repository.!!public_cvs.!!last_repository = 'Y' Then 9287 Do 9288 /* 9289 * If there is no admin/build.conf, we still need to work 9290 * somehow ?? TODO 9291 */ 9292 dir = Translate( !global.!!repository.!!working_dir.!!last_repository'admin', '/', !global.!ossep ) 9293 Call CreateDirectory dir 9294 Call CreateDummyBuildConf 'N' 9295 End 9296 Else 9297 Do 9298 Call NotifyNoConnection 9299 End 9300 End 9301 End 9302 End 9303 When !global.!!repository.!!type.!!last_repository = 'hg' Then 9304 Do 9305 !global.!offline.!!last_repository = 0 9306 /* 9307 * Check global ?offline flag (set from -o command line option) 9308 */ 9309 If \!global.!offline Then 9310 Do 9311 /* 9312 * Try and checkout admin/build.conf 9313 */ 9314 cmd = 'hg' '-d'!global.!!repository.!!path.!!last_repository '-q checkout admin/build.conf' 9315say .line todo cmd 9316 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 9317 Address Command cmd With Output Stem osout. Error Stem oserr. 9318 If rc \= 0 Then 9319 Do 9320 /* 9321 * If there is no admin/build.conf, we still need to work 9322 * somehow ?? TODO 9323 */ 9324 dir = Translate( !global.!!repository.!!working_dir.!!last_repository'admin', '/', !global.!ossep ) 9325 Call CreateDirectory dir 9326 Call CreateDummyBuildConf 'N' 9327 End 9328 End 9329 End 9330 Otherwise 9331 Do 9332 If !global.!batch_mode Then Call AbortText 'Cannot handle repository of type:' !global.!!repository.!!type.!!last_repository 9333 Else Call AbortText 'Cannot handle repository of type:' !global.!!repository.!!type.!!last_repository 9334 End 9335End 9336Call ReadBuildConf 9337Return 9338 9339NotifyNoConnection: Procedure Expose !REXXDW. !global. !!last_repository oserr. 9340/* 9341 * We are connecting to a cvs repository that is under 9342 * our control. ie. it has an admin/build.conf, 9343 * otherwise its an error 9344 */ 9345If \!global.!batch_mode Then 9346 Do 9347 Call WriteMessageHeaderToLogWindow 'Connection failed' 9348 Do i = 1 To oserr.0 9349 Call WriteMessageToLogWindow ' 'oserr.i, 'redfore' 9350 End 9351 Call WriteMessageTrailerToLogWindow 'Connection failed' 9352 Call dw_messagebox 'No connection', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Unable to contact' quote( !global.!!repository.!!name.!!last_repository ) 'repository. Working offline.' 9353 End 9354Else 9355 Do 9356 Do i = 1 To oserr.0 9357 Say oserr.i 9358 End 9359 AbortText( 'Unable to contact' quote( !global.!!repository.!!name.!!last_repository ) 'repository.' ) 9360 End 9361!global.!offline.!!last_repository = 1 9362Return 9363 9364ReadBuildConf: Procedure Expose !REXXDW. !global. !!last_repository 9365/* 9366 * Set !targets to the empty string to simplify processing later 9367 */ 9368!global.!working_conf = Translate( !global.!!repository.!!working_dir.!!last_repository'admin'!global.!ossep'build.conf', !global.!ossep, '/' ) 9369!global.!targets = '' 9370If !global.!offline.!!last_repository Then 9371 Do 9372 /* 9373 * Read the config items from the "offline" file 9374 */ 9375 Call Stream !global.!working_conf'.offline', 'C', 'OPEN READ' 9376 Do While Lines( !global.!working_conf'.offline' ) > 0 9377 line = Linein( !global.!working_conf'.offline' ) 9378 If Length( Strip( line ) ) = 0 | Substr( line, 1, 1 ) = ';' Then Nop 9379 Else 9380 Do 9381 Parse Var line keyword '=' val 9382 Interpret '!GLOBAL.'keyword '=' val 9383 End 9384 End 9385 Call Stream !global.!working_conf'.offline', 'C', 'CLOSE' 9386 End 9387Else 9388 Do 9389 /* 9390 * Read the config items from the stack (if there are lines in the stack 9391 * or from !global.!working_conf) and write the "offline" file 9392 */ 9393 Call Stream !global.!working_conf'.offline', 'C', 'OPEN WRITE REPLACE' 9394/* 9395 If Queued() = 0 Then conf_from_file = 1 9396 Else conf_from_file = 0 9397 If conf_from_file Then 9398*/ 9399 Do 9400 If Stream( !global.!working_conf, 'C', 'QUERY EXISTS' ) = '' Then Call AbortText 'Problem accessing locally checked out build.conf file:' !global.!working_conf 9401 Call Stream !global.!working_conf, 'C', 'OPEN READ' 9402 Do While Lines( !global.!working_conf) > 0 9403 line = Linein( !global.!working_conf ) 9404 If Length( Strip( line ) ) = 0 | Substr( line, 1, 1 ) = ';' Then Nop 9405 Else 9406 Do 9407 Parse Var line keyword '=' val 9408 Interpret '!GLOBAL.'keyword '=' val 9409 Call Lineout !global.!working_conf'.offline', line 9410 End 9411 End 9412 Call Stream !global.!working_conf, 'C', 'CLOSE' 9413 End 9414/* 9415 Else 9416 Do 9417 Do Queued() 9418 Parse Pull line 9419 If Length( Strip( line ) ) = 0 | Substr( line, 1, 1 ) = ';' Then Nop 9420 Else 9421 Do 9422 Parse Var line keyword '=' val 9423 Interpret '!GLOBAL.'keyword '=' val 9424 Call Lineout !global.!working_conf'.offline', line 9425 End 9426 End 9427 End 9428*/ 9429 Call Stream !global.!working_conf'.offline', 'C', 'CLOSE' 9430 End 9431/* 9432 * One validation check to ensure we have set up the build.conf file 9433 * properly 9434 */ 9435If Left( !global.!admin_users, 1 ) = '!' Then 9436 Do 9437 Say 'This repository has not been correctly configured. Aborted.' 9438 Call CleanupAndExit 1 9439 End 9440 9441Return 9442 9443/* 9444 * Determine what permissions the user has. We translate any users here from the "real" userid to 9445 * the equivalent as specified in the repository properties. 9446 */ 9447SetupEnvironment: Procedure Expose !REXXDW. !global. !!last_repository 9448/* 9449 * Translate user here if appropriate 9450 */ 9451!global.!user = TranslateUser( !global.!user, !global.!user_mappings ) 9452If Wordpos( Translate( !global.!user ), Translate( !global.!admin_users ) ) = 0 Then !global.!administrator.!!last_repository='N' 9453Else !global.!administrator.!!last_repository = 'Y' 9454If Wordpos( Translate( !global.!user ), Translate( !global.!build_users ) ) = 0 Then !global.!build_user.!!last_repository='N' 9455Else !global.!build_user.!!last_repository = 'Y' 9456If Wordpos( Translate( !global.!user ), Translate( !global.!update_users ) ) = 0 Then !global.!update_user.!!last_repository='N' 9457Else !global.!update_user.!!last_repository = 'Y' 9458Return 9459 9460TranslateUser: Procedure Expose !REXXDW. 9461Parse Arg current, mappings 9462If Left( mappings, 1 ) = '!' | Strip( mappings ) = '' Then Return current 9463Do Forever 9464 Parse Var mappings from '=' to ',' mappings 9465 If Strip( Translate( from ) ) = Strip( Translate( current ) ) Then 9466 Do 9467 new = Strip( to ) 9468 Leave 9469 End 9470 If mappings = '' Then 9471 Do 9472 new = current 9473 Leave 9474 End 9475End 9476Return new 9477 9478GetModulesFromRepository: Procedure Expose !REXXDW. !global. !!last_repository 9479/* 9480 * Say what's happening... 9481 */ 9482Call SetCursorWait 9483If !global.!offline.!!last_repository Then Call DisplayStatus 'Reading modules from working directory...' 9484Else Call DisplayStatus 'Reading modules from repository...' 9485/* 9486 * Do some basic validation - this to go in a function that SetRepository() 9487 * calls!!! 9488 */ 9489Select 9490 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 9491 Do 9492 Call SysFileTree _root||!global.!ossep'RCS', '!GLOBAL.!REPDIR.!!LAST_REPOSITORY.', 'DTS' 9493 If !global.!repdir.!!last_repository.0 == 0 Then Call AbortText 'No RCS files under:' _root 9494 End 9495 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 9496 Do 9497 offline_directory_file = !global.!!repository.!!working_dir.!!last_repository||'admin/offline.dir.'!global.!!repository.!!name.!!last_repository 9498say .line offline_directory_file 9499 Select 9500 When !global.!offline.!!last_repository Then 9501 Do 9502 /* 9503 * When working offline, get the "repository" details from 9504 * the working directory's CVS/Entries files. Ensure that 9505 * the CVS/Repository items match the current repository. 9506 */ 9507 Call Stream offline_directory_file, 'C', 'OPEN READ' 9508 Do i = 1 While Lines( offline_directory_file ) > 0 9509 !global.!repdir.!!last_repository.i = Linein( offline_directory_file ) 9510 End 9511 i = i - 1 9512 !global.!repdir.!!last_repository.0 = i 9513 End 9514 When !global.!!repository.!!public_cvs.!!last_repository = 'Y' & Strip( !global.!!repository.!!public_cvs_dirs.!!last_repository ) \= '' Then 9515 Do 9516 /* 9517 * For each root directory, do an rdiff to build up the full tree 9518 */ 9519 idx = 0 9520 Call Stream offline_directory_file, 'C', 'OPEN WRITE REPLACE' 9521 Do j = 1 To Words( !global.!!repository.!!public_cvs_dirs.!!last_repository ) 9522 dir = Word( !global.!!repository.!!public_cvs_dirs.!!last_repository, j ) 9523 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'rdiff -s -D 1/1/2037' dir 9524 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 9525 Address Command cmd With Output Stem out. Error Stem err. 9526 Do i = 1 To err.0 9527 Parse Var err.i . 'Diffing' line 9528 line = '/'Strip( line ) 9529 If line \= '/.' & line \= '/' Then 9530 Do 9531 If line = '/CVSROOT' & !global.!superadministrator \= 'Y' Then Nop 9532 Else 9533 Do 9534 idx = idx + 1 9535 !global.!repdir.!!last_repository.idx = line 9536 Call Lineout offline_directory_file, line 9537 End 9538 End 9539 Else 9540 Do 9541 Queue err.i 9542 End 9543 End 9544 End 9545 !global.!repdir.!!last_repository.0 = idx 9546 If Queued() \= 0 Then 9547 Do 9548 Call WriteStackToLogWindow 'default', 'Getting modules' 9549 End 9550 Drop out. err. 9551 End 9552 Otherwise 9553 Do 9554 /* 9555 * Read the list of directories in the repository, ignoring . 9556 * This doesn't use CVSROOT/modules!! 9557 * While we are doing this, write a file into the admin directory for this 9558 * repository's working directory for running in offline mode 9559 */ 9560 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'rdiff -s -D 1/1/2037 .' 9561 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 9562 Address Command cmd With Output Stem out. Error FIFO '' 9563 idx = 0 9564 Call Stream offline_directory_file, 'C', 'OPEN WRITE REPLACE' 9565 Do i = 1 To Queued() 9566 Parse Pull . 'Diffing' line 9567 line = '/'Strip( line ) 9568 If line \= '/.' & line \= '/' Then 9569 Do 9570 If line = '/CVSROOT' & !global.!superadministrator \= 'Y' Then Nop 9571 Else 9572 Do 9573 idx = idx + 1 9574 !global.!repdir.!!last_repository.idx = line 9575 Call Lineout offline_directory_file, line 9576 End 9577 End 9578 End 9579 !global.!repdir.!!last_repository.0 = idx 9580 Drop out. 9581 End 9582 End 9583 Call Stream offline_directory_file, 'C', 'CLOSE' 9584 Call SysStemSort '!global.!repdir.!!last_repository.','ascending' ,!global.!!user.!!preference.!!sort, , , 1, 100 9585 End 9586 When !global.!!repository.!!type.!!last_repository = 'hg' Then 9587 Do 9588 /* 9589 * Read the list of files from the repository. 9590 * Get directories from filenames 9591 */ 9592 cmd = 'hg status -qA --cwd' !global.!!repository.!!working_dir.!!last_repository 9593 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 9594 Address Command cmd With Output FIFO '' Error Stem err. 9595 idx = 0 9596 Do i = 1 To Queued() 9597 Parse Pull status line 9598 If status = '?' Then Iterate 9599 pos = LastPos( '/', line ) 9600 If pos = 0 Then Iterate 9601 dir = '/'Left( line, pos - 1 ) 9602 -- do we already have the directory? 9603 found = 0 9604 Do j = 1 To idx 9605 If !global.!repdir.!!last_repository.j = dir Then 9606 Do 9607 found = 1 9608 Leave 9609 End 9610 End 9611 If found = 0 Then 9612 Do 9613 idx = idx + 1 9614 !global.!repdir.!!last_repository.idx = dir 9615say .line added dir 9616 End 9617 End 9618 !global.!repdir.!!last_repository.0 = idx 9619say .line count idx 9620 Drop out. 9621 Call SysStemSort '!global.!repdir.!!last_repository.','ascending' ,!global.!!user.!!preference.!!sort, , , 1, 100 9622 End 9623 Otherwise Call AbortText 'Cannot handle repository of type:' !global.!!repository.!!type.!!last_repository 9624End 9625Call SetCursorNoWait 9626Call DisplayStatus '' 9627Return 9628 9629GenerateTree: Procedure Expose !REXXDW. !global. !!last_repository 9630/* 9631 * If the tree has already been created, destroy it first 9632 */ 9633If !global.!tree.!!last_repository \= -1 Then Call dw_window_destroy( !global.!tree.!!last_repository ) 9634!global.!tree.!!last_repository = dw_tree_new( 201 ) 9635Call dw_box_pack_start !global.!treebox.!!last_repository, !global.!tree.!!last_repository, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 1 9636/*Call dw_window_set_font !global.!tree.!!last_repository, !global.!fixedfont *//* MH */ 9637/* 9638 * Setup our signals. On a tree, these MUST be done before we populate the tree. 9639 */ 9640Call dw_signal_connect !global.!tree.!!last_repository, !REXXDW.!DW_ITEM_SELECT_EVENT, 'DirSelectCallback' 9641Call dw_signal_connect !global.!tree.!!last_repository, !REXXDW.!DW_ITEM_CONTEXT_EVENT, 'DirMenuCallback' 9642Select 9643 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 9644 Do 9645 /* TODO */ 9646 drive = '' 9647 Do i = 1 To !global.!repdir.!!last_repository.0 9648 Parse Var !global.!repdir.!!last_repository.i . . . fn 9649 fn = Changestr(_root,fn,'') /* MH */ 9650 If Substr(fn,2,1) = ':' Then 9651 Do 9652 drive = Substr(fn,1,2) 9653 fn = Substr(fn,3) 9654 End 9655 fn = Translate(fn,' ','/') 9656 dir = '' 9657 Do j = 1 To Words(fn) 9658 If Word(fn,j) \= 'RCS' Then 9659 Do 9660 dir = dir'/'Word(fn,j) 9661 imagetype = DetermineImageType( dir, !!last_repository ) 9662 Call TkTreeAddNode my_treewin, dir, '-image', imagetype, '-tags', 'dir' 9663 End 9664 End 9665 End 9666 If Left( !global.!!repository.!!last_tree_opened.!!last_repository, 9 ) = '!GLOBAL.!!' Then 9667 Do 9668 !global.!!repository.!!last_tree_opened.!!last_repository = _root 9669 End 9670 openat = !global.!!repository.!!last_tree_opened.!!last_repository 9671 End 9672 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 9673 Do 9674 /* 9675 * Add the repository name as the root 9676 */ 9677 idx = DetermineModuleIcon( ) 9678 icon = !global.!moduleicon.idx 9679 !global.!treeparentitem.!!last_repository = dw_tree_insert( !global.!tree.!!last_repository, '['!global.!!repository.!!name.!!last_repository']', icon, 0, '0' ) 9680 If Left( !global.!!repository.!!last_tree_opened.!!last_repository, 1 ) = '!' Then 9681 Do 9682 !global.!!repository.!!last_tree_opened.!!last_repository = '.'_root 9683 End 9684 openat = 0 9685 Do i = 1 To !global.!repdir.!!last_repository.0 9686 mydir = !global.!repdir.!!last_repository.i 9687 If Wordpos( Translate( !global.!user ), Translate( !global.!admin_users ) ) = 0 & mydir = '/admin' Then Iterate 9688 Parse Value DetermineModuleIconAndName( mydir ) With icon currentdir 9689 pos = Lastpos( '/', mydir ) 9690 parent = Substr( mydir, 1, pos-1 ) 9691 parentidx = FindTreeItem( parent ) 9692 If parentidx = 0 Then parentitem = !global.!treeparentitem.!!last_repository 9693 Else parentitem = !global.!treeitem.!!last_repository.parentidx 9694 !global.!treeitem.!!last_repository.i = dw_tree_insert( !global.!tree.!!last_repository, currentdir, icon, parentitem, parentitem !global.!repdir.!!last_repository.i ) 9695 /* 9696 * Is this tree item the one we last opened ? 9697 */ 9698 If !global.!repdir.!!last_repository.i = '/'!global.!!repository.!!last_tree_opened.!!last_repository Then openat = i 9699 End 9700 /* 9701 * Expand the tree and all its parents at the last directory, if 9702 * there was one 9703 */ 9704 If openat = 0 Then 9705 Do 9706 /* 9707 * Set the current_dirname 9708 */ 9709 !global.!current_dirname.!!last_repository = '.' 9710 /* 9711 * Set the parent tree item as the selected item 9712 */ 9713 Call dw_tree_item_select !global.!tree.!!last_repository, !global.!treeparentitem.!!last_repository 9714 !global.!selected_treeitem.!!last_repository = !global.!treeparentitem.!!last_repository 9715 End 9716 Else 9717 Do 9718 /* 9719 * Set the current_dirname 9720 */ 9721 !global.!current_dirname.!!last_repository = Substr( !global.!repdir.!!last_repository.openat, 2 ) 9722 /* 9723 * Open the tree at the index 9724 */ 9725 Call OpenTreeAt openat 9726 End 9727 End 9728 -- TODO the following code is identical to the CVS code above 9729 When !global.!!repository.!!type.!!last_repository = 'hg' Then 9730 Do 9731 /* 9732 * Add the repository name as the root 9733 */ 9734 idx = DetermineModuleIcon( ) 9735 icon = !global.!moduleicon.idx 9736 !global.!treeparentitem.!!last_repository = dw_tree_insert( !global.!tree.!!last_repository, '['!global.!!repository.!!name.!!last_repository']', icon, 0, '0' ) 9737 If Left( !global.!!repository.!!last_tree_opened.!!last_repository, 1 ) = '!' Then 9738 Do 9739 !global.!!repository.!!last_tree_opened.!!last_repository = '.'_root 9740 End 9741 openat = 0 9742 Do i = 1 To !global.!repdir.!!last_repository.0 9743 mydir = !global.!repdir.!!last_repository.i 9744 If Wordpos( Translate( !global.!user ), Translate( !global.!admin_users ) ) = 0 & mydir = '/admin' Then Iterate 9745 Parse Value DetermineModuleIconAndName( mydir ) With icon currentdir 9746 pos = Lastpos( '/', mydir ) 9747 parent = Substr( mydir, 1, pos-1 ) 9748 parentidx = FindTreeItem( parent ) 9749 If parentidx = 0 Then parentitem = !global.!treeparentitem.!!last_repository 9750 Else parentitem = !global.!treeitem.!!last_repository.parentidx 9751 !global.!treeitem.!!last_repository.i = dw_tree_insert( !global.!tree.!!last_repository, currentdir, icon, parentitem, parentitem !global.!repdir.!!last_repository.i ) 9752 /* 9753 * Is this tree item the one we last opened ? 9754 */ 9755 If !global.!repdir.!!last_repository.i = '/'!global.!!repository.!!last_tree_opened.!!last_repository Then openat = i 9756 End 9757 /* 9758 * Expand the tree and all its parents at the last directory, if 9759 * there was one 9760 */ 9761 If openat = 0 Then 9762 Do 9763 /* 9764 * Set the current_dirname 9765 */ 9766 !global.!current_dirname.!!last_repository = '.' 9767 /* 9768 * Set the parent tree item as the selected item 9769 */ 9770 Call dw_tree_item_select !global.!tree.!!last_repository, !global.!treeparentitem.!!last_repository 9771 !global.!selected_treeitem.!!last_repository = !global.!treeparentitem.!!last_repository 9772 End 9773 Else 9774 Do 9775 /* 9776 * Set the current_dirname 9777 */ 9778 !global.!current_dirname.!!last_repository = Substr( !global.!repdir.!!last_repository.openat, 2 ) 9779 /* 9780 * Open the tree at the index 9781 */ 9782 Call OpenTreeAt openat 9783 End 9784 End 9785 Otherwise Nop 9786End 9787 9788Select 9789 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 9790 Do 9791 /* 9792 * Prepend the root dir 9793 */ 9794 !global.!current_dirname.!!last_repository = _root||!global.!ossep||!global.!current_dirname.!!last_repository 9795 !global.!current_working_dir.!!last_repository = FindWorkingDirectory( !global.!current_dirname.!!last_repository ) 9796 End 9797 Otherwise 9798 Do 9799 /* 9800 !global.!current_working_dir.!!last_repository = FindWorkingDirectory( !global.!current_dirname.!!last_repository ) 9801 */ 9802 End 9803End 9804Call SetLockedStatusIcon 9805Return 9806 9807OpenTreeAt: Procedure Expose !REXXDW. !global. !!last_repository 9808Parse Arg openat 9809parentitem = !global.!treeitem.!!last_repository.openat 9810/* 9811 * GTK 2.0 at least requires that tree items are expanded from the top down. 9812 * So we have to determine all of the tree items for the child and all 9813 * its parents, and expand them in reverse order. 9814 */ 9815parentids = parentitem 9816Do Forever 9817 Parse Value dw_tree_item_get_data( !global.!tree.!!last_repository, parentitem ) With parentitem . 9818 If parentitem = 0 Then Leave 9819 parentids = parentitem parentids 9820End 9821/* 9822 * Open the tree items... 9823 */ 9824Do i = 1 To Words( parentids ) 9825 parentitem = Word( parentids, i ) 9826 Call dw_tree_item_expand !global.!tree.!!last_repository, parentitem 9827End 9828/* 9829 * Set this tree item as the selected item 9830 */ 9831Call dw_tree_item_select !global.!tree.!!last_repository, !global.!treeitem.!!last_repository.openat 9832!global.!selected_treeitem.!!last_repository = !global.!treeitem.!!last_repository.openat 9833Return 9834 9835DisplayRepositoryFiles: Procedure Expose !REXXDW. !global. !!last_repository 9836Call DisplayStatus 'Reading files for current directory...' 9837Select 9838 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 9839 Do 9840 mydir = drive||!global.!current_dirname.!!last_repository||!global.!ossep'RCS' 9841 here = Directory() 9842 Call Directory mydir 9843 Call SysFileTree '*,v', 'ITEM.', 'FL' 9844 Do i = 1 To item.0 9845 newi = Right(i,4) 9846 Parse Var item.i 1 filedate 20 . . filename ',v' . 9847 !global.!repfiles.?filedate.!!last_repository.i = newi||Strip( filedate ) /* TODO - convert to time_t */ 9848 !global.!repfiles.?fullfilename.!!last_repository.i = newi||mydir||!global.!ossep||filename||',v' 9849 !global.!repfiles.?user.!!last_repository.i = newi||GetRCSLocker( Substr( !global.!repfiles.?fullfilename.!!last_repository.i, 5 ) ) 9850 !global.!repfiles.?filename.!!last_repository.i = newi||filename 9851 End 9852 !global.!repfiles.?fullfilename.!!last_repository.0 = item.0 9853 !global.!repfiles.?filename.!!last_repository.0 = item.0 9854 !global.!repfiles.?filedate.!!last_repository.0 = item.0 9855 !global.!repfiles.?user.!!last_repository.0 = item.0 9856 Drop item. 9857 Call Directory here 9858 Call DetermineRCSStatusIcons 9859 Call SortFileArray 9860 Call DisplayFileArray 9861 !global.!!repository.!!last_tree_opened.!!last_repository = Changestr( _root||!global.!ossep, !global.!current_dirname, '' ) 9862 End 9863 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 9864 Do 9865 If !global.!offline.!!last_repository Then 9866 Do 9867 entries = !global.!!repository.!!working_dir.!!last_repository||!global.!current_dirname.!!last_repository||!global.!ossep'CVS/Entries' 9868 Call Stream entries, 'C', 'OPEN READ' 9869 item_idx = 0 9870 label_idx = 0 9871 Do While Lines( entries ) > 0 9872 line = Linein( entries ) 9873 If Left( line, 1 ) \= 'D' Then 9874 Do 9875 Parse Var line '/' filename '/' rev '/' date '/' . 9876 If Left( filename, 7 ) = '.label-' Then 9877 Do 9878 label_idx = label_idx + 1 9879 Parse Var filename '.label-' !global.!label.label_idx 9880 End 9881 Else 9882 Do 9883 If Datatype( Word( date, 3 ) ) \= 'NUM' Then 9884 Do 9885 filedate = '*Unknown*' 9886 End 9887 Else 9888 Do 9889 /* 9890 * Get date/time in Thu Aug 8 10:58:48 2002 format (localtime) 9891 * and convert to time_t 9892 */ 9893 Parse Var date . mon day time year 9894 filedate = Right( DateTimeToTime_T( day mon year, time, 'N', 1 ), 12, '0' ) 9895 End 9896 item_idx = item_idx + 1 9897 newi = Right( item_idx, 4 ) 9898 !global.!repfiles.?filerev.!!last_repository.item_idx = newi||rev 9899 !global.!repfiles.?user.!!last_repository.item_idx = newi||'*Unknown*' 9900 !global.!repfiles.?filedate.!!last_repository.item_idx = newi||filedate 9901 !global.!repfiles.?filename.!!last_repository.item_idx = newi||filename 9902 !global.!repfiles.?fullfilename.!!last_repository.item_idx = newi||!global.!current_dirname.!!last_repository||!global.!ossep||filename 9903 !global.!repfiles.?filestatus.!!last_repository.item_idx = newi||'fileunknown' 9904 type = IsBinaryFile( !global.!current_dirname.!!last_repository||!global.!ossep||filename ) 9905 !global.!repfiles.?filetype.!!last_repository.item_idx = newi || DetermineFileType( type, !global.!user, '' ) 9906 !global.!repfiles.?filereminder.!!last_repository.item_idx = newi'blank' 9907 End 9908 End 9909 End 9910 item.0 = item_ 9911 !global.!label.0 = label_idx 9912 Call Stream entries, 'C', 'CLOSE' 9913 End 9914 Else 9915 Do 9916 /* 9917 * Returns all files in item. stem 9918 */ 9919 Call GetListOfCVSFilesInDirectory !!last_repository, !global.!current_dirname.!!last_repository, 1 9920 -- log errors in red if there were any 9921 Call dw_mle_freeze !global.!mle.!!last_repository 9922 Do wtfi = 1 To err.0 9923 Call WriteMessageToLogWindow ' 'err.wtfi, 'redfore' 9924 End 9925 Call dw_mle_thaw !global.!mle.!!last_repository 9926 item_idx = 0 9927 label_idx = 0 9928 If !global.!current_dirname.!!last_repository = '.' | !global.!current_dirname.!!last_repository = '' Then fname_offset = 1 9929 Else fname_offset = Length(!global.!current_dirname.!!last_repository)+2 9930 Do i = 1 To item.0 9931 If Left( item.i, 1 ) = '?' Then Iterate -- some platforms return unknown files in stdout 9932 Parse Var item.i 1 . 12 rev 28 user 64 filedate 75 filetime 84 type 88 flen 91 rem 9933 Parse Var item.i 92 filename +(flen) +1 locks 9934 add_file = 1 9935 /* 9936 * If the file is a label, then add it to the list of labels... 9937 */ 9938 If Left( Substr( filename, fname_offset ), 7 ) = '.label-' Then 9939 Do 9940 label_idx = label_idx + 1 9941 Parse Var filename . '.label-' !global.!label.label_idx 9942 /* 9943 * ...and if we are a repository admin, then add the labels into the file list 9944 */ 9945 If !global.!superadministrator = 'N' Then add_file = 0 9946 End 9947 If add_file Then 9948 Do 9949 item_idx = item_idx + 1 9950 newi = Right( item_idx, 4 ) 9951 /* 9952 * MUST set filenames before setting the remainder of the attributes 9953 */ 9954 !global.!repfiles.?fullfilename.!!last_repository.item_idx = newi||Strip( filename ) 9955 !global.!repfiles.?filename.!!last_repository.item_idx = newi||Strip( Substr( filename, fname_offset ) ) 9956 filedate = Strip( filedate ) 9957 filetime = Strip( filetime ) 9958 /* 9959 * Ensure that we don't attempt to get the CVS status for each 9960 * individual file; it is too slow. We do this in bulk later... 9961 */ 9962 Call SetCVSFileDetails 'BULK', item_idx, newi, 'arg not used', filedate, filetime, type, rev, user, locks 9963 !global.!repfiles.?filestatus.!!last_repository.item_idx = newi 9964 End 9965 End 9966 End 9967 !global.!repfiles.?filerev.!!last_repository.0 = item_idx 9968 !global.!repfiles.?fullfilename.!!last_repository.0 = item_idx 9969 !global.!repfiles.?filename.!!last_repository.0 = item_idx 9970 !global.!repfiles.?filedate.!!last_repository.0 = item_idx 9971 !global.!repfiles.?user.!!last_repository.0 = item_idx 9972 !global.!repfiles.?filestatus.!!last_repository.0 = item_idx 9973 !global.!repfiles.?filereminder.!!last_repository.0 = item_idx 9974 !global.!repfiles.?filetype.!!last_repository.0 = item_idx 9975 !global.!label.0 = label_idx 9976 Drop item. 9977 /* 9978 * We now need to determine the CVS status of all files in the current 9979 * directory, because the above call to SetCVSFileDetails() does NOT get 9980 * the status for each file as it has to do this with a server call for 9981 * each file and this can be very slow! 9982 */ 9983 Call DetermineCVSStatusIcons 9984 Call SortFileArray 9985 Call DisplayFileArray 9986 !global.!!repository.!!last_tree_opened.!!last_repository = !global.!current_dirname.!!last_repository 9987 End 9988 When !global.!!repository.!!type.!!last_repository = 'hg' Then 9989 Do 9990 /* 9991 * Returns all files in item. stem 9992 */ 9993 Call GetListOfHGFilesInDirectory !!last_repository, !global.!current_dirname.!!last_repository, 1 9994 -- log errors in red if there were any 9995 Call dw_mle_freeze !global.!mle.!!last_repository 9996 Do wtfi = 1 To err.0 9997 Call WriteMessageToLogWindow ' 'err.wtfi, 'redfore' 9998 End 9999 Call dw_mle_thaw !global.!mle.!!last_repository 10000 item_idx = 0 10001 label_idx = 0 10002 10003 If !global.!current_dirname.!!last_repository = '.' | !global.!current_dirname.!!last_repository = '' Then fname_offset = 1 10004 Else fname_offset = Length(!global.!current_dirname.!!last_repository)+2 10005 Do i = 1 To item.0 10006 locks = '' 10007 Parse Var item.i filename '%rev%' rev '%status%' status '%date%' date offset '%author%' user '%filetype%' filetype '%end%' 10008 add_file = 1 10009 /* 10010 * If the file is a label, then add it to the list of labels... 10011 */ 10012 If Left( Substr( filename, fname_offset ), 7 ) = '.label-' Then 10013 Do 10014 label_idx = label_idx + 1 10015 Parse Var filename . '.label-' !global.!label.label_idx 10016 /* 10017 * ...and if we are a repository admin, then add the labels into the file list 10018 */ 10019 If !global.!superadministrator = 'N' Then add_file = 0 10020 End 10021 If add_file Then 10022 Do 10023say .line filename rev status date offset user filetype 10024 filedate = date + offset 10025 item_idx = item_idx + 1 10026 newi = Right( item_idx, 4 ) 10027 /* 10028 * MUST set filenames before setting the remainder of the attributes 10029 */ 10030 !global.!repfiles.?fullfilename.!!last_repository.item_idx = newi||Strip( filename ) 10031 !global.!repfiles.?filename.!!last_repository.item_idx = newi||Strip( Substr( filename, fname_offset ) ) 10032 filedate = Strip( filedate ) 10033 filetime = Strip( filetime ) 10034 filetype = Strip( filetype ) 10035 /* 10036 * TODO how to get filestatus; ie is it binary or text???? 10037 */ 10038 Call SetHGFileDetails 'BULK', item_idx, newi, 'arg not used', filedate, filetime, filetype, status, rev, user, locks 10039-- !global.!repfiles.?filestatus.!!last_repository.item_idx = newi 10040 End 10041 End 10042say .line 'item_idx:' item_idx 10043 !global.!repfiles.?filerev.!!last_repository.0 = item_idx 10044 !global.!repfiles.?fullfilename.!!last_repository.0 = item_idx 10045 !global.!repfiles.?filename.!!last_repository.0 = item_idx 10046 !global.!repfiles.?filedate.!!last_repository.0 = item_idx 10047 !global.!repfiles.?user.!!last_repository.0 = item_idx 10048 !global.!repfiles.?filestatus.!!last_repository.0 = item_idx 10049 !global.!repfiles.?filereminder.!!last_repository.0 = item_idx 10050 !global.!repfiles.?filetype.!!last_repository.0 = item_idx 10051 !global.!label.0 = label_idx 10052 Drop item. 10053 /* 10054 * We now need to determine the HG status of all files in the current 10055 * directory, because the above call to SetHGFileDetails() does NOT get 10056 * the status for each file as it has to do this with a server call for 10057 * each file and this can be very slow! 10058 */ 10059-- Call DetermineHGStatusIcons 10060 Call SortFileArray 10061 Call DisplayFileArray 10062 !global.!!repository.!!last_tree_opened.!!last_repository = !global.!current_dirname.!!last_repository 10063 End 10064 Otherwise Nop 10065End 10066Call DisplayStatus '' 10067Return 0 10068 10069DisplayNonrepositoryFiles: Procedure Expose !REXXDW. !global. !!last_repository 10070/* 10071If !global.!current_dirname.!!last_repository = '' Then repdir = '.' 10072Else repdir = !global.!current_dirname.!!last_repository 10073*/ 10074repdir = Stream( Strip( !global.!!repository.!!working_dir.!!last_repository, 'T', '/' ), 'C', 'QUERY EXISTS' ) || !global.!ossep 10075lenwd = Length( repdir ) 10076If !global.!current_dirname.!!last_repository = '.' Then repdir = Left( repdir, Length( repdir ) - 1 ) 10077Else repdir = repdir || !global.!current_dirname.!!last_repository 10078lenrepdir = Length( repdir ) 10079if trace() = 'F' Then say repdir 10080If Stream( repdir, 'C','QUERY EXISTS' ) = '' Then newfile.0 = 0 10081Else Call SysFileTree repdir'/*', 'NEWFILE.', 'DL' 10082/* 10083 * Limit the list to those directories that are NOT already in the repository... 10084 */ 10085idx = 0 10086Do i = 1 To newfile.0 10087 Parse Var newfile.i date time size perm dir 10088 /* 10089 * Determine if "dir" is in the repository 10090 */ 10091 If Countstr( !global.!ossep, dir ) \= 0 Then dir = Translate( dir, '/', !global.!ossep ) 10092 If FindTreeItem( '/'Substr( dir, 1 + lenwd ) ) \= 0 Then Iterate 10093 10094 dirname = Substr( dir, 2 + lenrepdir ) 10095 /* 10096 * For CVS ignore the CVS directory 10097 */ 10098 If !global.!!repository.!!type.!!last_repository = 'cvs' & dirname = 'CVS' Then Iterate 10099 idx = idx + 1 10100 fidx = Right( idx, 4 ) 10101 !global.!nonrepfiles.?fullfilename.!!last_repository.idx = fidx||dir 10102 !global.!nonrepfiles.?filename.!!last_repository.idx = fidx||dirname 10103 date = Changestr( '-', date, '' ) /* date now in 'S' format */ 10104 date = Right( DateTimeToTime_T( date, time, 'S', 0 ), 12, '0' ) 10105 !global.!nonrepfiles.?filedate.!!last_repository.idx = fidx||date 10106 !global.!nonrepfiles.?filesize.!!last_repository.idx = fidx||Right( size, 12 ) 10107 !global.!nonrepfiles.?fileperm.!!last_repository.idx = fidx||perm 10108 !global.!nonrepfiles.?filetype.!!last_repository.idx = fidx||'dir' 10109End 10110/* 10111 * List files... 10112 */ 10113If Stream( repdir, 'C','QUERY EXISTS' ) = '' Then newfile.0 = 0 10114Else Call SysFileTree repdir'/*', 'NEWFILE.', 'FL' 10115Do i = 1 To newfile.0 10116 Parse Var newfile.i date time size perm file 10117 /* 10118 * Determine if "file" is in the repository 10119 */ 10120 If Countstr( !global.!ossep, file ) \= 0 Then file = Translate( file, '/', !global.!ossep ) 10121 If FileIsInRepository( Substr( file, 1 + lenwd ) ) Then Iterate 10122 10123 filename = Substr( file, 2 + lenrepdir ) 10124 /* 10125 * Check if the file is a regular file 10126 */ 10127 If Length( perm ) = 10 & Left( perm, 1 ) \= '-' Then Iterate 10128 /* 10129 If Word( Stream( file, 'C', 'FSTAT' ), 8 ) \= 'RegularFile' Then Iterate 10130 */ 10131 /* 10132 * Now ignore some other files... 10133 */ 10134 /* 10135 * Ignore files in the !ignorefiles list 10136 */ 10137 If IsFileTypeIgnored( file ) Then Iterate 10138 If Left( filename, 7 ) = '.label-' Then Iterate 10139 If Left( file, 16 ) = 'admin/build.conf' Then Iterate 10140 If Left( file, 24 ) = 'admin/build.conf.offline' Then Iterate 10141 If Left( file, 17 ) = 'admin/offline.dir' Then Iterate 10142 /* 10143 * Now add the files... 10144 */ 10145 idx = idx + 1 10146 fidx = Right( idx, 4 ) 10147 !global.!nonrepfiles.?fullfilename.!!last_repository.idx = fidx||file 10148 !global.!nonrepfiles.?filename.!!last_repository.idx = fidx||filename 10149 date = Changestr( '-', date, '' ) /* date now in 'S' format */ 10150 date = Right( DateTimeToTime_T( date, time, 'S', 0 ), 12, '0' ) 10151 !global.!nonrepfiles.?filedate.!!last_repository.idx = fidx||date 10152 !global.!nonrepfiles.?filesize.!!last_repository.idx = fidx||Right( size, 12 ) 10153 !global.!nonrepfiles.?fileperm.!!last_repository.idx = fidx||perm 10154 !global.!nonrepfiles.?filetype.!!last_repository.idx = fidx||'file' 10155 If IsBinaryFile( file ) Then !global.!nonrepfiles.?filetype.!!last_repository.idx = fidx||'binary file' 10156 Else !global.!nonrepfiles.?filetype.!!last_repository.idx = fidx||'text file' 10157End 10158!global.!nonrepfiles.?fullfilename.!!last_repository.0 = idx 10159!global.!nonrepfiles.?filename.!!last_repository.0 = idx 10160!global.!nonrepfiles.?filedate.!!last_repository.0 = idx 10161!global.!nonrepfiles.?filesize.!!last_repository.0 = idx 10162!global.!nonrepfiles.?fileperm.!!last_repository.0 = idx 10163!global.!nonrepfiles.?filetype.!!last_repository.0 = idx 10164/* 10165 * Now sort an display the list of non-rep files. 10166 */ 10167Call SortNonrepFileArray 10168Call DisplayNonRepFileArray 10169Return 10170 10171/* 10172 * Populates the "All Files" tab based on the currently selected filter 10173 */ 10174DisplayAllFiles: Procedure Expose !REXXDW. !global. !!last_repository 10175Call SetCursorWait 10176Call DisplayStatus 'Reading files for current directory and below...' 10177Select 10178 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 10179 Do 10180 mydir = drive||!global.!current_dirname.!!last_repository||!global.!ossep'RCS' 10181 here = Directory() 10182 Call Directory mydir 10183 Call SysFileTree '*,v', 'ITEM.', 'FLS' 10184 Do i = 1 To item.0 10185 newi = Right(i,4) 10186 Parse Var item.i 1 filedate 20 . . filename ',v' . 10187 !global.!allfiles.?filedate.!!last_repository.i = newi||Strip( filedate ) /* TODO - convert to time_t */ 10188 !global.!allfiles.?fullfilename.!!last_repository.i = newi||mydir||!global.!ossep||filename||',v' 10189 !global.!allfiles.?user.!!last_repository.i = newi||GetRCSLocker( Substr( !global.!allfiles.?fullfilename.!!last_repository.i, 5 ) ) 10190 pos = Lastpos( '/', filename ) 10191 !global.!allfiles.?filename.!!last_repository.i = newi||Substr( filename, pos + 1 ) 10192 If pos = 0 Then 10193 !global.!allfiles.?filepath.!!last_repository.i = newi 10194 Else 10195 !global.!allfiles.?filepath.!!last_repository.i = newi||Left( filename, pos ) 10196 End 10197 !global.!allfiles.?fullfilename.!!last_repository.0 = item.0 10198 !global.!allfiles.?filename.!!last_repository.0 = item.0 10199 !global.!allfiles.?filepath.!!last_repository.0 = item.0 10200 !global.!allfiles.?filedate.!!last_repository.0 = item.0 10201 !global.!allfiles.?user.!!last_repository.0 = item.0 10202 Drop item. 10203 Call Directory here 10204 Call DetermineRCSStatusIcons 10205 Call SortFileArray 10206 Call DisplayFileArray 10207 !global.!!repository.!!last_tree_opened.!!last_repository = Changestr( _root||!global.!ossep, !global.!current_dirname, '' ) 10208 End 10209 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 10210 Do 10211 If !global.!offline.!!last_repository Then 10212 Do 10213 /* TODO */ 10214 entries = !global.!!repository.!!working_dir.!!last_repository||!global.!current_dirname.!!last_repository||!global.!ossep'CVS/Entries' 10215 Call Stream entries, 'C', 'OPEN READ' 10216 item_idx = 0 10217 label_idx = 0 10218 Do While Lines( entries ) > 0 10219 line = Linein( entries ) 10220 If Left( line, 1 ) \= 'D' Then 10221 Do 10222 Parse Var line '/' filename '/' rev '/' date '/' . 10223 If Left( filename, 7 ) = '.label-' Then 10224 Do 10225 label_idx = label_idx + 1 10226 Parse Var filename '.label-' !global.!label.label_idx 10227 End 10228 Else 10229 Do 10230 If Datatype( Word( date, 3 ) ) \= 'NUM' Then 10231 Do 10232 filedate = '*Unknown*' 10233 End 10234 Else 10235 Do 10236 /* 10237 * Get date/time in Thu Aug 8 10:58:48 2002 format (localtime) 10238 * and convert to time_t 10239 */ 10240 Parse Var date . mon day time year 10241 filedate = Right( DateTimeToTime_T( day mon year, time, 'N', 1 ), 12, '0' ) 10242 End 10243 item_idx = item_idx + 1 10244 newi = Right( item_idx, 4 ) 10245 !global.!allfiles.?filerev.!!last_repository.item_idx = newi||rev 10246 !global.!allfiles.?user.!!last_repository.item_idx = newi||'*Unknown*' 10247 !global.!allfiles.?filedate.!!last_repository.item_idx = newi||filedate 10248 pos = Lastpos( '/', filename ) 10249 !global.!allfiles.?filename.!!last_repository.item_idx = newi||Substr( filename, pos + 1 ) 10250 If pos = 0 Then 10251 !global.!allfiles.?filepath.!!last_repository.item_idx = newi 10252 Else 10253 !global.!allfiles.?filepath.!!last_repository.item_idx = newi||Left( filename, pos ) 10254 !global.!allfiles.?fullfilename.!!last_repository.item_idx = newi||!global.!current_dirname.!!last_repository||!global.!ossep||filename 10255 !global.!allfiles.?filestatus.!!last_repository.item_idx = newi||'fileunknown' 10256 type = IsBinaryFile( !global.!current_dirname.!!last_repository||!global.!ossep||filename ) 10257 !global.!allfiles.?filetype.!!last_repository.item_idx = newi || DetermineFileType( type, !global.!user, '' ) 10258 !global.!allfiles.?filereminder.!!last_repository.item_idx = newi'blank' 10259 End 10260 End 10261 End 10262 item.0 = item_ 10263 !global.!label.0 = label_idx 10264 Call Stream entries, 'C', 'CLOSE' 10265 End 10266 Else 10267 Do 10268 /* 10269 * Returns all files in item. stem 10270 */ 10271 Call GetListOfCVSFilesInDirectory !!last_repository, !global.!current_dirname.!!last_repository, 0 10272 item_idx = 0 10273 label_idx = 0 10274 If !global.!current_dirname.!!last_repository = '.' | !global.!current_dirname.!!last_repository = '' Then fname_offset = 1 10275 Else fname_offset = Length(!global.!current_dirname.!!last_repository)+2 10276 Do i = 1 To item.0 10277 Parse Var item.i 1 . 12 rev 28 user 64 filedate 75 filetime 84 type 88 flen 91 rem 10278 Parse Var item.i 92 filename +(flen) +1 locks 10279 add_file = 1 10280 /* 10281 * If the file is a label, then add it to the list of labels... 10282 */ 10283 If Left( Substr( filename, fname_offset ), 7 ) = '.label-' Then 10284 Do 10285 label_idx = label_idx + 1 10286 Parse Var filename . '.label-' !global.!label.label_idx 10287 /* 10288 * ...and if we are a repository admin, then add the labels into the file list 10289 */ 10290 If !global.!superadministrator = 'N' Then add_file = 0 10291 End 10292 /* 10293 * If filename starts with "CVSROOT/" and NOT administrator, then 10294 * don't add the file 10295 * Same for "admin/" 10296 */ 10297 If Left( filename, 8) = 'CVSROOT/' & !global.!superadministrator \= 'Y' Then add_file = 0 10298 If Wordpos( Translate( !global.!user ), Translate( !global.!admin_users ) ) = 0 & Left( filename, 6) = 'admin/' Then add_file = 0 10299 If add_file Then 10300 Do 10301 item_idx = item_idx + 1 10302 newi = Right( item_idx, 4 ) 10303 /* 10304 * MUST set filenames before setting the remainder of the attributes 10305 */ 10306 !global.!allfiles.?fullfilename.!!last_repository.item_idx = newi||Strip( filename ) 10307 _fn = Strip( Substr( filename, fname_offset ) ) 10308 pos = Lastpos( '/', _fn ) 10309 !global.!allfiles.?filename.!!last_repository.item_idx = newi||Substr( _fn, pos + 1 ) 10310 If pos = 0 Then 10311 !global.!allfiles.?filepath.!!last_repository.item_idx = newi 10312 Else 10313 !global.!allfiles.?filepath.!!last_repository.item_idx = newi||Left( _fn, pos ) 10314 filedate = Strip( filedate ) 10315 filetime = Strip( filetime ) 10316 /* 10317 * Ensure that we don't attempt to get the CVS status for each 10318 * individual file; it is too slow. We do this in bulk later... 10319 */ 10320 Call SetCVSAllFileDetails 'BULK', item_idx, newi, 'arg not used', filedate, filetime, type, rev, user, locks 10321 End 10322 End 10323 End 10324 !global.!allfiles.?filerev.!!last_repository.0 = item_idx 10325 !global.!allfiles.?fullfilename.!!last_repository.0 = item_idx 10326 !global.!allfiles.?filename.!!last_repository.0 = item_idx 10327 !global.!allfiles.?filepath.!!last_repository.0 = item_idx 10328 !global.!allfiles.?filedate.!!last_repository.0 = item_idx 10329 !global.!allfiles.?user.!!last_repository.0 = item_idx 10330 !global.!allfiles.?filestatus.!!last_repository.0 = item_idx 10331 !global.!allfiles.?filereminder.!!last_repository.0 = item_idx 10332 !global.!allfiles.?filetype.!!last_repository.0 = item_idx 10333 !global.!label.0 = label_idx 10334 Drop item. 10335 /* 10336 * We now need to determine the CVS status of all files in the current 10337 * directory, because the above call to SetCVSFileDetails() does NOT get 10338 * the status for each file as it has to do this with a server call for 10339 * each file and this can be very slow! 10340 */ 10341 Call DetermineCVSStatusIconsAll 10342 /* 10343 * Now we have all of the CVS statii for each file, go and filter them based on the file filters 10344 * for the current repository. 10345 */ 10346 Call ApplyFileFiltering 10347 Call SortAllFileArray 10348 Call DisplayAllFileArray 10349 !global.!!repository.!!last_tree_opened.!!last_repository = !global.!current_dirname.!!last_repository 10350 End 10351 Otherwise Nop 10352End 10353Call ShowFileFilters 10354Call SetCursorNoWait 10355Call DisplayStatus '' 10356Return 0 10357 10358DisplayNonRepFileArray: Procedure Expose !REXXDW. !global. !!last_repository 10359moduleicon_idx = Wordpos( 'modulecheckedout', !global.!moduleicons ) 10360binaryfileicon_idx = Wordpos( 'binary', !global.!fileicons ) 10361textfileicon_idx = Wordpos( 'text', !global.!fileicons ) 10362/* 10363 * Delete everything in the container so we can replace the existing files 10364 */ 10365Call dw_signal_disconnect !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_SELECT_EVENT 10366Call dw_signal_disconnect !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_ENTER_EVENT 10367Call dw_signal_disconnect !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_CONTEXT_EVENT 10368Call dw_signal_disconnect !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_COLUMN_CLICK_EVENT 10369Call dw_container_clear !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_DONT_REDRAW 10370/* 10371 * Add the files into the container 10372 */ 10373!global.!nonrepfilescontainermemory.!!last_repository = dw_container_alloc( !global.!nonrepfilescontainer.!!last_repository, !global.!nonrepfiles.?filename.!!last_repository.0 ) 10374Do i = 1 To !global.!nonrepfiles.?filename.!!last_repository.0 10375 Select 10376 When Substr( !global.!nonrepfiles.?filetype.!!last_repository.i, 5 ) = 'text file' Then icon = !global.!fileicon.textfileicon_idx 10377 When Substr( !global.!nonrepfiles.?filetype.!!last_repository.i, 5 ) = 'binary file' Then icon = !global.!fileicon.binaryfileicon_idx 10378 Otherwise icon = !global.!moduleicon.moduleicon_idx 10379 End 10380 date = Time_tDateToDisplayDate( Strip( Substr( !global.!nonrepfiles.?filedate.!!last_repository.i, 5 ) ) ) 10381 If Length( Word( date, 1 ) ) = 1 Then date = ' 'date 10382 Call dw_filesystem_set_file !global.!nonrepfilescontainer.!!last_repository, !global.!nonrepfilescontainermemory.!!last_repository, i-1, Substr( !global.!nonrepfiles.?filename.!!last_repository.i, 5 ), icon 10383 Call dw_filesystem_set_item !global.!nonrepfilescontainer.!!last_repository, !global.!nonrepfilescontainermemory.!!last_repository, 0, i-1, date 10384 Call dw_filesystem_set_item !global.!nonrepfilescontainer.!!last_repository, !global.!nonrepfilescontainermemory.!!last_repository, 1, i-1, Strip( Substr( !global.!nonrepfiles.?filesize.!!last_repository.i, 5 ) ) 10385 Call dw_filesystem_set_item !global.!nonrepfilescontainer.!!last_repository, !global.!nonrepfilescontainermemory.!!last_repository, 2, i-1, Substr( !global.!nonrepfiles.?fileperm.!!last_repository.i, 5 ) 10386 Call dw_container_set_row_title !global.!nonrepfilescontainermemory.!!last_repository, i-1, i 10387End 10388Call dw_container_set_stripe !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_CLR_WHITE, !global.!container_colour 10389Call dw_container_insert !global.!nonrepfilescontainer.!!last_repository, !global.!nonrepfilescontainermemory.!!last_repository, !global.!nonrepfiles.?filename.!!last_repository.0 10390Call dw_container_optimize !global.!nonrepfilescontainer.!!last_repository 10391/* 10392 * Only now can we setup our signals 10393 */ 10394Call dw_signal_connect !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_SELECT_EVENT, 'FileSelectCallback' 10395Call dw_signal_connect !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_ENTER_EVENT, 'FileDoubleClickCallback' 10396Call dw_signal_connect !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_CONTEXT_EVENT, 'FileMenuCallback' 10397Call dw_signal_connect !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_COLUMN_CLICK_EVENT, 'FileSortCallback' 10398Return 10399 10400/* 10401 * Populate the deleted file tab 10402 */ 10403DisplayDeletedFiles: Procedure Expose !REXXDW. !global. !!last_repository 10404Select 10405 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 10406 Do 10407 If !global.!offline.!!last_repository Then 10408 Do 10409 /* what to do if offline ? */ 10410 item_idx = 0 10411 End 10412 Else 10413 Do 10414 /* 10415 * Just get name, version and type initially 10416 */ 10417 If !global.!current_dirname.!!last_repository = '' Then dir = 'Attic' 10418 Else dir = !global.!current_dirname.!!last_repository'/Attic' 10419 If !global.!!repository.!!enhanced_cvs.!!last_repository = 'Y' Then cvscmd = 'rlog' 10420 Else cvscmd = 'log' 10421 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository cvscmd '-hbN' quote( dir ) 10422 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 10423 Address Command cmd With Output Stem log. Error Stem err. 10424 item_idx = 0 10425 Do i = 1 To log.0 10426 Select 10427 When Left( log.i, 13 ) = 'Working file:' Then filename = Subword( log.i, 3 ) 10428 When Left( log.i, 5 ) = 'head:' Then rev = Word( log.i, 2 ) 10429 When Left( log.i, 21 ) = 'keyword substitution:' Then type = Word( log.i, 3 ) 10430 When Left( log.i, 10 ) = Copies( '=', 10 ) Then 10431 Do 10432 item_idx = item_idx + 1 10433 item.item_idx = Left( 'Exp', 11 ) || Left( rev, 16 ) || Left( 'unknown user', 36 ) || '2000/01/01 00:00:00 ' || Left( type, 4 ) || Right( Length( filename ), 3 ) filename 10434 newi = Right( item_idx, 4 ) 10435 !global.!deletedfiles.?filerev.!!last_repository.item_idx = newi||Strip( rev ) 10436 !global.!deletedfiles.?filename.!!last_repository.item_idx = newi||Strip( filename ) 10437 !global.!deletedfiles.?fullfilename.!!last_repository.item_idx = newi||!global.!current_dirname.!!last_repository'/'Strip( filename ) 10438 End 10439 Otherwise Nop 10440 End 10441 End 10442 Drop log. 10443 End 10444 !global.!deletedfiles.?filerev.!!last_repository.0 = item_idx 10445 !global.!deletedfiles.?fullfilename.!!last_repository.0 = item_idx 10446 !global.!deletedfiles.?filename.!!last_repository.0 = item_idx 10447 End 10448 Otherwise Nop 10449End 10450/* 10451 * Now display the list. 10452 */ 10453 10454/* 10455 * Delete everything in the container so we can replace the existing files 10456 */ 10457Call dw_signal_disconnect !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_SELECT_EVENT 10458Call dw_signal_disconnect !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_CONTEXT_EVENT 10459Call dw_signal_disconnect !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_COLUMN_CLICK_EVENT 10460Call dw_container_clear !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_DONT_REDRAW 10461/* 10462 * Add the files into the container 10463 */ 10464moduleicon_idx = Wordpos( 'deletefromrepository', !global.!moduleicons ) 10465icon = !global.!moduleicon.moduleicon_idx 10466!global.!deletedfilescontainermemory.!!last_repository = dw_container_alloc( !global.!deletedfilescontainer.!!last_repository, !global.!deletedfiles.?filename.!!last_repository.0 ) 10467Do i = 1 To !global.!deletedfiles.?filename.!!last_repository.0 10468 Call dw_filesystem_set_file !global.!deletedfilescontainer.!!last_repository, !global.!deletedfilescontainermemory.!!last_repository, i-1, Substr( !global.!deletedfiles.?filename.!!last_repository.i, 5 ), icon 10469 Call dw_container_set_row_title !global.!deletedfilescontainermemory.!!last_repository, i-1, i 10470 Call dw_filesystem_set_item !global.!deletedfilescontainer.!!last_repository, !global.!deletedfilescontainermemory.!!last_repository, 0, i-1, Substr( !global.!deletedfiles.?filerev.!!last_repository.i, 5 ) 10471End 10472Call dw_container_set_stripe !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_CLR_WHITE, !global.!container_colour 10473Call dw_container_insert !global.!deletedfilescontainer.!!last_repository, !global.!deletedfilescontainermemory.!!last_repository, !global.!deletedfiles.?filename.!!last_repository.0 10474Call dw_container_optimize !global.!deletedfilescontainer.!!last_repository 10475/* 10476 * Only now can we setup our signals 10477 */ 10478Call dw_signal_connect !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_SELECT_EVENT, 'FileSelectCallback' 10479Call dw_signal_connect !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_CONTEXT_EVENT, 'FileMenuCallback' 10480Call dw_signal_connect !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_COLUMN_CLICK_EVENT, 'FileSortCallback' 10481Return 0 10482 10483/* 10484 * Gets a list of all files in a CVS directory; one file per line in a format 10485 * we can parse. Works on current repository, and current directory only 10486 * Ignore files in CVSROOT if NOT administrator 10487 */ 10488GetListOfCVSFilesInDirectory: Procedure Expose !REXXDW. !global. !!last_repository item. err. 10489Parse Arg repno, dirname, local 10490If \local Then lenroot = Length( !global.!!repository.!!shortpath.repno ) 10491Select 10492 When !global.!!repository.!!enhanced_cvs.repno \= 'Y' Then 10493 Do 10494 /* 10495 * We are using "unenhanced" CVS ie no "list" command 10496 * TODO 10497 */ 10498/* 10499 If !global.!current_dirname.!!last_repository = '' Then dir = '.' 10500 Else dir = !global.!current_dirname.!!last_repository 10501*/ 10502 If dirname = '.' Then dir = '' 10503 Else dir = quote( dirname ) 10504 /* 10505 * Get the header information and latest revision from the repository 10506 * This gets all files in the current directory and below. 10507 */ 10508 cmd = 'cvs' !global.!!repository.!!cvs_compression.repno '-d'!global.!!repository.!!path.repno '-q log -bN -d 1/1/2037' dir 10509 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 10510 Address Command cmd With Output FIFO '' Error Stem err. 10511 rcode = rc 10512 item_idx = 0 10513 /* 10514 * Force the number of dir levels to be more than we can ever have 10515 * working on local files only 10516 */ 10517 If local Then dir_levels = 999999 10518 Else dir_levels = 999999 10519 Do i = 1 To Queued() 10520 Parse Pull log 10521 Select 10522 When Left( log, 9 ) = 'RCS file:' Then 10523 Do 10524 in_rev = 0 10525 filename = Subword( log, 3 ) 10526 num_slashes = Countstr( '/', filename ) 10527 If num_slashes > dir_levels Then 10528 Do 10529 ignore_file = 1 10530 Iterate i 10531 End 10532 len = Length( filename ) 10533 /* 10534 * If the file is in the Attic, ignore this as well 10535 */ 10536 lastslashpos = Lastpos( '/', filename ) 10537 tmpf = Substr( filename, 1, lastslashpos ) 10538 If Right( tmpf, 6 ) = 'Attic/' Then 10539 Do 10540 ignore_file = 1 10541 Iterate i 10542 End 10543 ignore_file = 0 10544 If local Then dir_levels = num_slashes 10545 filename = Left( filename, len - 2 ) 10546 If local Then 10547 Do 10548 /* 10549 * For local listing, only get the filename... 10550 */ 10551 If dirname = '.' Then 10552 filename = Substr( filename, lastslashpos + 1 ) 10553 Else 10554 filename = dirname||Substr( filename, lastslashpos ) 10555 End 10556 Else 10557 Do 10558 /* 10559 * For recursive listing, get the path (minus root) and filename... 10560 */ 10561 filename = Substr( filename, lenroot+2 ) 10562 End 10563 End 10564 When Left( log, 21 ) = 'keyword substitution:' & ignore_file = 0 Then type = Word( log, 3 ) 10565 When Left( log, 20 ) = Copies( '-', 20 ) & ignore_file = 0 Then 10566 Do 10567 in_rev = 1 10568 End 10569 When Left( log, 9 ) = 'revision ' & in_rev = 1 Then 10570 Do 10571 Parse Var log 'revision' rev 10572 End 10573 When Left( log, 6 ) = 'date: ' & in_rev = 1 Then 10574 Do 10575 Parse Var log 'date: ' date time ';' 'author: ' author ';' . 10576 in_rev = 0 10577 End 10578 When Left( log, 10 ) = Copies( '=', 10 ) & ignore_file = 0 Then 10579 Do 10580 item_idx = item_idx + 1 10581 /* still need to add locks TODO */ 10582 item.item_idx = Left( 'Exp', 11 ) || Left( rev, 16 ) || Left( author, 36 ) || Strip( date ) Strip( time ) Left( type, 4 ) || Right( Length( filename ), 3 ) filename 10583 End 10584 Otherwise Nop 10585 End 10586 End 10587 item.0 = item_idx 10588 End 10589 Otherwise 10590 Do 10591 If local Then local_flag = '-l' 10592 Else local_flag = '' 10593 cmd = 'cvs' !global.!!repository.!!cvs_compression.repno '-d'!global.!!repository.!!path.repno '-q list' local_flag quote( dirname ) 10594 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 10595 Address Command cmd With Output Stem item. Error Stem err. 10596 rcode = rc 10597 End 10598End 10599Return rcode 10600 10601/* 10602 * Gets a list of all files in a HG repository; one file per line in a format 10603 * we can parse. Works on current repository. 10604 */ 10605GetListOfHGFilesInDirectory: Procedure Expose !REXXDW. !global. !!last_repository item. err. 10606Parse Arg repno, dirname, local 10607-- get the list of repository files; it will always return all files recursively 10608cwd = '--cwd' !global.!!repository.!!working_dir.!!last_repository 10609cmd = 'hg status -qA' cwd 10610If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 10611Address Command cmd With Output FIFO '' Error Stem err. 10612If rc \= 0 Then Return rc 10613say .line queued() dirname 10614-- determine file types for all files 10615If local = 1 Then glob = '*' 10616Else glob = '**' 10617bf = 'binary file' 10618cmd = "hg annotate -f 'glob:"glob"'" cwd||dirname "| grep '"bf"'" 10619If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 10620Address Command cmd With Output Stem out. Error Stem err. 10621idx = 0 10622annotate.0 = 0 10623Do i = 1 to out.0 10624 Parse var out.i fn ':' text 10625 If text = bf Then 10626 Do 10627 idx = idx + 1 10628 annotate.idx = fn 10629 annotate.0 = idx 10630 End 10631end 10632-- don't check for rc \= 0 because if there are no binary file you will get a rc = 1 10633say .line annotate.0 10634-- for each file get the log details 10635say .line !global.!!repository.!!working_dir.!!last_repository dirname local 10636item_idx = 0 10637If dirname = '.' Then dirname = '' 10638Else dirname = dirname'/' 10639lendir = Length( dirname ) 10640Do Queued() 10641 add_file = 0 10642 Parse Pull status fn 10643 If local = 1 Then 10644 Do 10645 -- limit files to current directory 10646 If dirname = '' Then 10647 Do 10648 If Countstr( '/', fn ) = 0 Then add_file = 1 10649 End 10650 Else 10651 Do 10652 Parse Var fn mydir +(lendir) myfn 10653 If mydir = dirname & Countstr( '/', myfn ) = 0 Then add_file = 1 10654 End 10655 End 10656 Else 10657 Do 10658say .line TODO 10659 End 10660 If add_file Then 10661 Do 10662 cmd = "hg log -l1 --template '%rev% {rev} %status%" status " %date% {date|hgdate} %author% {author} %filetype%\\n'" cwd fn 10663 -- suppress logging these commands; it happens for each file so can take a while 10664-- If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 10665 Address Command cmd With Output Stem out. Error Stem err. 10666 If rc \= 0 Then Return rc 10667 -- now find out if the current file is a binary file 10668 -- This is not foolproof. If a text file has a line with 'binary file' then it will 10669 -- match as a binary file 10670 filetype = 't' 10671 Do i = 1 To annotate.0 10672 If annotate.i = fn Then 10673 Do 10674 filetype = 'b' 10675 Leave i 10676 End 10677 End 10678 item_idx = item_idx + 1 10679 item.item_idx = fn out.1 filetype '%end%' 10680 item.0 = item_idx 10681 End 10682End 10683Return rcode 10684 10685QuoteAndBlankBang: Procedure Expose !REXXDW. !global. !!last_repository 10686Parse Arg str 10687If Left( str, 1 ) = '!' Then str = '' 10688Return Quote( str ) 10689 10690Quote: Procedure Expose !REXXDW. !global. !!last_repository 10691Parse Arg str 10692If Countstr( '"', str ) = 0 Then Return '"'str'"' 10693Else Return "'"str"'" 10694 10695EscapeQuotes: Procedure Expose !REXXDW. !global. !!last_repository 10696Parse Arg str 10697Return Changestr( '"', str, '\"' ) 10698 10699CleanupAndExit: Procedure Expose !REXXDW. !global. !!last_repository 10700Parse Arg exit_code 10701Call DeleteTempFiles 10702If RxFuncQuery( 'DW_DropFuncs' ) = 0 Then Call dw_DropFuncs 10703/* 10704 * Cleanup OLE 10705 */ 10706If !global.!loadedw32util = 1 Then 10707 Do 10708 Call w32olecleanup 10709 Call w32dropfuncs 10710 End 10711Exit exit_code 10712 10713DeleteTempFiles: Procedure Expose !REXXDW. !global. !!last_repository 10714/* 10715 * Remove temporary files 10716 */ 10717Do i = 1 To !global.!tempfiles.0 10718 Call SysFileDelete !global.!tempfiles.i 10719End 10720Return 10721 10722Syntax: 10723Say 'Syntax error at line:' sigl 'in directory:' Directory() 10724Say '>>>' Sourceline( sigl ) 10725Say Errortext( rc ) 10726If Countstr( '.', Condition( 'E' ) ) \= 0 Then Say Condition( 'D' ) 10727Call DeleteTempFiles 10728If RxFuncQuery( 'DW_DropFuncs' ) = 0 Then Call dw_DropFuncs 10729/* 10730 * Cleanup OLE 10731 */ 10732If !global.!loadedw32util = 1 Then 10733 Do 10734 Call w32olecleanup 10735 Call w32dropfuncs 10736 End 10737Exit 1 10738 10739GenerateIcons: Procedure Expose !REXXDW. !global. !!last_repository 10740/* 10741 * The icon for QOCCA 10742 */ 10743!global.!qoccaicon = dw_icon_load_from_file( !global.!icondir'qocca' ) 10744If !global.!qoccaicon = 0 Then Call AbortText 'Could not find icon:' quote( 'qocca' ) 'in' !global.!icondir 10745/* 10746 * ... and other miscellaneous Icons 10747 */ 10748!global.!noicon = dw_icon_load_from_file( !global.!icondir'no' ) 10749If !global.!noicon = 0 Then Call AbortText 'Could not find icon:' quote( 'no' ) 'in' !global.!icondir 10750!global.!okicon = dw_icon_load_from_file( !global.!icondir'ok' ) 10751If !global.!okicon = 0 Then Call AbortText 'Could not find icon:' quote( 'ok' ) 'in' !global.!icondir 10752/* 10753 * The icons for modules... 10754 */ 10755!global.!moduleicons = 'modulenotcheckedout modulebuildablenotcheckedout modulecheckedout modulebuildablecheckedout modulelinkednotcheckedout modulelinkedbuildablenotcheckedout modulelinkedcheckedout modulelinkedbuildablecheckedout deletefromrepository' 10756Do i = 1 To Words( !global.!moduleicons ) 10757 modname = Word( !global.!moduleicons, i ) 10758 !global.!moduleicon.i = dw_icon_load_from_file( !global.!icondir||modname) 10759 If !global.!moduleicon.i = 0 Then Call AbortText 'Could not find icon:' quote( modname ) 'in' !global.!icondir 10760End 10761/* 10762 * Icons for file status - these may be icons or text depending of capabilities of GUI containers 10763 */ 10764!global.!statusicons = 'fileconflict filemodified fileneedscheckout fileneedsmerge fileneedspatch fileuptodate fileunknown setreminder blank deletefromrepository' 10765statustext = 'Conflict Locally.Modified Needs.Checkout Needs.Merge Needs.Patch Up-to-date *Unknown* Reminder No.Lock Delete' 10766Do i = 1 To Words( !global.!statusicons ) 10767 modname = Word( !global.!statusicons, i ) 10768 If !global.!container_disallows_icons = 1 Then 10769 Do 10770 !global.!statusicon.i = Changestr( '.', Word( statustext,i ), ' ' ) 10771 End 10772 Else 10773 Do 10774 !global.!statusicon.i = dw_icon_load_from_file( !global.!icondir||modname ) 10775 End 10776End 10777/* 10778 * Icons for file type 10779 */ 10780!global.!fileicons = 'binary binarylocked binarylockedother text textlocked textlockedother fileunknown' 10781Do i = 1 To Words( !global.!fileicons ) 10782 modname = Word( !global.!fileicons, i ) 10783 !global.!fileicon.i = dw_icon_load_from_file( !global.!icondir||modname ) 10784 If !global.!fileicon.i = 0 Then Call AbortText 'Could not find icon:' quote( modname ) 'in' !global.!icondir 10785End 10786/* 10787 * Icons for Job Status 10788 */ 10789!global.!jobicons = 'build make copy mods promote' 10790Do i = 1 To Words( !global.!jobicons ) 10791 modname = Word( !global.!jobicons, i ) 10792 !global.!jobicon.i = dw_icon_load_from_file( !global.!icondir||modname ) 10793 If !global.!jobicon.i = 0 Then Call AbortText 'Could not find icon:' quote( modname ) 'in' !global.!icondir 10794End 10795Return 10796 10797DetermineModuleIcon: Procedure Expose !REXXDW. !global. !!last_repository 10798Parse Arg dir 10799/* 10800 * On input 'dir' will be of the form: 10801 * CVS - /dir1/dir2 10802 * HG - /dir1/dir2 10803 * RVS - ?? 10804 */ 10805this_dir = Substr( dir, 2 ) /* strip leading '/' */ 10806this_dir_upper = Translate( this_dir ) 10807/* 10808 * Check if the module has been checked out... 10809 */ 10810Select 10811 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 10812 Do 10813 /* 10814 * If the CVS directory in the working directory 10815 * doesn't exist, then we haven't checked out anything 10816 */ 10817 wd = !global.!!repository.!!working_dir.!!last_repository||Substr( dir, 2 )'/CVS' 10818 If DirectoryExists( wd ) = 1 Then type = 'checkedout' 10819 Else type = 'notcheckedout' 10820 End 10821 When !global.!!repository.!!type.!!last_repository = 'hg' Then 10822 Do 10823 -- can there be any other status other than 'checkedout' ? 10824 type = 'checkedout' 10825 End 10826 Otherwise Nop 10827End 10828/* 10829 * Check if the module is linked... 10830 */ 10831linked = '' 10832Do i = 1 to !global.!common_dir.0 10833 If dir = !global.!common_dir.i Then 10834 Do 10835 linked = 'linked' 10836 Leave 10837 End 10838End 10839Do i = 1 to !global.!linked_dir.0 10840 If dir = !global.!linked_dir.i Then 10841 Do 10842 linked = 'linked' 10843 Leave 10844 End 10845End 10846/* 10847 * Check if the module is buildable... 10848 */ 10849If FindBuildCommand( this_dir ) = '' Then buildable = '' 10850Else buildable = 'buildable' 10851say Wordpos( 'module'linked||buildable||type, !global.!moduleicons ) 'module'linked||buildable||type 10852Return Wordpos( 'module'linked||buildable||type, !global.!moduleicons ) 10853 10854/* 10855 * -------------------------------------------------------------------- 10856 * Utility functions 10857 * -------------------------------------------------------------------- 10858 */ 10859 10860/* 10861 * From the current directory, determine the directory icon and change it 10862 */ 10863RefreshDirectoryIcons: Procedure Expose !REXXDW. !global. !!last_repository 10864Select 10865 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 10866 Do 10867 /* 10868 * Start with the current directory and change the icon of all ancestors 10869 */ 10870 parentitem = !global.!selected_treeitem.!!last_repository 10871 Do Forever 10872 thisitem = parentitem 10873 Parse Value dw_tree_item_get_data( !global.!tree.!!last_repository, parentitem ) With parentitem mydir 10874 mydir = Strip( mydir, 'B', '"' ) 10875 Parse Value DetermineModuleIconAndName( mydir ) With icon currentdir 10876 If parentitem = 0 Then currentdir = '['!global.!!repository.!!name.!!last_repository']' 10877 Call dw_tree_item_change !global.!tree.!!last_repository, thisitem, currentdir, icon 10878 If parentitem = 0 Then Leave 10879 End 10880 /* 10881 * Now we have to change all the children 10882 */ 10883 thisdir = '/'!global.!current_dirname.!!last_repository'/' 10884 len = Length( thisdir ) 10885 Do i = 1 To !global.!repdir.!!last_repository.0 10886 If Left( !global.!repdir.!!last_repository.i, len ) = thisdir Then 10887 Do 10888 Parse Value DetermineModuleIconAndName( !global.!repdir.!!last_repository.i ) With icon currentdir 10889 Call dw_tree_item_change !global.!tree.!!last_repository, !global.!treeitem.!!last_repository.i, currentdir, icon 10890 End 10891 End 10892 End 10893 Otherwise Nop 10894End 10895Return 10896 10897DetermineModuleIconAndName: Procedure Expose !REXXDW. !global. !!last_repository 10898Parse Arg mydir 10899idx = DetermineModuleIcon( mydir ) 10900icon = !global.!moduleicon.idx 10901pos = Lastpos( '/', mydir ) 10902currentdir = Substr( mydir, pos+1 ) 10903/* 10904 * Is this directory linked ? If so, append the directory we are linked to. 10905 */ 10906Do j = 1 To !global.!linked_dir.0 10907 If !global.!linked_dir.j = mydir Then 10908 Do 10909 commonidx = !global.!linked_idx.j 10910 currentdir = Substr( !global.!linked_dir.j, pos+1 ) '->' !global.!common_dir.commonidx 10911 Leave 10912 End 10913End 10914Return icon currentdir 10915 10916CreateDirectory: Procedure Expose !REXXDW. !global. !!last_repository 10917Parse Arg dir 10918/*dir = Changestr( '/', dir, !global.!ossep )*/ 10919If DirectoryExists( dir ) = 0 Then Address System !global.!cmdmkdir dir With Output Stem junk. Error Stem junk. 10920Return 10921 10922/* 10923 * If no template passed, the caller assumes responsibility for deleteing the file 10924 */ 10925GenerateTempFile: Procedure Expose !REXXDW. !global. !!last_repository 10926Parse Arg template 10927If template = '' Then 10928 Do 10929 tmpfile = SysTempFileName( !global.!!tmpdir'?????' ) 10930 End 10931Else 10932 Do 10933 tmpfile = SysTempFileName( !global.!!tmpdir||template ) 10934 Call AddTempFileForCleanup tmpfile 10935 End 10936Return tmpfile 10937 10938AddTempFileForCleanup: Procedure Expose !REXXDW. !global. !!last_repository 10939Parse Arg tmpfile 10940idx = !global.!tempfiles.0 + 1 10941!global.!tempfiles.idx = tmpfile 10942!global.!tempfiles.0 = idx 10943Return 10944 10945DirectoryExists: Procedure Expose !REXXDW. !global. !!last_repository 10946Parse Arg dir 10947If Right( dir, 1 ) = '/' Then dir = Strip( dir, 'T', '/' ) 10948fstat = Stream( dir, 'C', 'FSTAT' ) 10949ftype = Word( fstat, 8 ) 10950rcode = 0 10951Select 10952 When ftype = 'Directory' Then rcode = 1 10953 When ftype = 'SymbolicLink' Then 10954 Do 10955 -- get the canonical name (which resolves symbolic links) ... 10956 link = Stream( dir, 'C', 'QUERY EXISTS' ) 10957 fstat = Stream( link, 'C', 'FSTAT' ) 10958 -- ... and if that's a directory ... 10959 If Word( fstat, 8 ) = 'Directory' Then rcode = 1 10960 Else rcode = 0 10961 End 10962 Otherwise rcode = 0 10963End 10964Return rcode 10965 10966DirToVariable: Procedure Expose !REXXDW. !global. !!last_repository 10967Parse Arg dir 10968Return Translate( Translate( dir ), '___', '\/ ' ) 10969 10970WorkingDirectoryExists: Procedure Expose !REXXDW. !global. !!last_repository 10971Parse Arg dir 10972Return DirectoryExists( GetFullWorkingDirectory( dir ) ) 10973 10974GetFullWorkingDirectory: Procedure Expose !REXXDW. !global. !!last_repository 10975Parse Arg dir 10976Select 10977 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 10978 Do 10979 current_fullworkingdir = Changestr( '/', !global.!!repository.!!working_dir.!!last_repository||dir, !global.!ossep ) 10980 End 10981 Otherwise Nop 10982End 10983Return current_fullworkingdir 10984 10985CreateDirToolbarList: Procedure Expose !REXXDW. !global. !!last_repository 10986!global.!dirpopup_offline. = 'D' /* disable all dirpopup menu items */ 10987/* 10988 * Start our index counter... 10989 */ 10990i = 0 10991i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Refresh Modules'; !global.!dirpopup_command.i='refreshmodules'; !global.!dirpopup_state.i='normal' 10992/* 10993 * A repository administrator can see the properties... 10994 */ 10995i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Properties'; !global.!dirpopup_command.i='dirproperties'; !global.!dirpopup_state.i='normal' 10996i = i + 1;!global.!dirpopup_type.i='separator'; 10997i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='List Modified'; !global.!dirpopup_command.i='listmodified'; !global.!dirpopup_state.i='normal' 10998i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='List Locked'; !global.!dirpopup_command.i='listlocked'; !global.!dirpopup_state.i='normal' 10999i = i + 1;!global.!dirpopup_type.i='separator'; 11000i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Get Latest All'; !global.!dirpopup_command.i='getlatestall';!global.!dirpopup_state.i='normal' 11001If !global.!!repository.!!type.!!last_repository = 'cvs' Then 11002 Do 11003 i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Update All'; !global.!dirpopup_command.i='updateall'; !global.!dirpopup_state.i='normal' 11004 End 11005Else 11006 Do 11007 i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Update All'; !global.!dirpopup_command.i='updateall'; !global.!dirpopup_state.i='disabled' 11008 End 11009i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Get All...'; !global.!dirpopup_command.i='getall'; !global.!dirpopup_state.i='normal' 11010i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Check Out All'; !global.!dirpopup_command.i='checkoutall'; !global.!dirpopup_state.i='normal' 11011i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Undo Check Out All'; !global.!dirpopup_command.i='undocheckoutall'; !global.!dirpopup_state.i='normal' 11012i = i + 1;!global.!dirpopup_type.i='separator'; 11013i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Check In All'; !global.!dirpopup_command.i='checkinall'; !global.!dirpopup_state.i='normal' 11014i = i + 1;!global.!dirpopup_type.i='separator'; 11015i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Make'; !global.!dirpopup_command.i='make'; !global.!dirpopup_state.i='normal'; !global.!dirpopup_offline.i='N' 11016i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Report Module History'; !global.!dirpopup_command.i='reportmodulehistory'; !global.!dirpopup_state.i='normal' 11017i = i + 1;!global.!dirpopup_type.i='separator'; 11018i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Label'; !global.!dirpopup_command.i='label'; !global.!dirpopup_state.i='normal' 11019i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Build'; !global.!dirpopup_command.i='build'; !global.!dirpopup_state.i='normal' 11020i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Promote';!global.!dirpopup_command.i='promote'; !global.!dirpopup_state.i='normal' 11021i = i + 1;!global.!dirpopup_type.i='separator'; 11022i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Link Directory'; !global.!dirpopup_command.i='linkdir'; !global.!dirpopup_state.i='normal' 11023If !global.!!repository.!!type.!!last_repository = 'cvs' Then 11024 Do 11025 i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Copy Repository'; !global.!dirpopup_command.i='copyrepository'; !global.!dirpopup_state.i='normal' 11026 End 11027i = i + 1;!global.!dirpopup_type.i='separator'; 11028i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Add Bookmark'; !global.!dirpopup_command.i='addbookmark'; !global.!dirpopup_state.i='normal' 11029i = i + 1;!global.!dirpopup_type.i='command'; !global.!dirpopup_label.i='Delete Bookmark'; !global.!dirpopup_command.i='deletebookmark'; !global.!dirpopup_state.i='normal' 11030!global.!dirpopup_type.0 = i 11031!global.!dirpopup_command.0 = i 11032Return 11033 11034CreateDirToolbar: Procedure Expose !REXXDW. !global. !!last_repository 11035/* 11036 * Destroy the button box and recreate it 11037 */ 11038redraw = 0 11039If !global.!dirtoolbarbox \= 0 Then 11040 Do 11041 Call dw_window_destroy !global.!dirtoolbarbox 11042 redraw = 1 11043 End 11044!global.!dirtoolbarbox = dw_box_new( !REXXDW.!DW_VERT ) 11045Call dw_box_pack_start !global.!dirtoolbarboxperm, !global.!dirtoolbarbox, !global.!toolbox_size, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 11046/* 11047 * Now we have set up the items appropriate for our repository type and user, 11048 * display the buttons... 11049 */ 11050Do i = 1 To !global.!dirpopup_type.0 11051 Select 11052 When !global.!dirpopup_type.i = 'separator' Then 11053 Do 11054 Call dw_box_pack_start !global.!dirtoolbarbox, 0, !global.!toolbox_size, 5, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 11055 End 11056 When !global.!dirpopup_type.i = 'command' Then 11057 Do 11058 abutton = dw_bitmapbutton_new_from_file( !global.!dirpopup_label.i, 0, !global.!icondir||!global.!dirpopup_command.i ) 11059 Call dw_box_pack_start !global.!dirtoolbarbox, abutton, !global.!toolbox_size, !global.!toolbox_size, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 11060 Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, !global.!dirpopup_command.i||'Callback' 11061 If !global.!dirpopup_state.i = 'disabled' Then Call dw_window_disable abutton 11062 !global.!dirtoolbarbutton.i = abutton 11063 End 11064 Otherwise Nop 11065 End 11066End 11067!global.!dirtoolbarbutton.0 = !global.!dirpopup_type.0 11068/* 11069 * Pack a tiny spacing in the bottom that is expandable so that OS/2 11070 * packs buttons to the top 11071 */ 11072Call dw_box_pack_start !global.!dirtoolbarbox, 0, !global.!toolbox_size, 1, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 11073/* 11074 * We might have changed the packing, so we need to redraw the top-level window... 11075 */ 11076Call dw_window_redraw !global.!mainwindow 11077Return 11078 11079DisplayDirMenu: Procedure Expose !REXXDW. !global. !!last_repository 11080Parse Arg x, y 11081/* 11082 * Now we have set up the items appropriate for our repository type and user, 11083 * determine which items to add to the menu 11084 * CAN ONLY BE CALLED FROM signal handler 11085 */ 11086/* 11087 * Create the directory popup each time we get here, because dw_menu_popup() 11088 * destroys it. 11089 */ 11090!global.!dirpopup = dw_menu_new( 0 ) 11091last_item_is_separator = 0 11092Do i = 1 To !global.!dirpopup_type.0 11093 Select 11094 When !global.!dirpopup_state.i = 'disabled' Then Nop 11095 When !global.!dirpopup_type.i = 'separator' Then 11096 Do 11097 If last_item_is_separator = 0 Then 11098 menuitem = dw_menu_append_item( !global.!dirpopup, !REXXDW.!DW_MENU_SEPARATOR, 5000+i, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 11099 last_item_is_separator = 1 11100 End 11101 When !global.!dirpopup_type.i = 'command' Then 11102 Do 11103 menuitem = dw_menu_append_item( !global.!dirpopup, !global.!dirpopup_label.i, 5000+i, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 11104 Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, !global.!dirpopup_command.i||'Callback', i 11105 last_item_is_separator = 0 11106 End 11107 Otherwise Nop 11108 End 11109End 11110!global.!dirtoolbarbutton.0 = !global.!dirpopup_type.0 11111/* 11112 * If the user has specified configurable menu items, add them at the 11113 * bottom. We don't add them into the !global.!dirpopup... stems 11114 */ 11115If Datatype( !global.!!user.!!dirmenu.!!label.0 ) = 'NUM' Then 11116 Do 11117 If last_item_is_separator = 0 Then 11118 Call dw_menu_append_item !global.!dirpopup, !REXXDW.!DW_MENU_SEPARATOR, 5500, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 11119 Do i = 1 To !global.!!user.!!dirmenu.!!label.0 11120 menuitem = dw_menu_append_item( !global.!dirpopup, !global.!!user.!!dirmenu.!!label.i, 5500+i, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 11121 Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'UserDirCommandCallback', i 11122 End 11123 End 11124Call dw_menu_popup !global.!dirpopup, !global.!mainwindow, x, y 11125Return 11126 11127AdjustDirToolbarList: Procedure Expose !REXXDW. !global. !!last_repository 11128/* 11129 * Adjust the availability of menu items depending on various conditions... 11130 * TODO disable most commands if no currently selected module 11131 * TODO only change the 'disabled'/'normal' flag, another function to 11132 * change the button status 11133 */ 11134if trace() = 'F' Then say !global.!offline.!!last_repository !global.!current_dirname.!!last_repository 11135this_buildcommand = FindBuildCommand( !global.!current_dirname.!!last_repository ) 11136this_promotecommand = FindPromoteCommand( !global.!current_dirname.!!last_repository ) 11137this_makecommand = FindMakeCommand( !global.!current_dirname.!!last_repository ) 11138wde = WorkingDirectoryExists( !global.!current_dirname.!!last_repository ) 11139Do i = 1 To !global.!dirpopup_command.0 11140 Select 11141 When !global.!dirpopup_command.i = 'dirproperties' Then 11142 Do 11143 If !global.!administrator.!!last_repository = 'Y' | !global.!current_dirname.!!last_repository = '.' Then !global.!dirpopup_state.i = 'normal' 11144 Else !global.!dirpopup_state.i = 'disabled' 11145 End 11146 When !global.!dirpopup_command.i = 'promote' & this_promotecommand = '' Then !global.!dirpopup_state.i = 'disabled' 11147 When !global.!dirpopup_command.i = 'addmodules' & wde = 0 Then !global.!dirpopup_state.i = 'disabled' 11148 When !global.!dirpopup_command.i = 'updateall' & wde = 0 Then !global.!dirpopup_state.i = 'disabled' 11149 When !global.!dirpopup_command.i = 'listmodified' & wde = 0 Then !global.!dirpopup_state.i = 'disabled' 11150 When !global.!dirpopup_command.i = 'checkoutall' | !global.!dirpopup_command.i = 'undocheckoutall' Then 11151 Do 11152 this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 11153 If !global.!dir.!reservedcheckout.this_dir = 'Y' | !global.!reservedcheckout = 'Y' Then !global.!dirpopup_state.i = 'normal' 11154 Else !global.!dirpopup_state.i = 'disabled' 11155 End 11156 When !global.!dirpopup_command.i = 'checkinall' & wde = 0 Then !global.!dirpopup_state.i = 'disabled' 11157 When !global.!dirpopup_command.i = 'checkinall' & !global.!update_user.!!last_repository \= 'Y' Then !global.!dirpopup_state.i = 'disabled' 11158 When !global.!offline.!!last_repository & !global.!dirpopup_offline.i = 'D' Then !global.!dirpopup_state.i = 'disabled' 11159 When !global.!dirpopup_command.i = 'build' & this_buildcommand = '' Then !global.!dirpopup_state.i = 'disabled' 11160 When !global.!dirpopup_command.i = 'build' & !global.!build_user.!!last_repository \= 'Y' Then !global.!dirpopup_state.i = 'disabled' 11161 When !global.!dirpopup_command.i = 'label' & !global.!build_user.!!last_repository \= 'Y' Then !global.!dirpopup_state.i = 'disabled' 11162 When !global.!dirpopup_command.i = 'promote' & !global.!build_user.!!last_repository \= 'Y' Then !global.!dirpopup_state.i = 'disabled' 11163 When !global.!dirpopup_command.i = 'make' & this_makecommand = '' Then !global.!dirpopup_state.i = 'disabled' 11164 When !global.!dirpopup_command.i = 'linkdir' | !global.!dirpopup_command.i = 'copyrepository' Then 11165 Do 11166 Select 11167 /* 11168 * Only an administrator can link or copy... 11169 */ 11170 When !global.!administrator.!!last_repository \= 'Y' Then !global.!dirpopup_state.i = 'disabled' 11171 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 11172 Do 11173 /* 11174 * If on CVS, only valid if local connection 11175 */ 11176 If !global.!!repository.!!contype.!!last_repository = 'local' Then !global.!dirpopup_state.i = 'normal' 11177 Else !global.!dirpopup_state.i = 'disabled' 11178 End 11179 Otherwise !global.!dirpopup_state.i = 'normal' 11180 End 11181 End 11182 When !global.!dirpopup_command.i = 'addbookmark' Then 11183 Do 11184 found = 0 11185 Do j = 1 To !global.!!user.!!bookmark.0 11186 If !global.!!user.!!bookmark_repository.j = !!last_repository & !global.!!user.!!bookmark.j = !global.!current_dirname.!!last_repository Then 11187 Do 11188 found = 1 11189 Leave 11190 End 11191 End 11192 If found = 1 Then !global.!dirpopup_state.i = 'disabled' 11193 Else !global.!dirpopup_state.i = 'normal' 11194 End 11195 When !global.!dirpopup_command.i = 'deletebookmark' Then 11196 Do 11197 found = 0 11198 Do j = 1 To !global.!!user.!!bookmark.0 11199 If !global.!!user.!!bookmark_repository.j = !!last_repository & !global.!!user.!!bookmark.j = !global.!current_dirname.!!last_repository Then 11200 Do 11201 found = 1 11202 Leave 11203 End 11204 End 11205 If found = 1 Then !global.!dirpopup_state.i = 'normal' 11206 Else !global.!dirpopup_state.i = 'disabled' 11207 End 11208 Otherwise !global.!dirpopup_state.i = 'normal' 11209 End 11210End 11211Return 11212 11213AdjustDirToolbarButtons: Procedure Expose !REXXDW. !global. !!last_repository 11214/* 11215 * Based on the status of each dir command, enable or disable the button 11216 */ 11217Do i = 1 To !global.!dirpopup_command.0 11218 If !global.!dirpopup_type.i = 'command' Then 11219 Do 11220 If !global.!dirpopup_state.i = 'normal' Then Call dw_window_enable !global.!dirtoolbarbutton.i 11221 Else Call dw_window_disable !global.!dirtoolbarbutton.i 11222 End 11223End 11224Return 11225 11226CreateFileToolbarList: Procedure Expose !REXXDW. !global. !!last_repository 11227/* 11228 * Create the popup menu for the file 11229 * 11230 * Meaning of "initial_state" flags... 11231 * 11232 * 'D' means menu option is disabled if the condition below is true 11233 * 'N' means menu option is enabled if the condition below is true 11234 * 11235 * Word(1): option is enabled if file is locked by current user 11236 * Word(2): option is enabled if file is locked by another user 11237 * Word(3): option is enabled if file is not locked by anyone 11238 * Word(4): option is enabled if multiple files selected 11239 * Word(5): option is enabled if running in online mode 11240 * Word(6): option is enabled if working file exists 11241 * Word(7): option is enabled if in non-repository files tab 11242 */ 11243/* 11244 * If you add more buttons, then change these lines at the top of the program: 11245!global.!maxfilebuttons = 19 11246!global.!maxfileseparators = 7 11247 */ 11248i = 0 11249i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Refresh Files'; !global.!filepopup_command.i='refreshfiles'; !global.!filepopup_initial_state.i='N N N N N N N' 11250i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Properties'; !global.!filepopup_command.i='fileproperties'; !global.!filepopup_initial_state.i='N N N D D N D' 11251i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Add Files'; !global.!filepopup_command.i='addfiles'; !global.!filepopup_initial_state.i='N N N N D N N' 11252i = i + 1;!global.!filepopup_type.i='separator'; 11253i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='View'; !global.!filepopup_command.i='viewlatest'; !global.!filepopup_initial_state.i='N N N N N N N' 11254i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Edit'; !global.!filepopup_command.i='editlatest'; !global.!filepopup_initial_state.i='N D N N N N N' 11255i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='View...'; !global.!filepopup_command.i='viewprior'; !global.!filepopup_initial_state.i='N N N D D D D' 11256i = i + 1;!global.!filepopup_type.i='separator'; 11257i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Get Latest'; !global.!filepopup_command.i='getlatest'; !global.!filepopup_initial_state.i='N N N N D N D' 11258If !global.!!repository.!!type.!!last_repository = 'cvs' Then 11259 Do 11260 i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Update'; !global.!filepopup_command.i='update'; !global.!filepopup_initial_state.i='D D N N D N D' 11261 End 11262i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Get...'; !global.!filepopup_command.i='getprior'; !global.!filepopup_initial_state.i='N N N D D N D' 11263i = i + 1;!global.!filepopup_type.i='separator'; 11264i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Check Out'; !global.!filepopup_command.i='checkout'; !global.!filepopup_initial_state.i='N D D N D N D' 11265i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Undo Check Out'; !global.!filepopup_command.i='undocheckout'; !global.!filepopup_initial_state.i='N D D N D D D' 11266i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Check In'; !global.!filepopup_command.i='checkin'; !global.!filepopup_initial_state.i='N D D N D D D' 11267i = i + 1;!global.!filepopup_type.i='separator'; 11268i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Show Differences...'; !global.!filepopup_command.i='showdifferences'; !global.!filepopup_initial_state.i='N N N D D N D' 11269If !global.!!repository.!!type.!!last_repository = 'cvs' Then 11270 Do 11271 i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Show Annotations...'; !global.!filepopup_command.i='showannotations'; !global.!filepopup_initial_state.i='N N N D D N D' 11272 End 11273i = i + 1;!global.!filepopup_type.i='separator'; 11274i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Delete'; !global.!filepopup_command.i='deletefromrepository'; !global.!filepopup_initial_state.i='N N N N D N D' 11275/*i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Rename'; !global.!filepopup_command.i='renameinrepository';!global.!filepopup_initial_state.i='N N N D D N D' */ 11276i = i + 1;!global.!filepopup_type.i='separator'; 11277i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Set Reminder'; !global.!filepopup_command.i='setreminder'; !global.!filepopup_initial_state.i='N N N D N D D' 11278i = i + 1;!global.!filepopup_type.i='command'; !global.!filepopup_label.i='Delete Reminder'; !global.!filepopup_command.i='deletereminder'; !global.!filepopup_initial_state.i='N N N D N D D' 11279!global.!filepopup_type.0 = i 11280!global.!filepopup_command.0 = i 11281Return 11282 11283CreateFileToolbar: Procedure Expose !REXXDW. !global. !!last_repository 11284/* 11285 * Destroy the button box and recreate it 11286 */ 11287redraw = 0 11288If !global.!filetoolbarbox \= 0 Then 11289 Do 11290 Call dw_window_destroy !global.!filetoolbarbox 11291 redraw = 1 11292 End 11293!global.!filetoolbarbox = dw_box_new( !REXXDW.!DW_VERT ) 11294Call dw_box_pack_start !global.!filetoolbarboxperm, !global.!filetoolbarbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 11295/* 11296 * Now we have set up the items appropriate for our repository type and user, build the 11297 * buttons and menu... 11298 */ 11299Do i = 1 To !global.!filepopup_type.0 11300 Select 11301 When !global.!filepopup_type.i = 'separator' Then 11302 Do 11303 Call dw_box_pack_start !global.!filetoolbarbox, 0, !global.!toolbox_size, 5, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 11304 End 11305 When !global.!filepopup_type.i = 'command' Then 11306 Do 11307 abutton = dw_bitmapbutton_new_from_file( !global.!filepopup_label.i, 0, !global.!icondir||!global.!filepopup_command.i ) 11308 Call dw_box_pack_start !global.!filetoolbarbox, abutton, !global.!toolbox_size, !global.!toolbox_size, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 11309 Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, !global.!filepopup_command.i||'Callback' 11310 If !global.!filepopup_state.i = 'disabled' Then Call dw_window_disable abutton 11311 !global.!filetoolbarbutton.i = abutton 11312 End 11313 Otherwise Nop 11314 End 11315End 11316!global.!filetoolbarbutton.0 = !global.!filepopup_type.0 11317/* 11318 * Pack a tiny spacing in the bottom that is expandable so that OS/2 11319 * packs buttons to the top 11320 */ 11321Call dw_box_pack_start !global.!filetoolbarbox, 0, !global.!toolbox_size, 1, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 11322/* 11323 * We might have changed the packing, so we need to redraw the top-level window... 11324 */ 11325Call dw_window_redraw !global.!mainwindow 11326Return 11327 11328DisplayFileMenu: Procedure Expose !REXXDW. !global. !!last_repository 11329Parse Arg x, y 11330/* 11331 * Now we have set up the items appropriate for the selected files 11332 * determine which items to add to the menu 11333 * CAN ONLY BE CALLED FROM signal handler 11334 */ 11335/* 11336 * Create the directory popup each time we get here, because dw_menu_popup() 11337 * destroys it. 11338 */ 11339last_item_is_separator = 0 11340!global.!filepopup = dw_menu_new( 0 ) 11341Do i = 1 To !global.!filepopup_type.0 11342if trace() = 'F' Then say 'state' !global.!filepopup_command.i !global.!filepopup_state.i 11343 Select 11344 When !global.!filepopup_state.i = 'disabled' Then Nop 11345 When !global.!filepopup_type.i = 'separator' Then 11346 Do 11347 If last_item_is_separator = 0 Then 11348 menuitem = dw_menu_append_item( !global.!filepopup, !REXXDW.!DW_MENU_SEPARATOR, 6000+i, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 11349 last_item_is_separator = 1 11350 End 11351 When !global.!filepopup_type.i = 'command' Then 11352 Do 11353 menuitem = dw_menu_append_item( !global.!filepopup, !global.!filepopup_label.i, 6000+i, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 11354 Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, !global.!filepopup_command.i||'Callback', i 11355 last_item_is_separator = 0 11356 End 11357 Otherwise Nop 11358 End 11359End 11360!global.!filetoolbarbutton.0 = !global.!filepopup_type.0 11361/* 11362 * If the user has specified configurable menu items, add them at the 11363 * bottom. We don't add them into the !global.!filepopup... stems 11364 */ 11365If Datatype( !global.!!user.!!filemenu.!!label.0 ) = 'NUM' Then 11366 Do 11367 If last_item_is_separator = 0 Then 11368 Call dw_menu_append_item !global.!filepopup, !REXXDW.!DW_MENU_SEPARATOR, 5500, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 11369 Do i = 1 To !global.!!user.!!filemenu.!!label.0 11370 menuitem = dw_menu_append_item( !global.!filepopup, !global.!!user.!!filemenu.!!label.i, 6500+i, 0, !REXXDW.!DW_MENU_END, !REXXDW.!DW_MENU_NOT_CHECKABLE, 0 ) 11371 Call dw_signal_connect menuitem, !REXXDW.!DW_CLICKED_EVENT, 'UserFileCommandCallback', i 11372 End 11373 End 11374Call dw_menu_popup !global.!filepopup, !global.!mainwindow, x, y 11375Return 11376 11377/* 11378 * Must be called by item-select event on the repository file container 11379 * This is so that the toolbar buttons are updated to enabled/disabled 11380 */ 11381AdjustFileToolbarList: Procedure Expose !REXXDW. !global. !!last_repository 11382/* 11383 * This function is called when the repository files and the non-repository 11384 * files page is displayed. We need to do vastly different things for each 11385 * page. 11386 */ 11387Select 11388 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository | !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then 11389 Do 11390 If !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then 11391 Do 11392 doing_repfiles = 1 11393 container = !global.!repfilescontainer.!!last_repository 11394 End 11395 Else 11396 Do 11397 doing_repfiles = 0 11398 container = !global.!allfilescontainer.!!last_repository 11399 End 11400 /* 11401 * Determine which repository items are currently selected 11402 */ 11403 current_indexes = '' 11404 selected = dw_container_query_start( container, !REXXDW.!DW_CRA_SELECTED ) 11405 Do i = 1 While selected \= '' 11406 current_indexes = current_indexes selected 11407 If doing_repfiles Then 11408 !global.!current_filenames.i = Substr( !global.!repfiles.?fullfilename.!!last_repository.selected, 5 ) 11409 Else 11410 !global.!current_filenames.i = Substr( !global.!allfiles.?fullfilename.!!last_repository.selected, 5 ) 11411 !global.!current_indexes.i = selected 11412 if trace() = 'F' Then say 'selected' selected !global.!current_filenames.i !global.!repfiles.?filetype.!!last_repository.selected 11413 selected = dw_container_query_next( container, !REXXDW.!DW_CRA_SELECTED ) 11414 End 11415 !global.!current_filenames.0 = i-1 11416 !global.!current_indexes.0 = i-1 11417 afpi = Word( current_indexes, 1 ) 11418 changes = '' 11419 Select 11420 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 11421 Do 11422 this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 11423 If doing_repfiles Then 11424 Do 11425 filetype = !global.!repfiles.?filetype.!!last_repository.afpi 11426 user = !global.!repfiles.?user.!!last_repository.afpi 11427 End 11428 Else 11429 Do 11430 filetype = !global.!allfiles.?filetype.!!last_repository.afpi 11431 user = !global.!allfiles.?user.!!last_repository.afpi 11432 End 11433 If !global.!current_filenames.0 = 1 & Substr( filetype, 5,6 ) = 'binary' Then 11434 Do 11435 /* 11436 * We have 1 file and it is a binary file; prepare to change the 11437 * menu significantly. 11438 */ 11439 is_binary_file = 1 11440 Parse Var user . 5 . '(' locker ')' 11441 End 11442 Else is_binary_file = 0 11443 If !global.!dir.!reservedcheckout.this_dir = 'Y' | !global.!reservedcheckout = 'Y' Then 11444 Do 11445 is_reserved_file = 1 11446 Parse Var user . 5 . '(' locker ')' 11447 End 11448 Else is_reserved_file = 0 11449 if trace() = 'F' Then say 'is_binary_file' is_binary_file 'is_reserved_file' is_reserved_file 'type' !global.!repfiles.?filetype.!!last_repository.afpi 11450 /* 11451 * Do some preliminary checks for multiple files that involve binary files. 11452 * If multiple files are selected and there is a mix between binary 11453 * and text, then everything is disabled (except Get Latest) 11454 */ 11455 number_text_files = 0 11456 number_binary_files = 0 11457 Do j = 1 To !global.!current_filenames.0 11458 k = Word( current_indexes, j ) 11459 If Substr( !global.!repfiles.?filetype.!!last_repository.k, 5, 6 ) = 'binary' Then number_binary_files = number_binary_files + 1 11460 Else number_text_files = number_text_files + 1 11461 End 11462 if trace() = 'F' Then say 'number_text_files' number_text_files 'number_binary_files' number_binary_files 11463 Do i = 1 To !global.!filepopup_type.0 11464 If !global.!filepopup_type.i = 'command' Then 11465 Do 11466 /* 11467 * Now do the checks... 11468 */ 11469 If !global.!filepopup_command.i = 'refreshfiles' Then 11470 Do 11471 /* 11472 * Refresh is always available 11473 */ 11474 !global.!filepopup_state.i = 'normal' 11475 Iterate 11476 End 11477 If !global.!current_filenames.0 = 0 Then 11478 Do 11479 /* 11480 * If no files selected, set everything to disabled 11481 */ 11482 !global.!filepopup_state.i = 'disabled' 11483 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled no files selected' 11484 Iterate 11485 End 11486 If !global.!offline.!!last_repository & Word( !global.!filepopup_initial_state.i, 5 ) = 'D' Then 11487 Do 11488 /* 11489 * Offline mode is very restrictive... 11490 */ 11491 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled offline' 11492 !global.!filepopup_state.i = 'disabled' 11493 Iterate 11494 End 11495 If Word( !global.!filepopup_initial_state.i, 6 ) = 'D' Then 11496 /* 11497 * If the working file(s) don't exist, you can't do much! 11498 */ 11499 Do j = 1 To !global.!current_filenames.0 11500 If Stream( CVSFileToWorkingFile( !global.!current_filenames.j, !!last_repository ), 'C', 'QUERY EXISTS' ) = '' Then 11501 Do 11502 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled no working file' 11503 !global.!filepopup_state.i = 'disabled' 11504 Iterate i 11505 End 11506 End 11507 If Word( !global.!filepopup_initial_state.i, 4 ) = 'D' Then 11508 Do 11509 /* 11510 * If the number of selected files is more 11511 * than 1 and Word(!global.!filepopup_initial_state.i,4) = 'D', then disable 11512 * it. 11513 */ 11514 If !global.!current_filenames.0 \= 1 Then 11515 Do 11516 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled only valid for single file' 11517 !global.!filepopup_state.i = 'disabled' 11518 Iterate 11519 End 11520 End 11521 /* 11522 * Now tests for individual commands... 11523 */ 11524 !global.!filepopup_state.i = 'normal' 11525 Select 11526 When !global.!filepopup_command.i = 'fileproperties' Then 11527 /* 11528 * Allow file properties 11529 */ 11530 Do 11531 !global.!filepopup_state.i = 'normal' 11532 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11533 Iterate 11534 End 11535 When !global.!filepopup_command.i = 'addfiles' Then 11536 /* 11537 * We are on the repository files page; 11538 * disable "addfiles" 11539 */ 11540 Do 11541 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled' 11542 !global.!filepopup_state.i = 'disabled' 11543 Iterate 11544 End 11545 When !global.!filepopup_command.i = 'editlatest' Then 11546 Do 11547 /* 11548 * If a binary file or a file in a reserved 11549 * checkout directory, and someone else 11550 * has the lock, then no go 11551 */ 11552 If (is_binary_file | is_reserved_file) & locker \= '' & Translate( locker ) \= Translate( !global.!user ) Then 11553 Do 11554 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled binary file locked by other' 11555 !global.!filepopup_state.i = 'disabled' 11556 Iterate 11557 End 11558 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11559 End 11560 When !global.!filepopup_command.i = 'update' Then 11561 Do 11562 Select 11563 When Stream( !global.!current_dirname.!!last_repository, 'C', 'QUERY EXISTS' ) = '' Then 11564 Do 11565 /* 11566 * The working directory doesn't exist; disable update 11567 */ 11568 !global.!filepopup_state.i = 'disabled' 11569 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled update - no working dir' 11570 Iterate 11571 End 11572 Otherwise Nop 11573 End 11574 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11575 End 11576 When !global.!filepopup_command.i = 'undocheckout' Then 11577 Do 11578 If is_binary_file | is_reserved_file Then 11579 Do 11580 /* 11581 * We have 1 file and it is a binary file; or 11582 * in a reserved checkout directory, 11583 * its disabled is we don't own the lock 11584 */ 11585 If Translate( locker ) \= Translate( !global.!user ) Then 11586 Do 11587 !global.!filepopup_state.i = 'disabled' 11588 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled binary file not locked by me' 11589 Iterate 11590 End 11591 End 11592 Else 11593 Do 11594 /* 11595 * Text files don't use this 11596 */ 11597 !global.!filepopup_state.i = 'disabled' 11598 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled text file' 11599 Iterate 11600 End 11601 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11602 End 11603 When !global.!filepopup_command.i = 'checkout' Then 11604 Do 11605 numcanbecheckedout = 0 11606 Do k = 1 To !global.!current_indexes.0 11607 If CanFileBeCheckedOutForLock( !global.!current_indexes.k, is_reserved_file ) Then 11608 numcanbecheckedout = numcanbecheckedout + 1 11609 End 11610 If numcanbecheckedout \= !global.!current_indexes.0 Then 11611 Do 11612 !global.!filepopup_state.i = 'disabled' 11613 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled all binary files cannot be checked out' 11614 Iterate 11615 End 11616 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11617 End 11618 When !global.!filepopup_command.i = 'checkin' Then 11619 Do 11620 /* 11621 * If the user is not allowed to checkin, disable that. 11622 */ 11623 If !global.!update_user.!!last_repository = 'N' Then 11624 Do 11625 !global.!filepopup_state.i = 'disabled' 11626 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled user cant update' 11627 Iterate 11628 End 11629 /* 11630 * If a binary file or a file in a reserved 11631 * checkout directory, and we don't hold 11632 * the lock, no go 11633 */ 11634 If (is_binary_file | is_reserved_file) & Translate( locker ) \= Translate( !global.!user ) Then 11635 Do 11636 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled binary file we arent locker' 11637 !global.!filepopup_state.i = 'disabled' 11638 Iterate 11639 End 11640 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11641 End 11642 When !global.!filepopup_command.i = 'showdifferences' Then 11643 Do 11644 /* 11645 * This is invalid for binary files, except for Word .doc 11646 * files 11647 */ 11648 If is_binary_file Then 11649 Do 11650 If !global.!os = 'WIN32' & Translate( Right( !global.!current_filenames.1, 4 ) ) = '.DOC' Then 11651 Do 11652 !global.!filepopup_state.i = 'normal' 11653 End 11654 Else 11655 Do 11656 !global.!filepopup_state.i = 'disabled' 11657 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled binary file' 11658 End 11659 Iterate 11660 End 11661 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11662 End 11663 When !global.!filepopup_command.i = 'showannotations' Then 11664 Do 11665 /* 11666 * This is invalid for binary files 11667 */ 11668 If is_binary_file Then 11669 Do 11670 !global.!filepopup_state.i = 'disabled' 11671 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled binary file' 11672 Iterate 11673 End 11674 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11675 End 11676 When !global.!filepopup_command.i = 'deletefromrepository' Then 11677 /* 11678 * If the user is not allowed to delete, then delete 11679 * is unavailable 11680 */ 11681 Do 11682 If !global.!administrator.!!last_repository = 'Y' Then 11683 Do 11684 !global.!filepopup_state.i = 'normal' 11685 if trace() = 'F' Then say !global.!filepopup_command.i 'normal - we are administrator' 11686 Iterate 11687 End 11688 If !global.!update_user.!!last_repository = 'N' Then 11689 Do 11690 /* 11691 * If you aren't an update user, you can't delete 11692 */ 11693 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled we arent an update user' 11694 !global.!filepopup_state.i = 'disabled' 11695 Iterate 11696 End 11697 If !global.!user_can_delete = 'Y' Then 11698 Do 11699 !global.!filepopup_state.i = 'normal' 11700 if trace() = 'F' Then say !global.!filepopup_command.i 'normal - we are allowed delete' 11701 Iterate 11702 End 11703 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled we arent allowed to delete or not admin' 11704 !global.!filepopup_state.i = 'disabled' 11705 End 11706 Otherwise 11707 /* 11708 * If we get here, we allow the button/menu item 11709 */ 11710 Do 11711 !global.!filepopup_state.i = 'normal' 11712 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11713 End 11714 End 11715 End 11716 End 11717 End 11718 Otherwise /* not CVS */ 11719 Do 11720 this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 11721 If !global.!current_filenames.0 = 1 & Substr( !global.!repfiles.?filetype.!!last_repository.afpi, 5,6 ) = 'binary' Then 11722 Do 11723 /* 11724 * We have 1 file and it is a binary file; prepare to change the 11725 * menu significantly. 11726 */ 11727 is_binary_file = 1 11728 Parse Var !global.!repfiles.?user.!!last_repository.afpi . 5 . '(' locker ')' 11729 End 11730 Else is_binary_file = 0 11731 If !global.!dir.!reservedcheckout.this_dir = 'Y' | !global.!reservedcheckout = 'Y' Then 11732 Do 11733 is_reserved_file = 1 11734 Parse Var !global.!repfiles.?user.!!last_repository.afpi . 5 . '(' locker ')' 11735 End 11736 Else is_reserved_file = 0 11737 if trace() = 'F' Then say 'is_binary_file' is_binary_file 'is_reserved_file' is_reserved_file 'type' !global.!repfiles.?filetype.!!last_repository.afpi 11738 /* 11739 * Do some preliminary checks for multiple files that involve binary files. 11740 * If multiple files are selected and there is a mix between binary 11741 * and text, then everything is disabled (except Get Latest) 11742 */ 11743 number_text_files = 0 11744 number_binary_files = 0 11745 Do j = 1 To !global.!current_filenames.0 11746 afpi = Word( current_indexes, j ) 11747 If Substr( !global.!repfiles.?filetype.!!last_repository.afpi, 5, 6 ) = 'binary' Then number_binary_files = number_binary_files + 1 11748 Else number_text_files = number_text_files + 1 11749 End 11750 if trace() = 'F' Then say 'number_text_files' number_text_files 'number_binary_files' number_binary_files 11751 11752 Do i = 1 To !global.!filepopup_type.0 11753 If !global.!filepopup_type.i = 'command' Then 11754 Do 11755 /* 11756 * Now do the checks... 11757 */ 11758 If !global.!filepopup_command.i = 'refreshfiles' Then 11759 Do 11760 /* 11761 * Refresh is always available 11762 */ 11763 !global.!filepopup_state.i = 'normal' 11764 Iterate 11765 End 11766 If !global.!current_filenames.0 = 0 Then 11767 Do 11768 /* 11769 * If no files selected, set everything to disabled 11770 */ 11771 !global.!filepopup_state.i = 'disabled' 11772 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled no files selected' 11773 Iterate 11774 End 11775 If !global.!offline.!!last_repository & Word( !global.!filepopup_initial_state.i, 5 ) = 'D' Then 11776 Do 11777 /* 11778 * Offline mode is very restrictive... 11779 */ 11780 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled offline' 11781 !global.!filepopup_state.i = 'disabled' 11782 Iterate 11783 End 11784 If Word( !global.!filepopup_initial_state.i, 6 ) = 'D' Then 11785 /* 11786 * If the working file(s) don't exist, you can't do much! 11787 */ 11788 Do j = 1 To !global.!current_filenames.0 11789 If Stream( CVSFileToWorkingFile( !global.!current_filenames.j, !!last_repository ), 'C', 'QUERY EXISTS' ) = '' Then 11790 Do 11791 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled no working file' 11792 !global.!filepopup_state.i = 'disabled' 11793 Iterate i 11794 End 11795 End 11796 If Word( !global.!filepopup_initial_state.i, 4 ) = 'D' Then 11797 Do 11798 /* 11799 * If the number of selected files is more 11800 * than 1 and Word(!global.!filepopup_initial_state.i,4) = 'D', then disable 11801 * it. 11802 */ 11803 If !global.!current_filenames.0 \= 1 Then 11804 Do 11805 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled only valid for single file' 11806 !global.!filepopup_state.i = 'disabled' 11807 Iterate 11808 End 11809 End 11810 /* 11811 * Now tests for individual commands... 11812 */ 11813 !global.!filepopup_state.i = 'normal' 11814 Select 11815 When !global.!filepopup_command.i = 'fileproperties' Then 11816 /* 11817 * Allow file properties 11818 */ 11819 Do 11820 !global.!filepopup_state.i = 'normal' 11821 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11822 Iterate 11823 End 11824 When !global.!filepopup_command.i = 'addfiles' Then 11825 /* 11826 * We are on the repository files page; 11827 * disable "addfiles" 11828 */ 11829 Do 11830 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled' 11831 !global.!filepopup_state.i = 'disabled' 11832 Iterate 11833 End 11834 When !global.!filepopup_command.i = 'editlatest' Then 11835 Do 11836 /* 11837 * If a binary file or a file in a reserved 11838 * checkout directory, and someone else 11839 * has the lock, then no go 11840 */ 11841 If locker \= '' & Translate( locker ) \= Translate( !global.!user ) Then 11842 Do 11843 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled file locked by other' 11844 !global.!filepopup_state.i = 'disabled' 11845 Iterate 11846 End 11847 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11848 End 11849 When !global.!filepopup_command.i = 'update' Then 11850 Do 11851 !global.!filepopup_state.i = 'disabled' 11852 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled update invalid command' 11853 Iterate 11854 End 11855 When !global.!filepopup_command.i = 'undocheckout' Then 11856 Do 11857 /* 11858 * We have 1 file and it is a binary file; or 11859 * in a reserved checkout directory, 11860 * its disabled is we don't own the lock 11861 */ 11862 If Translate( locker ) \= Translate( !global.!user ) Then 11863 Do 11864 !global.!filepopup_state.i = 'disabled' 11865 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled file not locked by me' 11866 Iterate 11867 End 11868 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11869 End 11870 When !global.!filepopup_command.i = 'checkout' Then 11871 Do 11872 /* 11873 * We have 1 file and it is a binary file or 11874 * we are in a reserved directory, checkout 11875 * is only valid if its not locked 11876 */ 11877 If locker \= '' Then 11878 Do 11879 !global.!filepopup_state.i = 'disabled' 11880 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled file checked out already' 11881 Iterate 11882 End 11883 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11884 End 11885 When !global.!filepopup_command.i = 'checkin' Then 11886 Do 11887 /* 11888 * If the user is not allowed to checkin, disable that. 11889 */ 11890 If !global.!update_user.!!last_repository = 'N' Then 11891 Do 11892 !global.!filepopup_state.i = 'disabled' 11893 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled user cant update' 11894 Iterate 11895 End 11896 /* 11897 * If a binary file or a file in a reserved 11898 * checkout directory, and we don't hold 11899 * the lock, no go 11900 */ 11901 If Translate( locker ) \= Translate( !global.!user ) Then 11902 Do 11903 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled binary file we arent locker' 11904 !global.!filepopup_state.i = 'disabled' 11905 Iterate 11906 End 11907 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11908 End 11909 When !global.!filepopup_command.i = 'showdifferences' Then 11910 Do 11911 /* 11912 * This is invalid for binary files, except for Word .doc 11913 * files 11914 */ 11915 If is_binary_file Then 11916 Do 11917 If !global.!os = 'WIN32' & Translate( Right( !global.!current_filenames.1, 4 ) ) = '.DOC' Then 11918 Do 11919 !global.!filepopup_state.i = 'normal' 11920 End 11921 Else 11922 Do 11923 !global.!filepopup_state.i = 'disabled' 11924 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled binary file' 11925 End 11926 Iterate 11927 End 11928 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11929 End 11930 When !global.!filepopup_command.i = 'showannotations' Then 11931 Do 11932 !global.!filepopup_state.i = 'disabled' 11933 Iterate 11934 End 11935 When !global.!filepopup_command.i = 'deletefromrepository' Then 11936 /* 11937 * If the user is not allowed to delete, then delete 11938 * is unavailable 11939 */ 11940 Do 11941 If !global.!administrator.!!last_repository = 'Y' Then 11942 Do 11943 !global.!filepopup_state.i = 'normal' 11944 if trace() = 'F' Then say !global.!filepopup_command.i 'normal - we are administrator' 11945 Iterate 11946 End 11947 If !global.!user_can_delete = 'Y' Then 11948 Do 11949 !global.!filepopup_state.i = 'normal' 11950 if trace() = 'F' Then say !global.!filepopup_command.i 'normal - we are allowed delete' 11951 Iterate 11952 End 11953 if trace() = 'F' Then say !global.!filepopup_command.i 'disabled we arent allowed to delete or not admin' 11954 !global.!filepopup_state.i = 'disabled' 11955 End 11956 Otherwise 11957 /* 11958 * If we get here, we allow the button/menu item 11959 */ 11960 Do 11961 !global.!filepopup_state.i = 'normal' 11962 if trace() = 'F' Then say !global.!filepopup_command.i 'normal' 11963 End 11964 End 11965 End 11966 End 11967 End 11968 End 11969 End 11970 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?nonrepfiles.!!last_repository Then 11971 Do 11972 /* 11973 * Determine which non-repository items are currently selected 11974 */ 11975 current_indexes = '' 11976 selected = dw_container_query_start( !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_CRA_SELECTED ) 11977 Do i = 1 While selected \= '' 11978 current_indexes = current_indexes selected 11979 !global.!current_nonrepfilenames.i = Substr( !global.!nonrepfiles.?filename.!!last_repository.selected, 5 ) 11980 !global.!current_nonrepindexes.i = selected 11981 if trace() = 'F' Then say 'selected' selected !global.!current_nonrepfilenames.i !global.!nonrepfiles.?filetype.!!last_repository.selected 11982 selected = dw_container_query_next( !global.!nonrepfilescontainer.!!last_repository, !REXXDW.!DW_CRA_SELECTED ) 11983 End 11984 !global.!current_nonrepfilenames.0 = i-1 11985 !global.!current_nonrepindexes.0 = i-1 11986 Select 11987 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 11988 Do 11989 Do i = 1 To !global.!filepopup_type.0 11990 If !global.!filepopup_type.i = 'command' Then 11991 Do 11992 /* 11993 * Refresh is always available 11994 */ 11995 If !global.!filepopup_command.i = 'refreshfiles' Then 11996 Do 11997 !global.!filepopup_state.i = 'normal' 11998 Iterate 11999 End 12000 /* 12001 * If no files selected, set everything to disabled 12002 */ 12003 If !global.!current_nonrepfilenames.0 = 0 Then 12004 Do 12005 !global.!filepopup_state.i = 'disabled' 12006 Iterate 12007 End 12008 /* 12009 * If multiple files selected, and multiples disallowed; disable 12010 */ 12011 If !global.!current_nonrepfilenames.0 \= 1 & Word( !global.!filepopup_initial_state.i, 4 ) = 'D' Then 12012 Do 12013 !global.!filepopup_state.i = 'disabled' 12014 Iterate 12015 End 12016 /* 12017 * Limit add to update users... 12018 */ 12019 If !global.!filepopup_command.i = 'addfiles' & !global.!update_user.!!last_repository = 'Y' Then 12020 Do 12021 !global.!filepopup_state.i = 'normal' 12022 Iterate 12023 End 12024 /* 12025 * To get here at least 1 file is selected 12026 * therefore allow refresh, view, edit, delete, rename 12027 */ 12028 If !global.!filepopup_command.i = 'viewlatest' | !global.!filepopup_command.i = 'editlatest' | !global.!filepopup_command.i = 'deletefromrepository' /*| !global.!filepopup_command.i = 'renameinrepository' */ Then 12029 Do 12030 !global.!filepopup_state.i = 'normal' 12031 Iterate 12032 End 12033 /* 12034 * Disable everything else 12035 */ 12036 !global.!filepopup_state.i = 'disabled' 12037 End 12038 End 12039 End 12040 Otherwise Nop 12041 End 12042 End 12043 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?deletedfiles.!!last_repository Then 12044 Do 12045 /* 12046 * Determine which deleted items are currently selected 12047 */ 12048 current_indexes = '' 12049 selected = dw_container_query_start( !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_CRA_SELECTED ) 12050 Do i = 1 While selected \= '' 12051 current_indexes = current_indexes selected 12052 !global.!current_deletedfilenames.i = Substr( !global.!deletedfiles.?fullfilename.!!last_repository.selected, 5 ) 12053 !global.!current_deletedindexes.i = selected 12054 selected = dw_container_query_next( !global.!deletedfilescontainer.!!last_repository, !REXXDW.!DW_CRA_SELECTED ) 12055 End 12056 !global.!current_deletedfilenames.0 = i-1 12057 !global.!current_deletedindexes.0 = i-1 12058 afpi = Word( current_indexes, 1 ) 12059 changes = '' 12060 Do i = 1 To !global.!filepopup_type.0 12061 If !global.!filepopup_type.i = 'command' Then 12062 Do 12063 /* 12064 * Now do the checks... 12065 */ 12066 If !global.!filepopup_command.i = 'refreshfiles' Then 12067 Do 12068 /* 12069 * Refresh is always available 12070 */ 12071 !global.!filepopup_state.i = 'normal' 12072 Iterate 12073 End 12074 If !global.!current_deletedfilenames.0 = 0 Then 12075 Do 12076 /* 12077 * If no files selected, set everything to disabled 12078 */ 12079 !global.!filepopup_state.i = 'disabled' 12080 Iterate 12081 End 12082 /* 12083 * Now tests for individual commands... 12084 */ 12085 !global.!filepopup_state.i = 'disabled' 12086 Select 12087 When !global.!filepopup_command.i = 'fileproperties' & !global.!current_deletedfilenames.0 = 1 Then 12088 /* 12089 * Allow file properties 12090 */ 12091 Do 12092 !global.!filepopup_state.i = 'normal' 12093 Iterate 12094 End 12095 When !global.!filepopup_command.i = 'addfiles' Then 12096 /* 12097 * We are on the deleted files page; 12098 * enable "addfiles" if qdmin or user_can_delete 12099 */ 12100 Do 12101 If !global.!administrator.!!last_repository = 'Y' Then 12102 Do 12103 !global.!filepopup_state.i = 'normal' 12104 Iterate 12105 End 12106 If !global.!user_can_delete = 'Y' Then 12107 Do 12108 !global.!filepopup_state.i = 'normal' 12109 Iterate 12110 End 12111 !global.!filepopup_state.i = 'disabled' 12112 End 12113 Otherwise 12114 /* 12115 * If we get here, we disallow the button/menu item 12116 */ 12117 Do 12118 !global.!filepopup_state.i = 'disabled' 12119 End 12120 End 12121 End 12122 End 12123 End 12124 Otherwise Nop 12125End 12126Return 12127 12128AdjustFileToolbarButtons: Procedure Expose !REXXDW. !global. !!last_repository 12129/* 12130 * Based on the status of each dir command, enable or disable the button 12131 */ 12132Do i = 1 To !global.!filepopup_command.0 12133 If !global.!filepopup_type.i = 'command' Then 12134 Do 12135 If !global.!filepopup_state.i = 'normal' Then Call dw_window_enable !global.!filetoolbarbutton.i 12136 Else Call dw_window_disable !global.!filetoolbarbutton.i 12137 End 12138End 12139Return 12140 12141SortFileArray: Procedure Expose !REXXDW. !global. !!last_repository 12142/* 12143 * Sort into current sort order 12144 * All field arrays have a 4 digit prefix which is the current sort order; 12145 * equivalent to the current tail value 12146 * Filename Date 12147 * ...1a file ...120001112 12148 * ...2b file ...220001110 12149 * ...3c file ...320001111 12150 * 12151 * Sort on date column ... 12152 * Date 12153 * ...220001110 12154 * ...320001111 12155 * ...120001112 12156 * 12157 * Copy Filename stem to tmpfilename. 12158 * Copy locker stem to tmplocker. 12159 * Drop Filename stem 12160 * Do i = 1 To date.0 12161 * idx = Strip(Left(date.i,4)) 12162 * newi = Right(i,4) 12163 * 12164 * date.i = newi||Substr(date.i,5) <-- i 12165 * 12166 * !global.!repfiles.?filename.!!last_repository.i = newi||Substr(tmpfilename.idx,5) <-- idx 12167 * locker.i = newi||Substr(tmplocker.idx,5) <-- idx 12168 * End 12169 * Drop tmpfilename. 12170 * Drop tmplocker. 12171 * 12172 */ 12173/* 12174 * Split each file up into the bits we need 12175 */ 12176/* 12177 * If there are no files or only 1, there is no need to sort 12178 * anything 12179 */ 12180If !global.!repfiles.?fullfilename.!!last_repository.0 > 1 Then 12181 Do 12182 Select 12183 When !global.!repfile_sort_order = 0 Then /* name */ 12184 Do 12185 Call RegMultiStemSort !global.!repfile_sort_direction.0, !global.!!user.!!preference.!!sort, 5, , , 12186 !global.!repfiles.?filename.!!last_repository., , 12187 !global.!repfiles.?user.!!last_repository., , 12188 !global.!repfiles.?filerev.!!last_repository., , 12189 !global.!repfiles.?filedate.!!last_repository., , 12190 !global.!repfiles.?fullfilename.!!last_repository., , 12191 !global.!repfiles.?filetype.!!last_repository., , 12192 !global.!repfiles.?filestatus.!!last_repository., , 12193 !global.!repfiles.?filereminder.!!last_repository. 12194 End 12195 When !global.!repfile_sort_order = 1 Then /* status */ 12196 Do 12197 Call RegMultiStemSort !global.!repfile_sort_direction.1, !global.!!user.!!preference.!!sort, 5, , , 12198 !global.!repfiles.?filestatus.!!last_repository., , 12199 !global.!repfiles.?user.!!last_repository., , 12200 !global.!repfiles.?filerev.!!last_repository., , 12201 !global.!repfiles.?filedate.!!last_repository., , 12202 !global.!repfiles.?fullfilename.!!last_repository., , 12203 !global.!repfiles.?filetype.!!last_repository., , 12204 !global.!repfiles.?filename.!!last_repository., , 12205 !global.!repfiles.?filereminder.!!last_repository. 12206 End 12207 When !global.!repfile_sort_order = 2 Then /* date */ 12208 Do 12209 Call RegMultiStemSort !global.!repfile_sort_direction.2, !global.!!user.!!preference.!!sort, 5, , , 12210 !global.!repfiles.?filedate.!!last_repository., , 12211 !global.!repfiles.?user.!!last_repository., , 12212 !global.!repfiles.?filerev.!!last_repository., , 12213 !global.!repfiles.?filename.!!last_repository., , 12214 !global.!repfiles.?fullfilename.!!last_repository., , 12215 !global.!repfiles.?filetype.!!last_repository., , 12216 !global.!repfiles.?filestatus.!!last_repository., , 12217 !global.!repfiles.?filereminder.!!last_repository. 12218 End 12219 When !global.!repfile_sort_order = 3 Then /* user / locker */ 12220 Do 12221 Call RegMultiStemSort !global.!repfile_sort_direction.3, !global.!!user.!!preference.!!sort, 5, , , 12222 !global.!repfiles.?user.!!last_repository., , 12223 !global.!repfiles.?filename.!!last_repository., , 12224 !global.!repfiles.?filerev.!!last_repository., , 12225 !global.!repfiles.?filedate.!!last_repository., , 12226 !global.!repfiles.?fullfilename.!!last_repository., , 12227 !global.!repfiles.?filetype.!!last_repository., , 12228 !global.!repfiles.?filestatus.!!last_repository., , 12229 !global.!repfiles.?filereminder.!!last_repository. 12230 End 12231 When !global.!repfile_sort_order = 4 Then /* rev */ 12232 Do 12233 Call RegMultiStemSort !global.!repfile_sort_direction.4, !global.!!user.!!preference.!!sort, 5, , , 12234 !global.!repfiles.?filerev.!!last_repository., , 12235 !global.!repfiles.?filename.!!last_repository., , 12236 !global.!repfiles.?user.!!last_repository., , 12237 !global.!repfiles.?filedate.!!last_repository., , 12238 !global.!repfiles.?fullfilename.!!last_repository., , 12239 !global.!repfiles.?filetype.!!last_repository., , 12240 !global.!repfiles.?filestatus.!!last_repository., , 12241 !global.!repfiles.?filereminder.!!last_repository. 12242 End 12243 When !global.!repfile_sort_order = 5 Then /* reminder */ 12244 Do 12245 Call RegMultiStemSort !global.!repfile_sort_direction.5, !global.!!user.!!preference.!!sort, 5, , , 12246 !global.!repfiles.?filereminder.!!last_repository., , 12247 !global.!repfiles.?filename.!!last_repository., , 12248 !global.!repfiles.?user.!!last_repository., , 12249 !global.!repfiles.?filedate.!!last_repository., , 12250 !global.!repfiles.?fullfilename.!!last_repository., , 12251 !global.!repfiles.?filetype.!!last_repository., , 12252 !global.!repfiles.?filestatus.!!last_repository., , 12253 !global.!repfiles.?filerev.!!last_repository. 12254 End 12255 Otherwise Nop 12256 End 12257 End 12258Return 12259 12260SortNonrepFileArray: Procedure Expose !REXXDW. !global. !!last_repository 12261/* 12262 * Sort into current sort order 12263 * All field arrays have a 4 digit prefix which is the current sort order; 12264 * equivalent to the current tail value 12265 * Filename Date 12266 * ...1a file ...120001112 12267 * ...2b file ...220001110 12268 * ...3c file ...320001111 12269 * 12270 * Sort on date column ... 12271 * Date 12272 * ...220001110 12273 * ...320001111 12274 * ...120001112 12275 * 12276 * Copy Filename stem to tmpfilename. 12277 * Copy locker stem to tmplocker. 12278 * Drop Filename stem 12279 * Do i = 1 To date.0 12280 * idx = Strip(Left(date.i,4)) 12281 * newi = Right(i,4) 12282 * 12283 * date.i = newi||Substr(date.i,5) <-- i 12284 * 12285 * !global.!repfiles.?filename.!!last_repository.i = newi||Substr(tmpfilename.idx,5) <-- idx 12286 * locker.i = newi||Substr(tmplocker.idx,5) <-- idx 12287 * End 12288 * Drop tmpfilename. 12289 * Drop tmplocker. 12290 * 12291 */ 12292/* 12293 * Split each file up into the bits we need 12294 */ 12295/* 12296 * If there are no files or only 1, there is no need to sort 12297 * anything 12298 */ 12299if trace() = 'F' Then say '!global.!nonrepfiles.?fullfilename.!!last_repository.0' !global.!nonrepfiles.?fullfilename.!!last_repository.0 12300if trace() = 'F' Then say '!global.!nonrepfile_sort_order' !global.!nonrepfile_sort_order 12301If !global.!nonrepfiles.?fullfilename.!!last_repository.0 > 1 Then 12302 Do 12303 Select 12304 When !global.!nonrepfile_sort_order = 0 Then /* name */ 12305 Do 12306 Call RegMultiStemSort !global.!nonrepfile_sort_direction.0, !global.!!user.!!preference.!!sort, 5, , , 12307 !global.!nonrepfiles.?filename.!!last_repository., , 12308 !global.!nonrepfiles.?filedate.!!last_repository., , 12309 !global.!nonrepfiles.?fullfilename.!!last_repository., , 12310 !global.!nonrepfiles.?filetype.!!last_repository., , 12311 !global.!nonrepfiles.?filesize.!!last_repository., , 12312 !global.!nonrepfiles.?fileperm.!!last_repository. 12313 End 12314 When !global.!nonrepfile_sort_order = 1 Then /* date */ 12315 Do 12316 Call RegMultiStemSort !global.!nonrepfile_sort_direction.1, !global.!!user.!!preference.!!sort, 5, , , 12317 !global.!nonrepfiles.?filedate.!!last_repository., , 12318 !global.!nonrepfiles.?filename.!!last_repository., , 12319 !global.!nonrepfiles.?fullfilename.!!last_repository., , 12320 !global.!nonrepfiles.?filetype.!!last_repository., , 12321 !global.!nonrepfiles.?filesize.!!last_repository., , 12322 !global.!nonrepfiles.?fileperm.!!last_repository. 12323 End 12324 When !global.!nonrepfile_sort_order = 2 Then /* size */ 12325 Do 12326 Call RegMultiStemSort !global.!nonrepfile_sort_direction.2, !global.!!user.!!preference.!!sort, 5, , , 12327 !global.!nonrepfiles.?filesize.!!last_repository., , 12328 !global.!nonrepfiles.?filename.!!last_repository., , 12329 !global.!nonrepfiles.?filedate.!!last_repository., , 12330 !global.!nonrepfiles.?fullfilename.!!last_repository., , 12331 !global.!nonrepfiles.?filetype.!!last_repository., , 12332 !global.!nonrepfiles.?fileperm.!!last_repository. 12333 End 12334 When !global.!nonrepfile_sort_order = 3 Then /* perm */ 12335 Do 12336 Call RegMultiStemSort !global.!nonrepfile_sort_direction.3, !global.!!user.!!preference.!!sort, 5, , , 12337 !global.!nonrepfiles.?fileperm.!!last_repository., , 12338 !global.!nonrepfiles.?filename.!!last_repository., , 12339 !global.!nonrepfiles.?filedate.!!last_repository., , 12340 !global.!nonrepfiles.?fullfilename.!!last_repository., , 12341 !global.!nonrepfiles.?filetype.!!last_repository., , 12342 !global.!nonrepfiles.?filesize.!!last_repository. 12343 End 12344 Otherwise Nop 12345 End 12346 End 12347Return 12348 12349SortAllFileArray: Procedure Expose !REXXDW. !global. !!last_repository 12350/* 12351 * Sort into current sort order 12352 * All field arrays have a 4 digit prefix which is the current sort order; 12353 * equivalent to the current tail value 12354 * Filename Date 12355 * ...1a file ...120001112 12356 * ...2b file ...220001110 12357 * ...3c file ...320001111 12358 * 12359 * Sort on date column ... 12360 * Date 12361 * ...220001110 12362 * ...320001111 12363 * ...120001112 12364 * 12365 * Copy Filename stem to tmpfilename. 12366 * Copy locker stem to tmplocker. 12367 * Drop Filename stem 12368 * Do i = 1 To date.0 12369 * idx = Strip(Left(date.i,4)) 12370 * newi = Right(i,4) 12371 * 12372 * date.i = newi||Substr(date.i,5) <-- i 12373 * 12374 * !global.!allfiles.?filename.!!last_repository.i = newi||Substr(tmpfilename.idx,5) <-- idx 12375 * locker.i = newi||Substr(tmplocker.idx,5) <-- idx 12376 * End 12377 * Drop tmpfilename. 12378 * Drop tmplocker. 12379 * 12380 */ 12381/* 12382 * Split each file up into the bits we need 12383 */ 12384/* 12385 * If there are no files or only 1, there is no need to sort 12386 * anything 12387 */ 12388If !global.!allfiles.?fullfilename.!!last_repository.0 > 1 Then 12389 Do 12390 Select 12391 When !global.!allfile_sort_order = 0 Then /* name */ 12392 Do 12393 Call RegMultiStemSort !global.!allfile_sort_direction.0, !global.!!user.!!preference.!!sort, 5, , , 12394 !global.!allfiles.?filename.!!last_repository., , 12395 !global.!allfiles.?user.!!last_repository., , 12396 !global.!allfiles.?filerev.!!last_repository., , 12397 !global.!allfiles.?filedate.!!last_repository., , 12398 !global.!allfiles.?fullfilename.!!last_repository., , 12399 !global.!allfiles.?filepath.!!last_repository., , 12400 !global.!allfiles.?filetype.!!last_repository., , 12401 !global.!allfiles.?filestatus.!!last_repository., , 12402 !global.!allfiles.?filereminder.!!last_repository. 12403 End 12404 When !global.!allfile_sort_order = 1 Then /* status */ 12405 Do 12406 Call RegMultiStemSort !global.!allfile_sort_direction.1, !global.!!user.!!preference.!!sort, 5, , , 12407 !global.!allfiles.?filestatus.!!last_repository., , 12408 !global.!allfiles.?user.!!last_repository., , 12409 !global.!allfiles.?filerev.!!last_repository., , 12410 !global.!allfiles.?filedate.!!last_repository., , 12411 !global.!allfiles.?fullfilename.!!last_repository., , 12412 !global.!allfiles.?filetype.!!last_repository., , 12413 !global.!allfiles.?filename.!!last_repository., , 12414 !global.!allfiles.?filepath.!!last_repository., , 12415 !global.!allfiles.?filereminder.!!last_repository. 12416 End 12417 When !global.!allfile_sort_order = 2 Then /* date */ 12418 Do 12419 Call RegMultiStemSort !global.!allfile_sort_direction.2, !global.!!user.!!preference.!!sort, 5, , , 12420 !global.!allfiles.?filedate.!!last_repository., , 12421 !global.!allfiles.?user.!!last_repository., , 12422 !global.!allfiles.?filerev.!!last_repository., , 12423 !global.!allfiles.?filename.!!last_repository., , 12424 !global.!allfiles.?fullfilename.!!last_repository., , 12425 !global.!allfiles.?filepath.!!last_repository., , 12426 !global.!allfiles.?filetype.!!last_repository., , 12427 !global.!allfiles.?filestatus.!!last_repository., , 12428 !global.!allfiles.?filereminder.!!last_repository. 12429 End 12430 When !global.!allfile_sort_order = 3 Then /* user / locker */ 12431 Do 12432 Call RegMultiStemSort !global.!allfile_sort_direction.3, !global.!!user.!!preference.!!sort, 5, , , 12433 !global.!allfiles.?user.!!last_repository., , 12434 !global.!allfiles.?filename.!!last_repository., , 12435 !global.!allfiles.?filepath.!!last_repository., , 12436 !global.!allfiles.?filerev.!!last_repository., , 12437 !global.!allfiles.?filedate.!!last_repository., , 12438 !global.!allfiles.?fullfilename.!!last_repository., , 12439 !global.!allfiles.?filetype.!!last_repository., , 12440 !global.!allfiles.?filestatus.!!last_repository., , 12441 !global.!allfiles.?filereminder.!!last_repository. 12442 End 12443 When !global.!allfile_sort_order = 4 Then /* rev */ 12444 Do 12445 Call RegMultiStemSort !global.!allfile_sort_direction.4, !global.!!user.!!preference.!!sort, 5, , , 12446 !global.!allfiles.?filerev.!!last_repository., , 12447 !global.!allfiles.?filename.!!last_repository., , 12448 !global.!allfiles.?filepath.!!last_repository., , 12449 !global.!allfiles.?user.!!last_repository., , 12450 !global.!allfiles.?filedate.!!last_repository., , 12451 !global.!allfiles.?fullfilename.!!last_repository., , 12452 !global.!allfiles.?filetype.!!last_repository., , 12453 !global.!allfiles.?filestatus.!!last_repository., , 12454 !global.!allfiles.?filereminder.!!last_repository. 12455 End 12456 When !global.!allfile_sort_order = 5 Then /* filepath */ 12457 Do 12458 Call RegMultiStemSort !global.!allfile_sort_direction.5, !global.!!user.!!preference.!!sort, 5, , , 12459 !global.!allfiles.?filepath.!!last_repository., , 12460 !global.!allfiles.?filerev.!!last_repository., , 12461 !global.!allfiles.?filename.!!last_repository., , 12462 !global.!allfiles.?user.!!last_repository., , 12463 !global.!allfiles.?filedate.!!last_repository., , 12464 !global.!allfiles.?fullfilename.!!last_repository., , 12465 !global.!allfiles.?filetype.!!last_repository., , 12466 !global.!allfiles.?filestatus.!!last_repository., , 12467 !global.!allfiles.?filereminder.!!last_repository. 12468 End 12469 When !global.!allfile_sort_order = 6 Then /* reminder */ 12470 Do 12471 Call RegMultiStemSort !global.!allfile_sort_direction.6, !global.!!user.!!preference.!!sort, 5, , , 12472 !global.!allfiles.?filereminder.!!last_repository., , 12473 !global.!allfiles.?filename.!!last_repository., , 12474 !global.!allfiles.?filepath.!!last_repository., , 12475 !global.!allfiles.?user.!!last_repository., , 12476 !global.!allfiles.?filedate.!!last_repository., , 12477 !global.!allfiles.?fullfilename.!!last_repository., , 12478 !global.!allfiles.?filetype.!!last_repository., , 12479 !global.!allfiles.?filestatus.!!last_repository., , 12480 !global.!allfiles.?filerev.!!last_repository. 12481 End 12482 Otherwise Nop 12483 End 12484 End 12485Return 12486 12487/* 12488 * This function gets the status of all files in the current directory from the 12489 * repository. It is done this way so that we have 1 call to the repository for all 12490 * files in the directory, rather than a call to the repository for each file. 12491 * This approach only works for CVS 12492 */ 12493DetermineCVSStatusIcons: Procedure Expose !REXXDW. !global. !!last_repository 12494/* 12495sm_proc. = 1 12496sm_proc.0 = !global.!repfiles.?filestatus.!!last_repository.0 12497*/ 12498If \!global.!offline.!!last_repository Then 12499 Do 12500 /* 12501 * Set all files to 'needs checkout' by default 12502 * ...and all reminders to blank 12503 */ 12504 Do smi = 1 To !global.!repfiles.?filestatus.!!last_repository.0 12505 !global.!repfiles.?filestatus.!!last_repository.smi = Left( !global.!repfiles.?filestatus.!!last_repository.smi, 4 )'fileneedscheckout' 12506 !global.!repfiles.?filereminder.!!last_repository.smi = Left( !global.!repfiles.?filereminder.!!last_repository.smi, 4 ) || DetermineReminderIcon( Strip( Substr( !global.!repfiles.?fullfilename.!!last_repository.smi, 5 ) ) ) 12507 End 12508 /* 12509 * Get the repository status for all files in the current 12510 * directory, then match the files up with our array 12511 */ 12512 If !global.!current_dirname.!!last_repository = '' Then dir = '.' 12513 Else dir = !global.!current_dirname.!!last_repository 12514 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q status -l' quote( dir ) 12515 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 12516 Address System cmd With Output FIFO '' Error Stem junk. 12517 Do Queued() 12518 Parse Pull line 12519 If Left( line, 5 ) = 'File:' Then 12520 Do 12521 Parse Var line 'File: ' sm_fn 'Status: ' status 12522 -- special test for 'Locally Removed'; remove 'no file' prefix 12523 If status = 'Locally Removed' Then Parse Var sm_fn . . sm_fn 12524 If dir = '.' Then 12525 sm_ff = Strip( Translate( sm_fn, '', ' ' ) ) /* don't use !global.!ossep */ 12526 Else 12527 sm_ff = dir'/'Strip( Translate( sm_fn, '', ' ' ) ) /* don't use !global.!ossep */ 12528 icon = GetCVSStatusIcon( status ) 12529 Do smj = 1 To !global.!repfiles.?fullfilename.!!last_repository.0 12530 file = Strip( Substr( !global.!repfiles.?fullfilename.!!last_repository.smj, 5 ) ) 12531 If file = sm_ff Then 12532 Do 12533 !global.!repfiles.?filestatus.!!last_repository.smj = Left( !global.!repfiles.?filestatus.!!last_repository.smj, 4 ) || icon 12534 Leave 12535 End 12536 End 12537 End 12538 End 12539 End 12540/* 12541 * With CVS we have the concept of a "reminder". In the working 12542 * folder CVS directory is a file; Reminders, containing a list 12543 * of files for which you want reminders. For each file in this 12544 * list, that we haven't already processed above, determine if 12545 * it has a reminder and set the background (only) to yellow 12546 */ 12547/* 12548Do smi = 1 to sm_proc.0 12549 If sm_proc.smi Then 12550 Do 12551 !global.!repfiles.?filereminder.!!last_repository.smi = Left( !global.!repfiles.?filereminder.!!last_repository.smi, 4 ) || DetermineReminderIcon( Strip( Substr( !global.!repfiles.?fullfilename.!!last_repository.smi, 5 ) ) ) 12552 End 12553End 12554Drop sm_proc. 12555*/ 12556Return 12557 12558/* 12559 * This function gets the status of all files in the current directory from the 12560 * repository. It is done this way so that we have 1 call to the repository for all 12561 * files in the directory, rather than a call to the repository for each file. 12562 * This approach only works for CVS 12563 */ 12564DetermineCVSStatusIconsAll: Procedure Expose !REXXDW. !global. !!last_repository 12565/* 12566sm_proc. = 1 12567sm_proc.0 = !global.!allfiles.?filestatus.!!last_repository.0 12568*/ 12569If \!global.!offline.!!last_repository Then 12570 Do 12571 /* 12572 * Set all files to 'needs checkout' by default 12573 * ...and all reminders to blank 12574 */ 12575 Do smi = 1 To !global.!allfiles.?filestatus.!!last_repository.0 12576 !global.!allfiles.?filestatus.!!last_repository.smi = Left( !global.!allfiles.?filestatus.!!last_repository.smi, 4 )'fileneedscheckout' 12577 !global.!allfiles.?filereminder.!!last_repository.smi = Left( !global.!allfiles.?filereminder.!!last_repository.smi, 4 ) || DetermineReminderIcon( Strip( Substr( !global.!allfiles.?fullfilename.!!last_repository.smi, 5 ) ) ) 12578 End 12579 /* 12580 * Get the repository status for all files in the current 12581 * directory, then match the files up with our array 12582 */ 12583 If !global.!current_dirname.!!last_repository = '.' | !global.!current_dirname.!!last_repository = '' Then 12584 Do 12585 dir = '' 12586 status_dir = '' 12587 len = Length( !global.!!repository.!!shortpath.!!last_repository'/' ) 12588 End 12589 Else 12590 Do 12591 dir = !global.!current_dirname.!!last_repository 12592 status_dir = quote( !global.!current_dirname.!!last_repository ) 12593 len = Length( !global.!!repository.!!shortpath.!!last_repository'/' ) 12594 End 12595 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q status' status_dir 12596 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 12597 Address System cmd With Output FIFO '' Error Stem junk. 12598 Do Queued() 12599 processfile = 0 12600 Parse Pull line 12601 Select 12602 When Left( line, 5 ) = 'File:' Then 12603 Do 12604 Parse Var line 'File: ' sm_fn ' Status: ' status 12605 End 12606 When Countstr( 'Repository revision:', line ) = 1 Then 12607 Do 12608 Parse Var line . ' ' . ' ' fullfn ',v' 12609 processfile = 1 12610 End 12611 Otherwise Nop 12612 End 12613 If processfile Then 12614 Do 12615 sm_ff = Substr( fullfn, len + 1 ) 12616/* 12617 If dir \= '' Then 12618 sm_ff = dir'/'Strip( sm_fn ) -- don't use !global.!ossep 12619*/ 12620 icon = GetCVSStatusIcon( status ) 12621--say .line status fullfn icon sm_ff 12622 Do smj = 1 To !global.!allfiles.?fullfilename.!!last_repository.0 12623 file = Strip( Substr( !global.!allfiles.?fullfilename.!!last_repository.smj, 5 ) ) 12624 If file = sm_ff Then 12625 Do 12626 !global.!allfiles.?filestatus.!!last_repository.smj = Left( !global.!allfiles.?filestatus.!!last_repository.smj, 4 ) || icon 12627 Leave 12628 End 12629 End 12630 End 12631 End 12632 End 12633/* 12634 * With CVS we have the concept of a "reminder". In the working 12635 * folder CVS directory is a file; Reminders, containing a list 12636 * of files for which you want reminders. For each file in this 12637 * list, that we haven't already processed above, determine if 12638 * it has a reminder and set the background (only) to yellow 12639 */ 12640/* 12641Do smi = 1 to sm_proc.0 12642 If sm_proc.smi Then 12643 Do 12644 !global.!allfiles.?filereminder.!!last_repository.smi = Left( !global.!allfiles.?filereminder.!!last_repository.smi, 4 ) || DetermineReminderIcon( Strip( Substr( !global.!allfiles.?fullfilename.!!last_repository.smi, 5 ) ) ) 12645 End 12646End 12647Drop sm_proc. 12648*/ 12649Return 12650 12651/* 12652 * This function gets the status of all files in the current directory from the 12653 * repository. It is done this way so that we have 1 call to the repository for all 12654 * files in the directory, rather than a call to the repository for each file. 12655 * This approach only works for HG 12656 */ 12657DetermineHGStatusIcons: Procedure Expose !REXXDW. !global. !!last_repository 12658/* 12659sm_proc. = 1 12660sm_proc.0 = !global.!repfiles.?filestatus.!!last_repository.0 12661*/ 12662 /* 12663 * Set all files to 'needs checkout' by default 12664 * ...and all reminders to blank 12665 */ 12666Do smi = 1 To !global.!repfiles.?filestatus.!!last_repository.0 12667 icon = GetHGStatusIcon( status ) 12668say .line icon 12669 !global.!repfiles.?filestatus.!!last_repository.smi = Left( !global.!repfiles.?filestatus.!!last_repository.smi, 4 ) || icon 12670 !global.!repfiles.?filereminder.!!last_repository.smi = Left( !global.!repfiles.?filereminder.!!last_repository.smi, 4 ) || DetermineReminderIcon( Strip( Substr( !global.!repfiles.?fullfilename.!!last_repository.smi, 5 ) ) ) 12671End 12672Return 12673 12674/* 12675 * This function gets the status of all files in the current directory from the 12676 * repository. It is done this way so that we have 1 call to the repository for all 12677 * files in the directory, rather than a call to the repository for each file. 12678 * This approach only works for HG 12679 */ 12680DetermineHGStatusIconsAll: Procedure Expose !REXXDW. !global. !!last_repository 12681/* 12682sm_proc. = 1 12683sm_proc.0 = !global.!allfiles.?filestatus.!!last_repository.0 12684*/ 12685If \!global.!offline.!!last_repository Then 12686 Do 12687 /* 12688 * Set all files to 'needs checkout' by default 12689 * ...and all reminders to blank 12690 */ 12691 Do smi = 1 To !global.!allfiles.?filestatus.!!last_repository.0 12692 !global.!allfiles.?filestatus.!!last_repository.smi = Left( !global.!allfiles.?filestatus.!!last_repository.smi, 4 )'fileneedscheckout' 12693 !global.!allfiles.?filereminder.!!last_repository.smi = Left( !global.!allfiles.?filereminder.!!last_repository.smi, 4 ) || DetermineReminderIcon( Strip( Substr( !global.!allfiles.?fullfilename.!!last_repository.smi, 5 ) ) ) 12694 End 12695 /* 12696 * Get the repository status for all files in the current 12697 * directory, then match the files up with our array 12698 */ 12699 If !global.!current_dirname.!!last_repository = '.' | !global.!current_dirname.!!last_repository = '' Then 12700 Do 12701 dir = '' 12702 status_dir = '' 12703 len = Length( !global.!!repository.!!shortpath.!!last_repository'/' ) 12704 End 12705 Else 12706 Do 12707 dir = !global.!current_dirname.!!last_repository 12708 status_dir = quote( !global.!current_dirname.!!last_repository ) 12709 len = Length( !global.!!repository.!!shortpath.!!last_repository'/' ) 12710 End 12711 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q status' status_dir 12712 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 12713 Address System cmd With Output FIFO '' Error Stem junk. 12714 Do Queued() 12715 processfile = 0 12716 Parse Pull line 12717 Select 12718 When Left( line, 5 ) = 'File:' Then 12719 Do 12720 Parse Var line 'File: ' sm_fn ' Status: ' status 12721 End 12722 When Countstr( 'Repository revision:', line ) = 1 Then 12723 Do 12724 Parse Var line . ' ' . ' ' fullfn ',v' 12725 processfile = 1 12726 End 12727 Otherwise Nop 12728 End 12729 If processfile Then 12730 Do 12731 sm_ff = Substr( fullfn, len + 1 ) 12732/* 12733 If dir \= '' Then 12734 sm_ff = dir'/'Strip( sm_fn ) -- don't use !global.!ossep 12735*/ 12736 icon = GetHGStatusIcon( status ) 12737--say .line status fullfn icon sm_ff 12738 Do smj = 1 To !global.!allfiles.?fullfilename.!!last_repository.0 12739 file = Strip( Substr( !global.!allfiles.?fullfilename.!!last_repository.smj, 5 ) ) 12740 If file = sm_ff Then 12741 Do 12742 !global.!allfiles.?filestatus.!!last_repository.smj = Left( !global.!allfiles.?filestatus.!!last_repository.smj, 4 ) || icon 12743 Leave 12744 End 12745 End 12746 End 12747 End 12748 End 12749/* 12750 * With HG we have the concept of a "reminder". In the working 12751 * folder HG directory is a file; Reminders, containing a list 12752 * of files for which you want reminders. For each file in this 12753 * list, that we haven't already processed above, determine if 12754 * it has a reminder and set the background (only) to yellow 12755 */ 12756/* 12757Do smi = 1 to sm_proc.0 12758 If sm_proc.smi Then 12759 Do 12760 !global.!allfiles.?filereminder.!!last_repository.smi = Left( !global.!allfiles.?filereminder.!!last_repository.smi, 4 ) || DetermineReminderIcon( Strip( Substr( !global.!allfiles.?fullfilename.!!last_repository.smi, 5 ) ) ) 12761 End 12762End 12763Drop sm_proc. 12764*/ 12765Return 12766 12767DisplayFileArray: Procedure Expose !REXXDW. !global. !!last_repository 12768/* 12769 * Delete everything in the container so we can replace the existing files 12770 */ 12771Call dw_signal_disconnect !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_SELECT_EVENT 12772Call dw_signal_disconnect !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_ENTER_EVENT 12773Call dw_signal_disconnect !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_CONTEXT_EVENT 12774Call dw_signal_disconnect !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_COLUMN_CLICK_EVENT 12775Call dw_container_clear !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_DONT_REDRAW 12776/* 12777 * Add the files into the container 12778 */ 12779!global.!repfilescontainermemory.!!last_repository = dw_container_alloc( !global.!repfilescontainer.!!last_repository, !global.!repfiles.?fullfilename.!!last_repository.0 ) 12780Do i = 1 To !global.!repfiles.?fullfilename.!!last_repository.0 12781 Call SetRepFileRow i, 'initial' 12782End 12783Call dw_container_set_stripe !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_CLR_WHITE, !global.!container_colour 12784Call dw_container_insert !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, !global.!repfiles.?fullfilename.!!last_repository.0 12785Call dw_container_optimize !global.!repfilescontainer.!!last_repository 12786/* 12787 * Only now can we connect our signals, because dw_set_file() causes the signals to fire!!!... 12788 */ 12789Call dw_signal_connect !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_SELECT_EVENT, 'FileSelectCallback' 12790Call dw_signal_connect !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_ENTER_EVENT, 'FileDoubleClickCallback' 12791Call dw_signal_connect !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_CONTEXT_EVENT, 'FileMenuCallback' 12792Call dw_signal_connect !global.!repfilescontainer.!!last_repository, !REXXDW.!DW_COLUMN_CLICK_EVENT, 'FileSortCallback' 12793Return 12794 12795DisplayAllFileArray: Procedure Expose !REXXDW. !global. !!last_repository 12796/* 12797 * Delete everything in the container so we can replace the existing files 12798 */ 12799Call dw_signal_disconnect !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_SELECT_EVENT 12800Call dw_signal_disconnect !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_ENTER_EVENT 12801Call dw_signal_disconnect !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_CONTEXT_EVENT 12802Call dw_signal_disconnect !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_COLUMN_CLICK_EVENT 12803Call dw_container_clear !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_DONT_REDRAW 12804/* 12805 * Add the files into the container 12806 */ 12807!global.!allfilescontainermemory.!!last_repository = dw_container_alloc( !global.!allfilescontainer.!!last_repository, !global.!allfiles.?fullfilename.!!last_repository.0 ) 12808Do i = 1 To !global.!allfiles.?fullfilename.!!last_repository.0 12809 Call SetAllRepFileRow i, 'initial' 12810End 12811Call dw_container_set_stripe !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_CLR_WHITE, !global.!container_colour 12812Call dw_container_insert !global.!allfilescontainer.!!last_repository, !global.!allfilescontainermemory.!!last_repository, !global.!allfiles.?fullfilename.!!last_repository.0 12813Call dw_container_optimize !global.!allfilescontainer.!!last_repository 12814/* 12815 * Only now can we connect our signals, because dw_set_file() causes the signals to fire!!!... 12816 */ 12817Call dw_signal_connect !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_SELECT_EVENT, 'FileSelectCallback' 12818Call dw_signal_connect !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_ENTER_EVENT, 'FileDoubleClickCallback' 12819Call dw_signal_connect !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_ITEM_CONTEXT_EVENT, 'FileMenuCallback' 12820Call dw_signal_connect !global.!allfilescontainer.!!last_repository, !REXXDW.!DW_COLUMN_CLICK_EVENT, 'FileSortCallback' 12821Return 12822 12823/* 12824 * Determine the CVS file icons based on the CVS repository status 12825 */ 12826GetCVSStatusIcon: Procedure Expose !REXXDW. !global. !!last_repository 12827Parse Arg status 12828status = Strip( status ) 12829Select 12830 When status = 'Up-to-date' Then sm_fore = 'fileuptodate' 12831 When status = 'Needs Patch' Then sm_fore = 'fileneedspatch' 12832 When status = 'Needs Merge' Then sm_fore = 'fileneedsmerge' 12833 When status = 'Needs Checkout' | status = '' Then sm_fore = 'fileneedscheckout' 12834 When status = 'Locally Modified' Then sm_fore = 'filemodified' 12835 When status = 'Locally Removed' Then sm_fore = 'deletefromrepository' 12836 When status = 'File had conflicts on merge' Then sm_fore = 'fileconflict' 12837 When status = 'Unresolved Conflict' Then sm_fore = 'fileconflict' 12838 When Word( status, 1 ) = 'Needs' Then sm_fore = 'red' 12839 Otherwise sm_fore = 'grey' 12840End 12841Return sm_fore 12842 12843/* 12844 * Determine the HG file icons based on the HG repository status 12845 */ 12846GetHGStatusIcon: Procedure Expose !REXXDW. !global. !!last_repository 12847Parse Arg status 12848status = Strip( status ) 12849Select 12850 When status = 'C' Then sm_fore = 'fileuptodate' 12851-- When status = 'Needs Patch' Then sm_fore = 'fileneedspatch' 12852-- When status = 'Needs Merge' Then sm_fore = 'fileneedsmerge' 12853 When status = '!' Then sm_fore = 'fileneedscheckout' 12854 When status = 'M' Then sm_fore = 'filemodified' 12855 When status = 'R' Then sm_fore = 'deletefromrepository' 12856-- When status = 'File had conflicts on merge' Then sm_fore = 'fileconflict' 12857-- When status = 'Unresolved Conflict' Then sm_fore = 'fileconflict' 12858-- When Word( status, 1 ) = 'Needs' Then sm_fore = 'red' 12859 Otherwise sm_fore = 'fileunknown' 12860End 12861Return sm_fore 12862 12863/* 12864 * Determines the icon to display in the 'Type' column. 12865 */ 12866DetermineFileType: Procedure Expose !REXXDW. !global. !!last_repository 12867Parse Arg type, user, locks 12868type = Strip( type ) 12869user = Strip( user ) 12870locks = Strip( locks ) 12871icon = '' 12872Select 12873 When type = 'b' Then icon = 'binary' 12874 When type = '?' Then icon = 'fileunknown' 12875 Otherwise icon = 'text' 12876End 12877If locks \= '' Then 12878 Do 12879 If Translate( user ) = Translate( locks ) Then icon = icon'locked' 12880 Else icon = icon'lockedother' 12881 End 12882say .line icon type 12883Return icon 12884 12885CVSFileToWorkingFile: Procedure Expose !REXXDW. !global. !!last_repository 12886Parse arg rfile, idx 12887Return Changestr( '/', !global.!!repository.!!working_dir.idx||rfile, !global.!ossep ) 12888 12889CVSFileToReminderFile: Procedure Expose !REXXDW. !global. !!last_repository 12890Parse arg rfile 12891rfile = !global.!!repository.!!working_dir.!!last_repository||rfile 12892pos = Lastpos( '/', rfile ) 12893rfile = Insert( 'CVS/', rfile, pos ) 12894Return Changestr( '/', rfile'.qocca.reminder', !global.!ossep ) 12895 12896CVSStatus: Procedure Expose !REXXDW. !global. !!last_repository 12897Parse Arg file 12898cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'status' quote( file ) 12899If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 12900Address Command cmd With Output Stem lines. Error Stem junk. 12901If rc \= 0 Then Return '' 12902equalline = 0 12903status = '' 12904Do i = 1 To lines.0 12905 Select 12906 When equalline = 1 Then 12907 Do 12908 equalline = 0 12909 Parse Var lines.i 'File:' . 'Status:' status 12910 Leave 12911 End 12912 Otherwise 12913 Do 12914 If lines.i = Copies( '=', 67 ) Then equalline = 1 12915 End 12916 End 12917End 12918Return Strip( status ) 12919 12920TidyUpCVSDeletions: Procedure Expose !REXXDW. !global. !!last_repository oserr. 12921fidx = 0 12922didx = 0 12923Do tui = 1 To oserr.0 12924 /* 12925 * Check if file is deleted from repository 12926 */ 12927 If Right( oserr.tui, 30 ) = 'is no longer in the repository' Then 12928 Do 12929 Parse Var oserr.tui 'cvs' . ':' fn 'is no longer in the repository' . 12930 fn = Strip( fn ) 12931 If fn \= '' Then 12932 Do 12933 fidx = fidx + 1 12934 deleted_file.fidx = fn 12935 Iterate 12936 End 12937 End 12938 If Right( oserr.tui, 29 ) = 'is not (any longer) pertinent' Then 12939 Do 12940 Parse Var oserr.tui 'cvs' . ': warning:' fn 'is not (any longer) pertinent' . 12941 fn = Strip( fn ) 12942 If fn \= '' Then 12943 Do 12944 fidx = fidx + 1 12945 deleted_file.fidx = fn 12946 Iterate 12947 End 12948 End 12949 /* 12950 * Check if directory is deleted from repository 12951 */ 12952 Parse Var oserr.tui 'cvs' . ': cannot open directory' dn ': No such' junk . 12953 dn = Strip( dn ) 12954 If dn \= '' & junk \= '' Then 12955 Do 12956 didx = didx + 1 12957 deleted_dir.didx = dn 12958 End 12959End 12960If fidx = 0 & didx = 0 Then Return 12961/* 12962 * We have at least one deleted file or directory, display a dialog box confirming the tidy up 12963 * and display the details of the files moved in the log pane 12964 */ 12965deleted_file.0 = fidx 12966deleted_dir.0 = didx 12967If deleted_file.0 \= 0 Then 12968 Do 12969 Call WriteMessageHeaderToLogWindow 'Files removed from repository in' quote( !global.!current_dirname.!!last_repository ) 12970 Do tui = 1 To deleted_file.0 12971 Call WriteMessageToLogWindow ' 'deleted_file.tui, 'redfore' 12972 End 12973 Call WriteMessageTrailerToLogWindow 'Files removed from repository in' quote( !global.!current_dirname.!!last_repository ) 12974 End 12975If deleted_dir.0 \= 0 Then 12976 Do 12977 Call WriteMessageHeaderToLogWindow 'Directories removed from repository' 12978 Do tui = 1 To deleted_dir.0 12979 Call WriteMessageToLogWindow ' 'deleted_dir.tui, 'redfore' 12980 End 12981 Call WriteMessageTrailerToLogWindow 'Directories removed from repository' 12982 End 12983If dw_messagebox( 'Cleanup?', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_QUESTION ), 'The files and/or directories listed in the messages pane have been removed from the repository. Do you want your working area cleaned up ?' ) = !REXXDW.!DW_MB_RETURN_YES Then 12984 Do 12985 /* 12986 * Delete the file entries from the appropriate CVS/Entries file 12987 */ 12988if trace() = 'F' Then say 'cleaning up' 12989 Do tui = 1 To deleted_file.0 12990 pos = Lastpos( '/', deleted_file.tui ) 12991 entries_fn = Left( deleted_file.tui, pos-1 ) || '/CVS/Entries' 12992 deleted_fn = Substr( deleted_file.tui, pos+1 ) 12993 entries.0 = 0 12994 Call RegStemRead entries_fn, 'entries.' 12995 Call Stream entries_fn, 'C', 'OPEN WRITE REPLACE' 12996 Do idx = 1 To entries.0 12997 If Left( entries.idx, 1 ) = '/' Then 12998 Do 12999 Parse Var entries.idx '/' filename '/' . 13000 If filename \= deleted_fn Then Call Lineout entries_fn,entries.idx 13001 End 13002 Else Call Lineout entries_fn,entries.idx 13003 End 13004 Call Stream entries_fn, 'C', 'CLOSE' 13005 Drop entries. 13006 End 13007 /* 13008 * Delete the directory entries from the appropriate CVS/Entries file 13009 */ 13010 Do tui = 1 To deleted_dir.0 13011 pos = Lastpos( '/', deleted_dir.tui ) 13012 entries_dn = Left( deleted_dir.tui, pos-1 ) 13013 entries_dn = Changestr( !global.!!repository.!!shortpath.!!last_repository'/', entries_dn, '' ) 13014 entries_dn = !global.!!repository.!!working_dir.!!last_repository || entries_dn || '/CVS/Entries' 13015 deleted_dn = Substr( deleted_dir.tui, pos+1 ) 13016 entries.0 = 0 13017 Call RegStemRead entries_dn, 'entries.' 13018 Call Stream entries_dn, 'C', 'OPEN WRITE REPLACE' 13019 Do idx = 1 To entries.0 13020 If Left( entries.idx, 1 ) = 'D' Then 13021 Do 13022 Parse Var entries.idx 'D/' dirname '/' . 13023 If dirname \= deleted_dn Then Call Lineout entries_dn,entries.idx 13024 End 13025 Else Call Lineout entries_dn,entries.idx 13026 End 13027 Call Stream entries_dn, 'C', 'CLOSE' 13028 Drop entries. 13029 End 13030 End 13031Drop deleted_file. 13032Drop deleted_dir. 13033Return 13034 13035Time_tDateToDisplayDate: Procedure Expose !REXXDW. !global. !!last_repository 13036Parse Arg time_t 13037date = Date( 'N', time_t, 'T' ) 13038Return date ' ' Time( 'N', time_t, 'T' ) 13039 13040SortedDateToDisplayDate: Procedure Expose !REXXDW. !global. !!last_repository 13041Parse Arg date 13042Return Substr( date, 7, 2 )'-'Substr( date, 5, 2 )'-'Substr( date, 1, 4 ) 13043 13044/* 13045 * Convert a date and time to a combined time_t, allowing for UTC if required 13046 */ 13047DateTimeToTime_T: Procedure Expose !REXXDW. !global. !!last_repository 13048Parse Arg day, time, fmt, in_utc 13049If in_utc Then to = Time( 'O' ) / 1000000 13050Else to = 0 13051day_t = Date( 'T', day, fmt ) + (Time('O') / 1000000) -- always adjust date to localtime 13052time_t = Time( 'T', time, 'N' ) 13053today_t = Date( 'T', Date(), 'N' ) 13054Return (time_t - today_t) + day_t + to 13055 13056/* 13057 * Tests if the filename passsed as an argument has an extension in the 13058 * configured list of extensions to ignore 13059 */ 13060IsFileTypeIgnored: Procedure Expose !REXXDW. !global. !!last_repository 13061Parse Arg fn 13062Do i = 1 To Words( !global.!ignorefiles ) 13063 ext = '.'Word( !global.!ignorefiles, i ) 13064 len = Length( ext ) 13065 If Right( fn, len ) = ext Then Return 1 13066End 13067Return 0 13068 13069UseFileAssociation: Procedure Expose !REXXDW. !global. !!last_repository 13070Parse Arg fn 13071pos = Lastpos( '.', fn ) 13072ext = Substr( fn, pos + 1 ) 13073If Wordpos( ext, !global.!!user.!!preference.!!windowsfileassociations_extensions ) = 0 Then Return 0 13074Else Return 1 13075 13076/* 13077 * Tests if the given filename is binary; ie there is at least one 13078 * nul character in the first 1024 characters. 13079 */ 13080IsBinaryFile: Procedure Expose !REXXDW. !global. !!last_repository 13081Parse Arg fn 13082If Stream( fn, 'C', 'QUERY EXISTS' ) = '' Then Return 0 13083/* 13084 * If the repository's list of binary file extensions match our file... 13085 */ 13086pos = Lastpos( '.', fn ) 13087ext = Translate( Substr( fn, pos+1 ) ) 13088If Wordpos( ext, Translate( !global.!binaryfiles ) ) \= 0 Then Return 1 13089/* 13090 * Not listed so check contents 13091 */ 13092size = Stream( fn, 'C', 'QUERY SIZE' ) 13093numchars = Min( size, 1024 ) 13094Call Stream fn, 'C', 'OPEN READ' 13095file_block = Charin( fn, 1, numchars ) 13096test_block = Translate( file_block, '#', '00'x ) 13097If file_block \== test_block Then 13098 binary = 1 13099Else 13100 binary = 0 13101Call Stream fn, 'C', 'CLOSE' 13102Return binary 13103 13104/* 13105 * Determines if the specified file is in the repository 13106 * Does not require a working file 13107 */ 13108IsFileInRepository: Procedure Expose !REXXDW. !global. !!last_repository 13109Parse Arg fn 13110found = 0 13111Select 13112 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 13113 Do 13114 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q co -p' quote( fn ) 13115 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 13116 Address System cmd With Output Stem out. Error Stem err. 13117 If err.0 = 0 Then found = 1 13118 End 13119 Otherwise Nop 13120End 13121Return found 13122 13123/* 13124 * Determines if the module is in the repository 13125 */ 13126IsModuleInRepository: Procedure Expose !REXXDW. !global. !!last_repository 13127Parse Arg fn, repno 13128fn = Strip( fn ) 13129found = 0 13130Select 13131 When !global.!!repository.!!type.repno = 'cvs' Then 13132 Do 13133 cmd = 'cvs' !global.!!repository.!!cvs_compression.repno '-d'!global.!!repository.!!path.repno 'rdiff -s -D 1/1/2037' fn 13134 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 13135 Address System cmd With Error Stem err. Output Stem junk. 13136 Do i = 1 To err.0 13137 Parse Var err.i . 'Diffing' line 13138 If Strip( line ) = fn Then 13139 Do 13140 Drop err. junk. 13141 found = 1 13142 Leave 13143 End 13144 End 13145 End 13146 Otherwise Nop 13147End 13148Return found 13149 13150/* 13151 * Checks if a particular file can be checked out for locking 13152 */ 13153CanFileBeCheckedOutForLock: Procedure Expose !REXXDW. !global. !!last_repository 13154Parse Arg i, dir_reserved 13155If dir_reserved | Substr( !global.!repfiles.?filetype.!!last_repository.i, 5, 6 ) = 'binary' Then 13156 Do 13157 Parse Var !global.!repfiles.?user.!!last_repository.i . 5 . '(' locker ')' 13158 If Strip( locker ) = '' Then Return 1 13159 End 13160Return 0 13161 13162GetCVSLocker: /* MUST NOT BE A PROCEDURE */ 13163Parse Arg fn 13164locks = '' 13165cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list' quote( fn ) 13166If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 13167Address Command cmd With Output Stem item. Error Stem err. 13168If item.0 = 1 Then 13169 Do 13170 Parse Var item.1 . 88 flen 91 . 92 . +(flen) +1 locks 13171 End 13172Return locks 13173 13174SendEmail: Procedure Expose !REXXDW. !global. !!last_repository 13175Parse Arg emailcommand, buildout, admin_email, subject 13176If emailcommand = '' Then Return 13177If Countstr( '%F%', emailcommand ) = 0 | Countstr( '%R%', emailcommand ) = 0 | Countstr( '%S%', emailcommand ) = 0 Then 13178 Do 13179 Say 'Malformed email command template:' emailcommand 13180 Return 13181 End 13182se_cmd = Changestr( '%F%', emailcommand, buildout ) 13183se_cmd = Changestr( '%S%', se_cmd, subject ) 13184Do i = 1 To Words( admin_email ) 13185 Address System Changestr( '%R%', se_cmd, Word( admin_email, i) ) 13186End 13187Return 13188 13189FileIsInRepository: Procedure Expose !REXXDW. !global. !!last_repository 13190Parse Arg file 13191Do i = 1 To !global.!repfiles.?fullfilename.!!last_repository.0 13192 If file = Substr( !global.!repfiles.?fullfilename.!!last_repository.i, 5 ) Then Return 1 13193End 13194Return 0 13195 13196/* 13197 * Determine the index of the supplied directory in the list of directories 13198 * in the repository 13199 */ 13200FindTreeItem: Procedure Expose !REXXDW. !global. !!last_repository 13201Parse Arg item 13202Do i = 1 To !global.!repdir.!!last_repository.0 13203 If !global.!repdir.!!last_repository.i = item Then Return i 13204End 13205Return 0 13206/* 13207Return RegStemSearch( item, '!global.!repdir.!!last_repository.', 1, 'CES' ) 13208*/ 13209 13210/* 13211 * Generic window for obtaining textual comments 13212 */ 13213GetCheckinDetails: Procedure Expose !REXXDW. !global. !!last_repository 13214Parse Arg want_text_win, type, file, question, title 13215if trace() = 'F' Then say 'want_text_win' want_text_win 'type' type 'file' file 'question' question 13216_version = '' 13217same = 0 13218win = dw_window_new( !REXXDW.!DW_DESKTOP, title file, !global.!windowstyle ) 13219Call dw_window_set_icon win, !global.!qoccaicon 13220gf = dw_box_new( !REXXDW.!DW_VERT ) 13221Call dw_box_pack_start win, gf, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13222 13223If want_text_win = 'Y' Then 13224 Do 13225 Select 13226 When type = 'add' Then 13227 Do 13228 text_height = 20 13229 junk = dw_text_new( 'Module Description:', 0 ) 13230 Call dw_window_set_style junk, !REXXDW.!DW_DT_VCENTER , !REXXDW.!DW_DT_VCENTER 13231 Call dw_box_pack_start gf, junk, !REXXDW.!DW_SIZE_AUTO, text_height, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13232 If Left( !global.!addfile_text, 1 ) = '!' Then !global.!addfile_text = '' 13233 t1 = dw_entryfield_new( !global.!addfile_text, 0 ) 13234 Call dw_box_pack_start gf, t1, 400, text_height, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13235 End 13236 When type = 'remind' Then 13237 Do 13238 text_height = 300 13239 t1 = dw_mle_new( 0 ) 13240 Call dw_box_pack_start gf, t1, 400, text_height, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13241 Call dw_mle_set_editable t1, !REXXDW.!DW_EDITABLE 13242 loc = dw_mle_import( t1, question||!global.!remindertext, -1 ) 13243 Call dw_mle_set_cursor t1, loc 13244 End 13245 Otherwise /* checkin */ 13246 Do 13247 text_height = 300 13248 t1 = dw_mle_new( 0 ) 13249 Call dw_box_pack_start gf, t1, 400, text_height, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13250 Call dw_mle_set_editable t1, !REXXDW.!DW_EDITABLE 13251 If !global.!checkin_text \= '!GLOBAL.!CHECKIN_TEXT' Then 13252 Do 13253 loc = dw_mle_import( t1, !global.!checkin_text, -1 ) 13254 Call dw_mle_set_cursor t1, loc 13255 End 13256 End 13257 End 13258 End 13259Call dw_window_default win, t1 13260cb_height = 0 13261If type = 'dir' | type = 'delete' | type = 'add' Then 13262 Do 13263 cb_height = 20 13264 cb = dw_checkbox_new( question, 0 ) 13265 Call dw_box_pack_start gf, cb, !REXXDW.!DW_SIZE_AUTO, cb_height, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13266 End 13267Else cb = 0 13268 13269/* 13270 * Create Cancel and Apply buttons 13271 */ 13272b1 = dw_button_new( 'Apply', 0 ) 13273Call dw_box_pack_start gf, b1, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13274 13275b2 = dw_button_new( 'Cancel', 0 ) 13276Call dw_box_pack_start gf, b2, !REXXDW.!DW_SIZE_AUTO, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13277 13278/* 13279 * Display the window 13280 */ 13281Call dw_window_set_gravity win, !REXXDW.!DW_GRAV_CENTRE, !REXXDW.!DW_GRAV_CENTRE 13282Call dw_window_set_pos_size win, 0, 0, 0, 0 13283Call dw_window_show win 13284 13285Do Forever 13286 /* 13287 * Create a dialog for the window 13288 */ 13289 dialog_wait = dw_dialog_new( ) 13290 /* 13291 * We now have everything setup, we can connect the destroying of the top-level window 13292 * to the 'close' callback 13293 */ 13294 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GetCheckinDetailsApplyCallback', win, dialog_wait, t1, cb, want_text_win, type 13295 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 13296 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 13297 /* 13298 * Wait for the dialog to come back 13299 */ 13300 Parse Value dw_dialog_wait( dialog_wait ) With cancel same 13301 /* 13302 * All successful processing done in the 'applycallback', so simply get 13303 * out of the loop if we don't have any validation issues 13304 */ 13305 If cancel \= 'retry' Then Leave 13306End 13307Return cancel same 13308 13309GetFileRevisions: Procedure Expose !REXXDW. !global. !!last_repository 13310/* 13311 * Dialog box to ask user for file revision to work on 13312 * Only one file allowed to be selected for this option 13313 * 13314 * +---------------------------------------------------+ 13315 * | Text | 13316 * | | 13317 * +---------------------------------------------------+ 13318 * | ____________Latest______________________________v | 13319 * +---------------------------------------------------+ 13320 */ 13321Parse Arg this_file, prompt, types, allow_date, default 13322Call SetCursorWait 13323win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Select File Revision for:' prompt, !global.!windowstyle ) 13324Call dw_window_set_icon win, !global.!qoccaicon 13325 13326gf = dw_box_new( !REXXDW.!DW_VERT ) 13327Call dw_box_pack_start win, gf, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13328 13329t2 = dw_text_new( 'Select the revision of the file to' prompt'.', 0 ) 13330Call dw_box_pack_start gf, t2, 250, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13331 13332boxtopack = dw_box_new( !REXXDW.!DW_HORZ ) 13333Call dw_box_pack_start gf, boxtopack, 250, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13334Parse Value CreateFileRevisionCombobox( boxtopack, 'false', default, this_file, '', types, allow_date ) With revcbox . 13335/* 13336 * Create a dialog for the window 13337 */ 13338dialog_wait = dw_dialog_new( ) 13339/* 13340 * Create Cancel and Apply buttons 13341 */ 13342b1 = dw_button_new( 'Apply', 0 ) 13343Call dw_box_pack_start gf, b1, 250, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13344Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GetFileRevisionsApplyCallback', win, dialog_wait, revcbox 13345 13346b2 = dw_button_new( 'Cancel', 0 ) 13347Call dw_box_pack_start gf, b2, 250, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13348Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 13349/* 13350 * We now have everything setup, we can connect the destroying of the top-level window 13351 * to the 'close' callback 13352*/ 13353Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 13354/* 13355 * Display the window 13356 */ 13357width = 400 13358height = 160 13359Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 13360Call dw_window_show win 13361/* 13362 * Wait for the dialog to come back 13363 */ 13364Parse Value dw_dialog_wait( dialog_wait ) With cancel rev 13365if trace() = 'F' Then say 'got rev' cancel rev 13366Return rev 13367 13368 13369CreateFileRevisionCombobox: Procedure Expose !REXXDW. !global. !!last_repository 13370Parse Arg boxtopack, editable, default_value, filename, extra_revisions, types, allow_date 13371realtagstart = 0 13372/* 13373 * Create generic combobox for file revisions 13374 */ 13375revcbox = dw_combobox_new( default_value, 0 ) 13376If default_value \= '' Then 13377 Do 13378 Call dw_listbox_append revcbox, default_value 13379 realtagstart = realtagstart + 1 13380 End 13381Call dw_box_pack_start boxtopack, revcbox, 150, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 13382/* 13383 * Add any special revisions first... 13384 */ 13385Do i = 1 To Words( extra_revisions ) 13386 Call dw_listbox_append revcbox, Word( extra_revisions, i ) 13387 realtagstart = realtagstart + 1 13388End 13389/* 13390 * Now find the existing revisions for the file and add them to the combobox 13391 */ 13392Call PopulateFileRevisionCombobox revcbox, !!last_repository, filename, types 13393/* 13394 * Create and pack our date selector 13395 */ 13396If allow_date = 'date' Then 13397 Do 13398 abutton = dw_bitmapbutton_new_from_file( 'Select Date', 0, !global.!icondir||'dateselector' ) 13399 Call dw_box_pack_start boxtopack, abutton, 20, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13400 Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GetFileRevisionsDateSelector', revcbox 13401 End 13402/* 13403If editable = 'false' Then Call dw_window_disable revcbox 13404*/ 13405Return revcbox realtagstart 13406 13407PopulateFileRevisionCombobox: Procedure Expose !REXXDW. !global. !!last_repository 13408Parse Arg revcbox, repno, filename, types 13409/* 13410 * Let the user know whats happening... 13411 */ 13412Call SetCursorWait 13413Call DisplayStatus 'Getting revision details for' filename 13414Select 13415 When !global.!!repository.!!type.repno = 'rcs' Then 13416 Do 13417 /* TODO */ 13418 Address System 'rlog' quote( filename ) With Output FIFO '' Error Stem err. 13419 gotrev = 0 13420 Do Queued() 13421 Select 13422 When gotrev = 1 Then 13423 Do 13424 Parse Pull 'revision' newrev . 13425 If newrev \= '' Then 13426 Do 13427 Call TkComboboxListInsert revcbox, 'end', newrev 13428 End 13429 gotrev = 0 13430 End 13431 Otherwise 13432 Do 13433 Parse Pull line 13434 If line = Copies( '-', 28 ) Then gotrev = 1 13435 End 13436 End 13437 End 13438 End 13439 When !global.!!repository.!!type.repno = 'cvs' Then 13440 Do 13441 Call GetCVSRevisions repno, filename, types 13442 idx = 0 13443 Do Queued() 13444 idx = idx + 1 13445 Parse Pull text.idx 13446 End 13447 text.0 = idx 13448 Call dw_listbox_list_append revcbox, 'text.' 13449 Drop text. 13450 End 13451 Otherwise 13452End 13453Call SetCursorNoWait 13454Call DisplayStatus '' 13455/* 13456 * Save the repository number for the combobox 13457 */ 13458!global.!repository_combobox.revcbox = repno 13459Return 13460 13461CreateModuleVersionCombobox: Procedure Expose !REXXDW. !global. !!last_repository 13462Parse Arg win, editable, default_value, dirname, tryparent, extra_versions, associated_cb 13463realtagstart = 0 13464/* 13465 * Let the user know whats happening... 13466 */ 13467Call SetCursorWait 13468Call DisplayStatus 'Getting version details for' dirname 13469/* 13470 * Create a box to pack the combobox and button for date selection 13471 */ 13472boxtopack = dw_box_new( !REXXDW.!DW_HORZ ) 13473/* 13474 * Create generic combobox for module versions 13475 */ 13476revcbox = dw_combobox_new( default_value, 0 ) 13477If default_value \= '' Then 13478 Do 13479 Call dw_listbox_append revcbox, default_value 13480 realtagstart = realtagstart + 1 13481 End 13482Call dw_box_pack_start boxtopack, revcbox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 13483/* 13484 * Add any special versions first... 13485 */ 13486Do i = 1 To Words( extra_versions ) 13487 Call dw_listbox_append revcbox, Word( extra_versions, i ) 13488 realtagstart = realtagstart + 1 13489End 13490/* 13491 * Now find label files for this module and add them to the combobox 13492 */ 13493Call PopulateModuleRevisionCombobox revcbox, !!last_repository, tryparent 13494Call SetCursorNoWait 13495Call DisplayStatus '' 13496 13497Return revcbox boxtopack realtagstart 13498 13499PopulateModuleRevisionCombobox: Procedure Expose !REXXDW. !global. !!last_repository 13500Parse Arg revcbox, repno, tryparent 13501Select 13502 When !global.!!repository.!!type.repno = 'rcs' Then 13503 Do 13504 Call SysFileTree !global.!current_dirname.!!last_repository'/.label-*,v', 'LABELFILE.', 'FLS' 13505 End 13506 When !global.!!repository.!!type.repno = 'cvs' Then 13507 Do 13508 /* 13509 * NOTE We can't use ?label. stem here, as we need to traverse up the 13510 * directory tree, and we only have the current directory labels. 13511 */ 13512 cdir = !global.!current_dirname.!!last_repository 13513 Do Forever 13514 cmd = 'cvs' !global.!!repository.!!cvs_compression.repno '-d'!global.!!repository.!!path.repno '-q list -l' quote( cdir ) 13515 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 13516 Address System cmd With Output FIFO '' Error Stem err. 13517 Do Queued() 13518 Parse Pull line . . . . . . . '/.label-' lab 13519 If lab \= '' Then 13520 Do 13521 Call dw_listbox_append revcbox, cdir','lab 13522 End 13523 End 13524 If Countstr( '/', cdir ) = 0 | tryparent = 0 Then Leave 13525 Parse Var cdir cdir '/' . 13526 End 13527 End 13528 Otherwise Nop 13529End 13530/* 13531 * Save the repository number for the combobox 13532 */ 13533!global.!repository_combobox.revcbox = repno 13534Return 13535 13536CreateRepositoryCombobox: Procedure Expose !REXXDW. !global. !!last_repository 13537/* 13538 * Create generic combobox for repositories 13539 */ 13540Parse Arg win, editable, default_value, associated_cb, realtagstart, filename, types 13541repcbox = dw_combobox_new( default_value, 0 ) 13542If default_value \= '' Then 13543 Do 13544 Call dw_listbox_append repcbox, default_value 13545 Call dw_listbox_select repcbox, 0, !REXXDW.!DW_LB_SELECTED 13546 End 13547/* 13548 * Now insert all repositories into the combobox 13549 */ 13550Do i = 1 To !global.!!number_repositories 13551 Call dw_listbox_append repcbox, !global.!!repository.!!name.i 13552End 13553/* 13554 * If we have a parameter for an associated listbox, we need to set up a signal to 13555 * repopulate the associated listbox data 13556 */ 13557If associated_cb \= '' Then 13558 Do 13559 Call dw_signal_connect repcbox, !REXXDW.!DW_LIST_SELECT_EVENT, 'RepositoryComboboxCallback', associated_cb, realtagstart, filename, types 13560 End 13561Return repcbox 13562 13563RepositoryComboboxCallback: Procedure Expose !REXXDW. !global. !!last_repository 13564Parse Arg win, list_idx, associated_cb, realtagstart, filename, types 13565/* 13566 * Get the selected repository from the combobox 13567 */ 13568text = dw_listbox_get_text( win, list_idx ) 13569Call dw_window_set_text win, text 13570/* 13571 * Convert this repository into an index... 13572 */ 13573repno = FindRepository( text ) 13574If repno = !global.!repository_combobox.associated_cb Then Return 1 13575If repno = 0 Then repno = !!last_repository 13576/* 13577 * Now repopulate the associated_cb 13578 */ 13579count = dw_listbox_count( associated_cb ) 13580/* 13581Do i = count-1 To realtagstart-1 By -1 13582 Call dw_listbox_delete associated_cb, i 13583End 13584*/ 13585idx = realtagstart - 1 13586Do i = realtagstart To count 13587 Call dw_listbox_delete associated_cb, idx 13588End 13589 13590If filename = '' Then Call PopulateModuleRevisionCombobox associated_cb, repno, types 13591Else Call PopulateFileRevisionCombobox associated_cb, repno, filename, types 13592 13593Return 1 /* indicate we have handled the event */ 13594 13595CreateCompilersCombobox: Procedure Expose !REXXDW. !global. !!last_repository 13596Parse Arg win, editable, default_abbrev 13597default_value = '' 13598/* 13599 * If supplied, find the name of the default abbrev 13600 */ 13601Do i = 1 To Words( !global.!compiler_template.??compiler_types ) 13602 tmp = Word( !global.!compiler_template.??compiler_types, i ) 13603 If tmp = default_abbrev Then 13604 Do 13605 default_value = !global.!compiler_template.??compiler_name.tmp 13606 Leave 13607 End 13608End 13609repcbox = dw_combobox_new( default_value, 0 ) 13610If default_value \= '' Then Call dw_listbox_append repcbox, default_value 13611/* 13612 * Now insert all compilers into the combobox 13613 */ 13614Do i = 1 To Words( !global.!compiler_template.??compiler_types ) 13615 tmp = Word( !global.!compiler_template.??compiler_types, i ) 13616 Call dw_listbox_append repcbox, !global.!compiler_template.??compiler_name.tmp 13617End 13618Return repcbox 13619 13620ConvertCompilerNameToAbbrev: Procedure Expose !REXXDW. !global. !!last_repository 13621Parse Arg compiler_name 13622compiler_type = '*unknown*' 13623Do idx = 1 To Words( !global.!compiler_template.??compiler_types ) 13624 tmp = Word( !global.!compiler_template.??compiler_types, idx ) 13625 If !global.!compiler_template.??compiler_name.tmp = compiler_name Then 13626 Do 13627 compiler_type = tmp 13628 Leave 13629 End 13630End 13631Return compiler_type 13632 13633/* 13634 * Find all revisions for the supplied file, and queue them onto the stack 13635 */ 13636GetCVSRevisions: Procedure Expose !REXXDW. !global. !!last_repository 13637Parse Arg repno, this_file, types 13638/* 13639 * Use another stack as stems are inefficient under Regina (as at 3.3) 13640 */ 13641sessionq = RxQueue( 'G' ) 13642tmpq = RxQueue( 'C' ) 13643If !global.!!repository.!!enhanced_cvs.!!last_repository \= 'Y' Then 13644 cvscmd = 'log' 13645Else 13646 cvscmd = 'rlog' 13647cmd = 'cvs' !global.!!repository.!!cvs_compression.repno '-d'!global.!!repository.!!path.repno cvscmd quote( this_file ) 13648If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 13649Address Command cmd With Output FIFO tmpq Error Stem oserr. 13650osout.0 = 0 13651If oserr.0 \= 0 Then Call WriteOutputStemsToLogWindow 'default', 'Getting revisions' this_file 13652If Wordpos( 'rev', types ) \= 0 Then getrev = 1 13653Else getrev = 0 13654If Wordpos( 'tag', types ) \= 0 Then gettag = 1 13655Else gettag = 0 13656gotrev = 0 13657gottag = 0 13658revs = '' 13659need_pull = 1 13660Call RxQueue 'S', tmpq 13661num_queued = Queued() 13662num_pulled = 0 13663If num_queued \= 0 Then 13664 Do Forever 13665 If need_pull Then 13666 Do 13667 Parse Pull rcsrev 13668 num_pulled = num_pulled + 1 13669 End 13670 Select 13671 When gotrev = 1 Then 13672 Do 13673 need_pull = 1 13674 Parse Var rcsrev 'revision' newrev . 13675 If newrev \= '' Then 13676 Do 13677 Parse Pull rcsrev 13678 num_pulled = num_pulled + 1 13679 need_pull = 0 13680 If Countstr( 'state: dead;', rcsrev ) \= 1 Then 13681 Do 13682 Call RxQueue 'S', sessionq 13683 Queue newrev 13684 Call RxQueue 'S', tmpq 13685 End 13686 End 13687 gotrev = 0 13688 End 13689 When gottag = 1 Then 13690 Do 13691 If SubWord( rcsrev, 1, 2 ) = 'keyword substitution:' & gettag Then gottag = 0 13692 Else 13693 Do 13694 Parse Var rcsrev newtag ':' . 13695 Call RxQueue 'S', sessionq 13696 Queue Strip( newtag, 'L', '09'x ) 13697 Call RxQueue 'S', tmpq 13698 End 13699 need_pull = 1 13700 End 13701 Otherwise 13702 Do 13703 If rcsrev = Copies( '-', 28 ) & getrev Then gotrev = 1 13704 If SubWord( rcsrev, 1, 2 ) = 'symbolic names:' & gettag Then gottag = 1 13705 need_pull = 1 13706 End 13707 End 13708 If num_pulled >= num_queued Then Leave 13709 End 13710Call RxQueue 'D', tmpq 13711Call RxQueue 'S', sessionq /* probably redundant as RxQueue 'D' sets SESSION queue */ 13712Return 13713 13714SelectDate: Procedure Expose !REXXDW. !global. !!last_repository 13715topwin = dw_window_new( !REXXDW.!DW_DESKTOP, 'Select Date', !global.!windowstyle ) 13716Call dw_window_set_icon topwin, !global.!qoccaicon 13717box = dw_box_new( !REXXDW.!DW_VERT ) 13718Call dw_box_pack_start topwin, box, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13719datebox = dw_box_new( !REXXDW.!DW_HORZ ) 13720Call dw_box_pack_start box, datebox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 13721today = Date( 'S' ) 13722day = Substr( today, 7, 2 ) 13723mon = Substr( today, 5, 2 ) 13724year = Substr( today, 1, 4 ) 13725/* 13726 * If we have dw_calendar_new(), use it... 13727 */ 13728If dw_queryfunction( 'dw_calendar_new' ) = 0 Then 13729 Do 13730 date = dw_calendar_new( 100 ) 13731 Call dw_box_pack_start datebox, date, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_SIZE_AUTO, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13732 Call dw_calendar_set_date date, today 13733 window_x = 189 13734 window_y = 242 13735 End 13736Else 13737 Do 13738 /* 13739 * Add our spin buttons 13740 */ 13741 day_sb = dw_spinbutton_new( day, 0 ) 13742 Call dw_box_pack_start datebox, day_sb, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13743 Call dw_spinbutton_set_limits day_sb, 31, 1 13744 Call dw_spinbutton_set_pos day_sb, day 13745 13746 month_cb = dw_combobox_new( Word( !global.!months, mon ), 1 ) 13747 Call dw_box_pack_start datebox, month_cb, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13748 Do i = 1 To 12 13749 Call dw_listbox_append month_cb, Word( !global.!months, i ) 13750 End 13751 Call dw_listbox_select month_cb, mon-1, !REXXDW.!DW_LB_SELECTED 13752 13753 year_sb = dw_spinbutton_new( year, 2 ) 13754 Call dw_box_pack_start datebox, year_sb, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 13755 Call dw_spinbutton_set_limits year_sb, 2099, 1990 13756 Call dw_spinbutton_set_pos year_sb, year 13757 window_x = 300 13758 window_y = 130 13759 End 13760/* 13761 * Create a dialog for the window 13762 */ 13763dialog_wait = dw_dialog_new( ) 13764/* 13765 * Create Cancel and Apply buttons 13766 */ 13767b1 = dw_button_new( 'Apply', 0 ) 13768Call dw_box_pack_start box, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13769If dw_queryfunction( 'dw_calendar_new' ) = 0 Then 13770 Do 13771 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'CalendarSelectorApplyCallback', topwin, dialog_wait, date 13772 End 13773Else 13774 Do 13775 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'DateSelectorApplyCallback', topwin, dialog_wait, day_sb, month_cb, year_sb 13776 End 13777 13778b2 = dw_button_new( 'Cancel', 0 ) 13779Call dw_box_pack_start box, b2, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 13780Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', topwin, dialog_wait 13781/* 13782 * We now have everything setup, we can connect the destroying of the top-level window 13783 * to the 'close' callback 13784 */ 13785Call dw_signal_connect topwin, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', topwin, dialog_wait 13786/* 13787 * Display the splash window 13788 */ 13789Call dw_window_set_pos_size topwin, (!global.!screen_width % 2) - (window_x % 2), (!global.!screen_height % 2) - (window_y % 2), window_x, window_y 13790Call dw_window_show topwin 13791 13792Parse Value dw_dialog_wait( dialog_wait ) With cancel newdate 13793Return newdate 13794 13795RunOSCommand: Procedure Expose !REXXDW. !global. !!last_repository osout. oserr. 13796Parse Arg ro_cmd 13797If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands ro_cmd 13798Address System ro_cmd With Output Stem osout. Error Stem oserr. 13799Return rc 13800 13801DebugCommands: Procedure Expose !REXXDW. !global. !!last_repository 13802Parse Arg cmd 13803Say 'Executing:' cmd 'from line:' .sigl 13804If !global.!batch_mode = 1 Then Say 'Executing:' cmd 'from line:' .sigl 13805Else 13806 Do 13807 Call WriteMessageToLogWindow 'Executing:' cmd 13808 Call dw_main_sleep 15 13809 End 13810Return 13811 13812/* 13813 * Displays text in the status area 13814 */ 13815DisplayStatus: Procedure Expose !REXXDW. !global. !!last_repository 13816Parse Arg msg 13817Call dw_window_set_text !global.!systemstatus, msg 13818Call dw_main_sleep 10 13819Return 13820 13821/* 13822 * Write the contents of the stems to the log window 13823 */ 13824WriteOutputStemsToLogWindow: Procedure Expose !REXXDW. !global. !!last_repository osout. oserr. 13825Parse Arg conv, msg 13826Call dw_mle_freeze !global.!mle.!!last_repository 13827Call WriteMessageHeaderToLogWindow msg 13828Do wtfi = 1 To osout.0 13829 mod_colour = DetermineLineColour( conv, osout.wtfi ) 13830 Call WriteMessageToLogWindow ' 'osout.wtfi, mod_colour 13831End 13832Do wtfi = 1 To oserr.0 13833 Call WriteMessageToLogWindow ' 'oserr.wtfi, 'redfore' 13834End 13835Call WriteMessageTrailerToLogWindow msg 13836Call dw_mle_thaw !global.!mle.!!last_repository 13837Drop osout. oserr. 13838Return 13839 13840/* 13841 * Write the output from some CVS commands that list actions on files 13842 */ 13843WriteCVSOutputStemsToLogWindow: Procedure Expose !REXXDW. !global. !!last_repository osout. oserr. 13844Parse Arg command, ignore, msg 13845Call dw_mle_freeze !global.!mle.!!last_repository 13846Call WriteMessageHeaderToLogWindow msg 13847ignorelen = Length( ignore ) 13848Do i = 1 To osout.0 13849 If ignorelen = 0 | Left( osout.i, ignorelen ) \= ignore Then Call WriteMessageToLogWindow ' 'CVSStatusLine( command osout.i ) 13850End 13851Do i = 1 To oserr.0 13852 If ignorelen = 0 | Left( oserr.i, ignorelen ) \= ignore Then Call WriteMessageToLogWindow ' 'oserr.i 13853End 13854Call WriteMessageTrailerToLogWindow msg 13855Call dw_mle_thaw !global.!mle.!!last_repository 13856Return 13857 13858/* 13859 * Write the contents of the stems to the screen 13860 */ 13861WriteOutputStemsToConsole: Procedure Expose !REXXDW. !global. !!last_repository osout. oserr. 13862Parse Arg conv, msg 13863Say msg '- Started at:' Date() Time() 13864Do wtfi = 1 To osout.0 13865 Say ' 'osout.wtfi 13866End 13867Do wtfi = 1 To oserr.0 13868 Say ' 'oserr.wtfi 13869End 13870Say msg '- Finished at:' Date() Time() 13871Drop osout. oserr. 13872Return 13873 13874WriteStackToLogWindow: Procedure Expose !REXXDW. !global. !!last_repository 13875Parse Arg conv, msg 13876Call dw_mle_freeze !global.!mle.!!last_repository 13877Call WriteMessageHeaderToLogWindow msg 13878Call WriteStackToLogWindowNoHeaderTrailer conv 13879Call WriteMessageTrailerToLogWindow msg 13880Call dw_mle_thaw !global.!mle.!!last_repository 13881Return 13882 13883WriteStackToLogWindowNoHeaderTrailer: Procedure Expose !REXXDW. !global. !!last_repository 13884Parse Arg conv 13885Do Queued() 13886 Parse Pull history_line 13887 mod_colour = DetermineLineColour( conv, history_line ) 13888 Call WriteMessageToLogWindow ' 'history_line, mod_colour 13889End 13890Return 13891 13892WriteMessageHeaderToLogWindow: Procedure Expose !REXXDW. !global. !!last_repository 13893Parse Arg msg, modifier 13894If modifier = '' Then modifier = 'blueforebold' 13895Call dw_mle_set_editable !global.!mle.!!last_repository, !REXXDW.!DW_EDITABLE 13896!global.!mle_position.!!last_repository = dw_mle_import( !global.!mle.!!last_repository, !global.!crlf||msg '- Started at:' Date() Time()||!global.!crlf, !global.!mle_position.!!last_repository ) 13897Parse Value dw_mle_get_size( !global.!mle.!!last_repository ) With bytes lines 13898Call dw_mle_set_visible !global.!mle.!!last_repository, lines 13899Call dw_mle_set_editable !global.!mle.!!last_repository, !REXXDW.!DW_READONLY 13900Return 13901 13902WriteMessageTrailerToLogWindow: Procedure Expose !REXXDW. !global. !!last_repository 13903Parse Arg msg, modifier 13904If modifier = '' Then modifier = 'blackforebold' 13905Call dw_mle_set_editable !global.!mle.!!last_repository, !REXXDW.!DW_EDITABLE 13906!global.!mle_position.!!last_repository = dw_mle_import( !global.!mle.!!last_repository, msg '- Finished at:' Date() Time()||!global.!crlf, !global.!mle_position.!!last_repository ) 13907Parse Value dw_mle_get_size( !global.!mle.!!last_repository ) With bytes lines 13908Call dw_mle_set_visible !global.!mle.!!last_repository, lines 13909Call dw_mle_set_editable !global.!mle.!!last_repository, !REXXDW.!DW_READONLY 13910Return 13911 13912WriteMessageToLogWindow: Procedure Expose !REXXDW. !global. !!last_repository osout. oserr. 13913Parse Arg msg, modifier 13914If modifier = '' Then modifier = 'blackfore' 13915Call dw_mle_set_editable !global.!mle.!!last_repository, !REXXDW.!DW_EDITABLE 13916!global.!mle_position.!!last_repository = dw_mle_import( !global.!mle.!!last_repository, msg||!global.!crlf, !global.!mle_position.!!last_repository ) 13917Parse Value dw_mle_get_size( !global.!mle.!!last_repository ) With bytes lines 13918Call dw_mle_set_visible !global.!mle.!!last_repository, lines 13919Call dw_mle_set_editable !global.!mle.!!last_repository, !REXXDW.!DW_READONLY 13920Return 13921 13922WriteStringToLogWindow: Procedure Expose !REXXDW. !global. !!last_repository osout. oserr. 13923Parse Arg msg, modifier 13924If modifier = '' Then modifier = 'blackfore' 13925Call dw_mle_set_editable !global.!mle.!!last_repository, !REXXDW.!DW_EDITABLE 13926!global.!mle_position.!!last_repository = dw_mle_import( !global.!mle.!!last_repository, msg, !global.!mle_position.!!last_repository ) 13927Parse Value dw_mle_get_size( !global.!mle.!!last_repository ) With bytes lines 13928Call dw_mle_set_visible !global.!mle.!!last_repository, lines 13929Call dw_mle_set_editable !global.!mle.!!last_repository, !REXXDW.!DW_READONLY 13930Return 13931 13932/* 13933 * Ensure that these still return colours, or you will have to change all calls that 13934 * expect a colour returned 13935 */ 13936DetermineLineColour: Procedure Expose !REXXDW. !global. !!last_repository osout. oserr. 13937Parse Arg conv, str 13938Select 13939 When conv = 'cvs_status' Then mod_colour = DetermineCVSStatusLineColour( str ) 13940 Otherwise mod_colour = 'blackfore' 13941End 13942Return mod_colour 13943 13944DetermineCVSStatusLineColour: Procedure Expose !REXXDW. !global. !!last_repository osout. oserr. 13945Parse Arg action . 13946Select 13947 When action = 'U' Then mod_colour = 'greenfore' /* New working file */ 13948 When action = 'P' Then mod_colour = 'greenfore' /* Working file patched */ 13949 When action = 'M' Then mod_colour = 'redfore' /* Local file modified */ 13950 When action = 'C' Then mod_colour = 'cyan' /* Conflict in file */ 13951 Otherwise mod_colour = 'blackfore' 13952End 13953Return mod_colour 13954 13955CVSStatusLine: Procedure Expose !REXXDW. !global. !!last_repository 13956Parse Arg command action rem 13957actions = 'UPMC' 13958If command = 'update' Then 13959 Do 13960 desc.U = 'New working file:' 13961 desc.P = 'Working file patched:' 13962 End 13963Else 13964 Do 13965 desc.P = 'New working file:' 13966 desc.U = 'Working file patched:' 13967 End 13968desc.M = 'Local file modified:' 13969desc.C = 'Conflict in file:' 13970If Pos( action, actions ) \= 0 Then 13971 Return Left( desc.action, 21 ) rem 13972Else 13973 Return action rem 13974 13975CheckForCVSConflicts: Procedure Expose !REXXDW. !global. !!last_repository oserr. 13976/* 13977 * We now have errors in oserr. stem; see if there are any conflicts 13978 * and if so, display a messagebox 13979 * This only works if RunOSCommand() is called, and obviously only for CVS 13980 */ 13981had_conflicts = 0 13982Do i = 1 To oserr.0 13983 If Countstr( 'cvs update: conflicts found', oserr.i ) \= 0 | Countstr( 'warning: conflicts during merge', oserr.i ) \= 0 | Countstr( 'had a conflict and has not been modified', oserr.i ) \= 0 Then 13984 Do 13985 had_conflicts = 1 13986 Leave 13987 End 13988End 13989If had_conflicts Then Call dw_messagebox 'Conflicts found!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'There were conflicts as a result of this command. See the messages pane for details.' 13990Return 13991 13992SetRepFileRow: Procedure Expose !REXXDW. !global. !!last_repository 13993Parse Arg i, initial_flag 13994this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 13995fn = Substr( filename.j, 5 ) 13996if trace() = 'F' Then say !global.!repfiles.?filename.!!last_repository.i':'!global.!repfiles.?filestatus.!!last_repository.i 13997Select 13998 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 13999 Do 14000 line = '{ 'type'}' '{ 'fn'}' '{ 'Substr( filedate.j, 5 )'}' '{ 'Substr(user.j,5)'}' 14001 /* TODO */ 14002 End 14003 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 14004 Do 14005 icon = Wordpos( Substr( !global.!repfiles.?filetype.!!last_repository.i, 5 ), !global.!fileicons ) 14006 statustype = Wordpos( Substr( !global.!repfiles.?filestatus.!!last_repository.i, 5 ), !global.!statusicons ) 14007 /* 14008 * Convert the date stored in CVS to localtime 14009 */ 14010 date = Strip( Substr( !global.!repfiles.?filedate.!!last_repository.i, 5 ) ) 14011 Select 14012 When date = 0 | date = '*Unknown*' Then date = '* unknown *' 14013 When Datatype( date ) = 'NUM' Then 14014 Do 14015 date = Time_tDateToDisplayDate( date ) 14016 If Length( Word( date, 1 ) ) = 1 Then date = ' 'date 14017 End 14018 Otherwise Nop 14019 End 14020 iconname = Substr( !global.!repfiles.?filereminder.!!last_repository.i, 5 ) 14021 reminder = Wordpos( iconname, !global.!statusicons ) 14022 If initial_flag = 'initial' Then 14023 Do 14024 Call dw_filesystem_set_file !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, i-1, Substr( !global.!repfiles.?filename.!!last_repository.i, 5 ), !global.!fileicon.icon 14025 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 0, i-1, !global.!statusicon.statustype 14026 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 1, i-1, date 14027 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 2, i-1, Substr( !global.!repfiles.?user.!!last_repository.i, 5 ) 14028 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 3, i-1, Substr( !global.!repfiles.?filerev.!!last_repository.i, 5 ) 14029 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 4, i-1, !global.!statusicon.reminder 14030 End 14031 Else 14032 Do 14033 Call dw_filesystem_change_file !global.!repfilescontainer.!!last_repository, i-1, Substr( !global.!repfiles.?filename.!!last_repository.i, 5 ), !global.!fileicon.icon 14034 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 0, i-1, !global.!statusicon.statustype 14035 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 1, i-1, date 14036 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 2, i-1, Substr( !global.!repfiles.?user.!!last_repository.i, 5 ) 14037 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 3, i-1, Substr( !global.!repfiles.?filerev.!!last_repository.i, 5 ) 14038 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 4, i-1, !global.!statusicon.reminder 14039 End 14040 Call dw_container_set_row_title !global.!repfilescontainermemory.!!last_repository, i-1, i 14041 End 14042 When !global.!!repository.!!type.!!last_repository = 'hg' Then 14043 Do 14044 icon = Wordpos( Substr( !global.!repfiles.?filetype.!!last_repository.i, 5 ), !global.!fileicons ) 14045 statustype = Wordpos( Substr( !global.!repfiles.?filestatus.!!last_repository.i, 5 ), !global.!statusicons ) 14046 date = Strip( Substr( !global.!repfiles.?filedate.!!last_repository.i, 5 ) ) 14047 date = Time_tDateToDisplayDate( date ) 14048 If Length( Word( date, 1 ) ) = 1 Then date = ' 'date 14049 iconname = Substr( !global.!repfiles.?filereminder.!!last_repository.i, 5 ) 14050 reminder = Wordpos( iconname, !global.!statusicons ) 14051 If initial_flag = 'initial' Then 14052 Do 14053 Call dw_filesystem_set_file !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, i-1, Substr( !global.!repfiles.?filename.!!last_repository.i, 5 ), !global.!fileicon.icon 14054 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 0, i-1, !global.!statusicon.statustype 14055 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 1, i-1, date 14056 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 2, i-1, Substr( !global.!repfiles.?user.!!last_repository.i, 5 ) 14057 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 3, i-1, Right( Format( Substr( !global.!repfiles.?filerev.!!last_repository.i, 5 ),10,0 ), 10, ' ' ) 14058 Call dw_filesystem_set_item !global.!repfilescontainer.!!last_repository, !global.!repfilescontainermemory.!!last_repository, 4, i-1, !global.!statusicon.reminder 14059 End 14060 Else 14061 Do 14062 Call dw_filesystem_change_file !global.!repfilescontainer.!!last_repository, i-1, Substr( !global.!repfiles.?filename.!!last_repository.i, 5 ), !global.!fileicon.icon 14063 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 0, i-1, !global.!statusicon.statustype 14064 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 1, i-1, date 14065 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 2, i-1, Substr( !global.!repfiles.?user.!!last_repository.i, 5 ) 14066 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 3, i-1, Substr( !global.!repfiles.?filerev.!!last_repository.i, 5 ) 14067 Call dw_filesystem_change_item !global.!repfilescontainer.!!last_repository, 4, i-1, !global.!statusicon.reminder 14068 End 14069 Call dw_container_set_row_title !global.!repfilescontainermemory.!!last_repository, i-1, i 14070 End 14071 Otherwise Nop 14072End 14073Return 14074 14075/* 14076 * For each item in !global.!current_filenames. check if any of its status details have changed 14077 */ 14078RefreshSelectedFiles: Procedure Expose !REXXDW. !global. !!last_repository 14079Do i = 1 To !global.!current_filenames.0 14080 idx = !global.!current_indexes.i 14081 Select 14082 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then fn = !global.!repfiles.?fullfilename.!!last_repository.idx 14083 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then fn = !global.!allfiles.?fullfilename.!!last_repository.idx 14084 Otherwise fn = !global.!repfiles.?fullfilename.!!last_repository.idx 14085 End 14086 Select 14087 When !global.!!repository.!!type.!!last_repository = 'rcs' Then Call RefreshRCSFileRow idx, Substr( fn, 5 ) 14088 When !global.!!repository.!!type.!!last_repository = 'cvs' Then Call RefreshCVSFileRow idx, Substr( fn, 5 ) 14089 Otherwise Nop 14090 End 14091 Select 14092 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then Call SetRepFileRow idx, '' 14093 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then Call SetAllRepFileRow idx, '' 14094 Otherwise Nop 14095 End 14096End 14097Return 14098 14099SetAllRepFileRow: Procedure Expose !REXXDW. !global. !!last_repository 14100Parse Arg i, initial_flag 14101this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 14102fn = Substr( filename.j, 5 ) 14103if trace() = 'F' Then say !global.!allfiles.?filename.!!last_repository.i':'!global.!allfiles.?filestatus.!!last_repository.i 14104Select 14105 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 14106 Do 14107 line = '{ 'type'}' '{ 'fn'}' '{ 'Substr( filedate.j, 5 )'}' '{ 'Substr(user.j,5)'}' 14108 /* TODO */ 14109 End 14110 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 14111 Do 14112 icon = Wordpos( Substr( !global.!allfiles.?filetype.!!last_repository.i, 5 ), !global.!fileicons ) 14113 statustype = Wordpos( Substr( !global.!allfiles.?filestatus.!!last_repository.i, 5 ), !global.!statusicons ) 14114 /* 14115 * Convert the date stored in CVS to localtime 14116 */ 14117 date = Strip( Substr( !global.!allfiles.?filedate.!!last_repository.i, 5 ) ) 14118 Select 14119 When date = 0 | date = '*Unknown*' Then date = '* unknown *' 14120 When Datatype( date ) = 'NUM' Then 14121 Do 14122 date = Time_tDateToDisplayDate( date ) 14123 If Length( Word( date, 1 ) ) = 1 Then date = ' 'date 14124 End 14125 Otherwise Nop 14126 End 14127 iconname = Substr( !global.!allfiles.?filereminder.!!last_repository.i, 5 ) 14128 reminder = Wordpos( iconname, !global.!statusicons ) 14129 If initial_flag = 'initial' Then 14130 Do 14131 Call dw_filesystem_set_file !global.!allfilescontainer.!!last_repository, !global.!allfilescontainermemory.!!last_repository, i-1, Substr( !global.!allfiles.?filename.!!last_repository.i, 5 ), !global.!fileicon.icon 14132 Call dw_filesystem_set_item !global.!allfilescontainer.!!last_repository, !global.!allfilescontainermemory.!!last_repository, 0, i-1, !global.!statusicon.statustype 14133 Call dw_filesystem_set_item !global.!allfilescontainer.!!last_repository, !global.!allfilescontainermemory.!!last_repository, 1, i-1, date 14134 Call dw_filesystem_set_item !global.!allfilescontainer.!!last_repository, !global.!allfilescontainermemory.!!last_repository, 2, i-1, Substr( !global.!allfiles.?user.!!last_repository.i, 5 ) 14135 Call dw_filesystem_set_item !global.!allfilescontainer.!!last_repository, !global.!allfilescontainermemory.!!last_repository, 3, i-1, Substr( !global.!allfiles.?filerev.!!last_repository.i, 5 ) 14136 Call dw_filesystem_set_item !global.!allfilescontainer.!!last_repository, !global.!allfilescontainermemory.!!last_repository, 4, i-1, Substr( !global.!allfiles.?filepath.!!last_repository.i, 5 ) 14137 Call dw_filesystem_set_item !global.!allfilescontainer.!!last_repository, !global.!allfilescontainermemory.!!last_repository, 5, i-1, !global.!statusicon.reminder 14138 End 14139 Else 14140 Do 14141 Call dw_filesystem_change_file !global.!allfilescontainer.!!last_repository, i-1, Substr( !global.!allfiles.?filename.!!last_repository.i, 5 ), !global.!fileicon.icon 14142 Call dw_filesystem_change_item !global.!allfilescontainer.!!last_repository, 0, i-1, !global.!statusicon.statustype 14143 Call dw_filesystem_change_item !global.!allfilescontainer.!!last_repository, 1, i-1, date 14144 Call dw_filesystem_change_item !global.!allfilescontainer.!!last_repository, 2, i-1, Substr( !global.!allfiles.?user.!!last_repository.i, 5 ) 14145 Call dw_filesystem_change_item !global.!allfilescontainer.!!last_repository, 3, i-1, Substr( !global.!allfiles.?filerev.!!last_repository.i, 5 ) 14146 Call dw_filesystem_change_item !global.!allfilescontainer.!!last_repository, 4, i-1, Substr( !global.!allfiles.?filepath.!!last_repository.i, 5 ) 14147 Call dw_filesystem_change_item !global.!allfilescontainer.!!last_repository, 5, i-1, !global.!statusicon.reminder 14148 End 14149 Call dw_container_set_row_title !global.!allfilescontainermemory.!!last_repository, i-1, i 14150 End 14151 Otherwise Nop 14152End 14153Return 14154 14155SetWindowTitle: Procedure Expose !REXXDW. !global. !!last_repository 14156Call dw_window_set_text !global.!mainwindow, 'QOCCA:' !global.!!repository.!!name.!!last_repository'('!global.!!repository.!!type.!!last_repository') Working:' !global.!!repository.!!working_dir.!!last_repository 14157Return 14158 14159RefreshRCSFileRow: 14160/* TODO */ 14161Parse Arg i,fullfilename 14162newi = Right( i, 4 ) 14163filedate.i = newi||Stream(fullfilename,'C','QUERY TIMESTAMP') 14164user.i = newi||GetRCSLocker(fullfilename) 14165Return 14166 14167/* 14168 * For an individual file, determine all new file details for displaying 14169 */ 14170RefreshCVSFileRow: Procedure Expose !REXXDW. !global. !!last_repository 14171Parse Arg idx, fullfilename 14172If !global.!offline.!!last_repository Then Return 14173/* 14174 * Work out how to get file details for an individual file... 14175 */ 14176Select 14177 When !global.!!repository.!!enhanced_cvs.!!last_repository \= 'Y' Then 14178 Do 14179 If !global.!!repository.!!enhanced_cvs.!!last_repository \= 'Y' Then logcmd = 'log' 14180 Else logcmd = 'rlog' 14181 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q' logcmd '-bN' quote( fullfilename ) 14182 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 14183 Address Command cmd With Output Stem log. Error Stem err. 14184 Do i = 1 To log.0 14185 Select 14186 When Left( log.i, 21 ) = 'keyword substitution:' Then type = Word( log.i, 3 ) 14187 When Left( log.i, 20 ) = Copies( '-', 20 ) Then 14188 Do 14189 tmpidx = i + 1 14190 Parse Var log.tmpidx 'revision' rev 14191 tmpidx = tmpidx + 1 14192 Parse Var log.tmpidx 'date: ' date time ';' 'author: ' author ';' 'state: ' state ';' . 14193 /* still need to add locks TODO */ 14194 item.1 = Left( state, 11 ) || Left( rev, 16 ) || Left( author, 36 ) || Strip( date ) Strip( time ) Left( type, 4 ) || Right( Length( fullfilename ), 3 ) fullfilename 14195 Leave i 14196 End 14197 Otherwise Nop 14198 End 14199 End 14200 End 14201 Otherwise 14202 Do 14203 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list -l' quote( fullfilename ) 14204 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 14205 Address Command cmd With Output Stem item. Error Stem junk. 14206 End 14207End 14208newi = Right( idx, 4 ) 14209Parse Var item.1 1 . 12 rev 28 user 64 filedate 75 filetime 84 type 88 flen 91 . 14210Parse Var item.1 92 filename +(flen) +1 locks 14211filetime = Strip( filetime ) 14212filedate = Strip( filedate ) 14213type = Strip( type ) 14214Select 14215 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?repfiles.!!last_repository Then Call SetCVSFileDetails 'INDIVIDUAL', idx, newi, fullfilename, filedate, filetime, type, rev, user, locks 14216 When !global.!filespage.!!last_repository = !global.!filenotebookpage.?allfiles.!!last_repository Then Call SetCVSAllFileDetails 'INDIVIDUAL', idx, newi, fullfilename, filedate, filetime, type, rev, user, locks 14217 Otherwise Nop 14218End 14219if trace() = 'F' Then say 'refreshcvsfilerow:' fullfilename':'!global.!repfiles.?filestatus.!!last_repository.i 14220Return 14221 14222/* 14223 * For an individual CVS file, determine its new status etc for displaying 14224 */ 14225SetCVSFileDetails: Procedure Expose !REXXDW. !global. !!last_repository 14226Parse Arg action, idx, newi, fullfilename, filedate, filetime, filetype, rev, user, locks 14227!global.!repfiles.?filerev.!!last_repository.idx = newi||Strip(rev) 14228If locks = '' Then !global.!repfiles.?user.!!last_repository.idx = newi||Strip(user) 14229Else !global.!repfiles.?user.!!last_repository.idx = newi||Strip(user) '('locks')' 14230Select 14231 When filedate = 'dummy' & filetime = 'timestamp' Then filedate = 0 14232 When filetype = '?' Then Nop 14233 Otherwise 14234 Do 14235 filetime = Strip( filetime ) 14236 filedate = Right( DateTimeToTime_T( Changestr( '/', filedate, '' ), filetime, 'S', 1 ), 12, 0 ) 14237 End 14238End 14239!global.!repfiles.?filedate.!!last_repository.idx = newi || filedate 14240!global.!repfiles.?filetype.!!last_repository.idx = newi || DetermineFileType( filetype, !global.!user, locks ) 14241If action = 'INDIVIDUAL' Then 14242 !global.!repfiles.?filestatus.!!last_repository.idx = newi||DetermineCVSStatus( idx, fullfilename ) 14243!global.!repfiles.?filereminder.!!last_repository.idx = newi||DetermineReminderIcon( Substr( !global.!repfiles.?fullfilename.!!last_repository.idx, 5 ) ) 14244Return 14245 14246/* 14247 * For an individual file, determine its new status etc for displaying 14248 */ 14249SetCVSAllFileDetails: Procedure Expose !REXXDW. !global. !!last_repository 14250Parse Arg action, idx, newi, fullfilename, filedate, filetime, filetype, rev, user, locks 14251!global.!allfiles.?filerev.!!last_repository.idx = newi||Strip(rev) 14252If locks = '' Then !global.!allfiles.?user.!!last_repository.idx = newi||Strip(user) 14253Else !global.!allfiles.?user.!!last_repository.idx = newi||Strip(user) '('locks')' 14254Select 14255 When filedate = 'dummy' & filetime = 'timestamp' Then filedate = 0 14256 When filetype = '?' Then Nop 14257 Otherwise 14258 Do 14259 filetime = Strip( filetime ) 14260 filedate = Right( DateTimeToTime_T( Changestr( '/', filedate, '' ), filetime, 'S', 1 ), 12, 0 ) 14261 End 14262End 14263!global.!allfiles.?filedate.!!last_repository.idx = newi || filedate 14264!global.!allfiles.?filetype.!!last_repository.idx = newi || DetermineFileType( filetype, !global.!user, locks ) 14265If action = 'INDIVIDUAL' Then 14266 !global.!allfiles.?filestatus.!!last_repository.idx = newi||DetermineCVSStatus( idx, fullfilename ) 14267Else 14268 !global.!allfiles.?filestatus.!!last_repository.idx = newi||'fileunknown' 14269!global.!allfiles.?filereminder.!!last_repository.idx = newi||DetermineReminderIcon( Substr( !global.!allfiles.?fullfilename.!!last_repository.idx, 5 ) ) 14270Return 14271 14272/* 14273 * For an individual HG file, determine its new status etc for displaying 14274 */ 14275SetHGFileDetails: Procedure Expose !REXXDW. !global. !!last_repository 14276Parse Arg action, idx, newi, fullfilename, filedate, filetime, filetype, status, rev, user, locks 14277!global.!repfiles.?filerev.!!last_repository.idx = newi||Right( Strip( rev ), 20, '0' ) 14278 14279icon = GetHGStatusIcon( status ) 14280say .line icon 14281!global.!repfiles.?filestatus.!!last_repository.idx = Left( !global.!repfiles.?filestatus.!!last_repository.idx, 4 ) || icon 14282If locks = '' Then !global.!repfiles.?user.!!last_repository.idx = newi||Strip(user) 14283Else !global.!repfiles.?user.!!last_repository.idx = newi||Strip(user) '('locks')' 14284/* 14285Select 14286 When filedate = 'dummy' & filetime = 'timestamp' Then filedate = 0 14287 When filetype = '?' Then Nop 14288 Otherwise 14289 Do 14290 filetime = Strip( filetime ) 14291 filedate = Right( DateTimeToTime_T( Changestr( '/', filedate, '' ), filetime, 'S', 1 ), 12, 0 ) 14292 End 14293End 14294*/ 14295!global.!repfiles.?filedate.!!last_repository.idx = newi || filedate 14296say .line filetype 14297!global.!repfiles.?filetype.!!last_repository.idx = newi || DetermineFileType( filetype, !global.!user, locks ) 14298!global.!repfiles.?filereminder.!!last_repository.idx = newi||DetermineReminderIcon( Substr( !global.!repfiles.?fullfilename.!!last_repository.idx, 5 ) ) 14299Return 14300 14301/* 14302 * For an individual file, determine its new status etc for displaying 14303 */ 14304SetHGAllFileDetails: Procedure Expose !REXXDW. !global. !!last_repository 14305Parse Arg action, idx, newi, fullfilename, filedate, filetime, filetype, status, rev, user, locks 14306!global.!allfiles.?filerev.!!last_repository.idx = newi||Strip(rev) 14307If locks = '' Then !global.!allfiles.?user.!!last_repository.idx = newi||Strip(user) 14308Else !global.!allfiles.?user.!!last_repository.idx = newi||Strip(user) '('locks')' 14309icon = GetHGStatusIcon( status ) 14310say .line icon 14311!global.!allfiles.?filestatus.!!last_repository.smi = Left( !global.!allfiles.?filestatus.!!last_repository.smi, 4 ) || icon 14312!global.!allfiles.?filedate.!!last_repository.idx = newi || filedate 14313!global.!allfiles.?filetype.!!last_repository.idx = newi || DetermineFileType( filetype, !global.!user, locks ) 14314If action = 'INDIVIDUAL' Then 14315 !global.!allfiles.?filestatus.!!last_repository.idx = newi||DetermineHGStatus( idx, fullfilename ) 14316Else 14317 !global.!allfiles.?filestatus.!!last_repository.idx = newi||'fileunknown' 14318!global.!allfiles.?filereminder.!!last_repository.idx = newi||DetermineReminderIcon( Substr( !global.!allfiles.?fullfilename.!!last_repository.idx, 5 ) ) 14319Return 14320 14321DetermineReminderIcon: Procedure Expose !REXXDW. !global. !!last_repository 14322Parse Arg file 14323If Stream( CVSFileToReminderFile( file ), 'C', 'QUERY EXISTS' ) \= '' Then icon = 'setreminder' 14324Else icon = 'blank' 14325Return icon 14326 14327DetermineCVSStatus: Procedure Expose !REXXDW. !global. !!last_repository 14328Parse Arg ., filename 14329cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q status -l' quote( filename ) 14330If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 14331Address System cmd With Output Stem sm_status. Error Stem junk. 14332status = '' 14333Do i = 1 To sm_status.0 14334 If Left( sm_status.i, 5 ) = 'File:' Then Parse Var sm_status.i . 'Status: ' status 14335End 14336icon = GetCVSStatusIcon( status ) 14337Return icon 14338 14339GetCVSFileproperties: Procedure Expose !REXXDW. !global. !!last_repository osout. prop. !det. 14340Parse Arg file 14341osout.0 = 0 14342If !global.!!repository.!!enhanced_cvs.!!last_repository \= 'Y' Then logcmd = 'log' 14343Else logcmd = 'rlog' 14344Call RunOsCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository logcmd quote( file ) 14345prop.0 = 0 14346cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q status' quote( file ) 14347If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 14348Address Command cmd With Output Stem prop. Error Stem junk. 14349Return 14350 14351ShowFileHistoryWindow: Procedure Expose !REXXDW. !global. !!last_repository osout. prop. !det. 14352/* 14353 * 14354+-Repository Details------------------------------------+ 14355| File Name: /opt/cvs/ffews/sfs/sdfsdf,v | 14356| Revision: 1.3 +-------------------------+| 14357| File Type: Binary | |^|| 14358| Revisions: 3 | |v|| 14359| Description: +-------------------------+| 14360| This file is a file.... | 14361+-Working File Details----------------------------------+ 14362| Status: Up-to-date (or Unknown) | 14363| Revision: 1.1 | 14364| Date: 28 July 2002 15:03:34 | 14365+-Revision History--------------------------------------+ 14366| Revision: 1.3 |^| 14367| Date: 28 July 2002 15:03:34 Author: mark | | 14368| Line of changes | | 14369| The next description line | | 14370| Revision: 1.2 | | 14371| Date: 28 July 2002 15:03:34 Author: mark | | 14372| Changes |v| 14373+-------------------------------------------------------+ 14374 */ 14375Parse Arg fn 14376Select 14377 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 14378 Do 14379 Call DetermineCVSHistoryDetails fn 14380 reminder_file = Stream( CVSFileToReminderFile( !global.!current_filenames.1 ), 'C', 'QUERY EXISTS' ) 14381 /* 14382 * Parse revision history output into !det.!rh_text. array 14383 */ 14384 Call GetCVSRevisionHistory 14385 End 14386 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 14387 Do 14388 End 14389 Otherwise Nop 14390End 14391If reminder_file = '' Then rem_height = 0 14392Else rem_height = 50 + !global.!widgetheight 14393filepropchange = 'N' 14394title_width = 120 14395rd_height = !global.!widgetheight * 8 14396wd_height = rem_height + (!global.!widgetheight * 4) 14397 14398win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Properties of' fn, !global.!windowstyle ) 14399Call dw_window_set_icon win, !global.!qoccaicon 14400 14401topbox = dw_box_new( !REXXDW.!DW_VERT ) 14402Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 14403/* 14404 * Create the group boxen and pack them 14405 */ 14406rd_box = dw_groupbox_new( !REXXDW.!DW_VERT, 'Repository Details', !REXXDW.!DW_FONT_BOLD ) 14407Call dw_box_pack_start topbox, rd_box, 0, rd_height, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 14408wfd_box = dw_groupbox_new( !REXXDW.!DW_VERT, 'Working File Details', !REXXDW.!DW_FONT_BOLD ) 14409Call dw_box_pack_start topbox, wfd_box, 0, wd_height, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 14410rh_box = dw_groupbox_new( !REXXDW.!DW_HORZ, 'Revision History', !REXXDW.!DW_FONT_BOLD ) 14411Call dw_box_pack_start topbox, rh_box, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 14412/* 14413 * Create the repository details 14414 */ 14415file_box = dw_box_new( !REXXDW.!DW_HORZ ) 14416Call dw_box_pack_start rd_box, file_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14417Call dw_window_set_color file_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14418file_lab = dw_text_new( 'FileName:', 0 ) 14419Call dw_box_pack_start file_box, file_lab, title_width , !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14420Call dw_window_set_color file_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14421Call dw_window_set_font file_lab, !global.!boldfont 14422Call dw_window_set_style file_lab, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14423file_lab_data = dw_text_new( !det.!rcs_file, 0 ) 14424Call dw_box_pack_start file_box, file_lab_data, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14425Call dw_window_set_color file_lab_data, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14426Call dw_window_set_style file_lab_data, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14427/* 14428 * The rev, file type, revisions and locks lines need to be aligned with the labels box, 14429 * so we need another HORZ box 14430 */ 14431com_box = dw_box_new( !REXXDW.!DW_HORZ ) 14432Call dw_box_pack_start rd_box, com_box, 0, 4*!global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14433left_box = dw_box_new( !REXXDW.!DW_VERT ) 14434Call dw_box_pack_start com_box, left_box, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 14435 14436rev_box = dw_box_new( !REXXDW.!DW_HORZ ) 14437Call dw_box_pack_start left_box, rev_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14438Call dw_window_set_color rev_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14439rev_lab = dw_text_new( 'Revision:', 0 ) 14440Call dw_box_pack_start rev_box, rev_lab, title_width , !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14441Call dw_window_set_color rev_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14442Call dw_window_set_font rev_lab, !global.!boldfont 14443Call dw_window_set_style rev_lab, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14444rev_lab_data = dw_text_new( !det.!head, 0 ) 14445Call dw_box_pack_start rev_box, rev_lab_data, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14446Call dw_window_set_color rev_lab_data, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14447Call dw_window_set_style rev_lab_data, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14448 14449filetype_box = dw_box_new( !REXXDW.!DW_HORZ ) 14450Call dw_box_pack_start left_box, filetype_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14451Call dw_window_set_color filetype_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14452filetype_lab = dw_text_new( 'File Type:', 0 ) 14453Call dw_box_pack_start filetype_box, filetype_lab, title_width , !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14454Call dw_window_set_color filetype_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14455Call dw_window_set_font filetype_lab, !global.!boldfont 14456Call dw_window_set_style filetype_lab, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14457If !global.!administrator.!!last_repository = 'Y' Then 14458 Do 14459 If !det.!type = 'Text' Then type_lab_other = 'Binary' 14460 Else type_lab_other = 'Text' 14461 type_lab_data = dw_combobox_new( !det.!type, 0 ) 14462 Call dw_box_pack_start filetype_box, type_lab_data, 70, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14463 Call dw_listbox_append type_lab_data, !det.!type 14464 Call dw_listbox_append type_lab_data, type_lab_other 14465 Call dw_listbox_select type_lab_data, 0, !REXXDW.!DW_LB_SELECTED 14466 End 14467Else 14468 Do 14469 type_lab_data = dw_text_new( !det.!type, 0 ) 14470 Call dw_box_pack_start filetype_box, type_lab_data, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14471 Call dw_window_set_color type_lab_data, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14472 Call dw_window_set_style type_lab_data, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14473 End 14474 14475revs_box = dw_box_new( !REXXDW.!DW_HORZ ) 14476Call dw_box_pack_start left_box, revs_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14477Call dw_window_set_color revs_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14478revs_lab = dw_text_new( 'Revisions:', 0 ) 14479Call dw_box_pack_start revs_box, revs_lab, title_width , !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14480Call dw_window_set_color revs_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14481Call dw_window_set_font revs_lab, !global.!boldfont 14482Call dw_window_set_style revs_lab, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14483revs_lab_data = dw_text_new( !det.!total_revisions, 0 ) 14484Call dw_box_pack_start revs_box, revs_lab_data, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14485Call dw_window_set_color revs_lab_data, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14486Call dw_window_set_style revs_lab_data, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14487locks_box = dw_box_new( !REXXDW.!DW_HORZ ) 14488Call dw_box_pack_start left_box, locks_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14489Call dw_window_set_color locks_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14490locks_lab = dw_text_new( 'Locked by:', 0 ) 14491Call dw_box_pack_start locks_box, locks_lab, title_width , !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14492Call dw_window_set_color locks_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14493Call dw_window_set_font locks_lab, !global.!boldfont 14494Call dw_window_set_style locks_lab, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14495locks_lab_data = dw_text_new( !det.!lock, 0 ) 14496Call dw_box_pack_start locks_box, locks_lab_data, 50, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14497Call dw_window_set_color locks_lab_data, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14498Call dw_window_set_style locks_lab_data, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14499/* 14500 * Only an administrator on CVS can unlock 14501 */ 14502If !global.!administrator.!!last_repository = 'Y' & !det.!lock \= '' & !global.!!repository.!!type.!!last_repository = 'cvs' Then 14503 Do 14504 abox = dw_box_new( !REXXDW.!DW_HORZ ) 14505 Call dw_box_pack_start locks_box, abox, 0 , !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14506 Call dw_window_set_color abox, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14507 tmp = dw_text_new( 'Unlock:', 0 ) 14508 Call dw_box_pack_start abox, tmp, 65 , !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14509 Call dw_window_set_color tmp, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14510 Call dw_window_set_font tmp, !global.!boldfont 14511 Call dw_window_set_style tmp, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14512 locks_cb = dw_checkbox_new( '', 0 ) 14513 Call dw_box_pack_start abox, locks_cb, !global.!widgetheight, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14514 Call dw_checkbox_set locks_cb, !REXXDW.!DW_UNCHECKED 14515 Call dw_window_set_color locks_cb, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14516 Call dw_box_pack_start locks_box, 0, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14517 End 14518/* 14519 * A box for labels... 14520 */ 14521right_box = dw_box_new( !REXXDW.!DW_VERT ) 14522lb = dw_listbox_new( 673, !REXXDW.!DW_LB_SINGLE_SELECTION ) 14523maxlen = 0 14524Do i = !det.!tag_start For !det.!num_tags 14525 Parse Value dw_font_text_extents_get( lb, 0, osout.i ) With mywidth myheight 14526 mywidth = mywidth % 1 -- ensure width is a whole number 14527 If mywidth > maxlen Then maxlen = mywidth 14528End 14529len = maxlen + 20 14530Call dw_box_pack_start com_box, right_box, len, 4*!global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14531Call dw_box_pack_start right_box, lb, len, 4*!global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14532Do i = !det.!tag_start For !det.!num_tags 14533 Call dw_listbox_append lb, osout.i 14534End 14535/* 14536 * Add the description and labels headings 14537 */ 14538desc_box = dw_box_new( !REXXDW.!DW_HORZ ) 14539Call dw_box_pack_start rd_box, desc_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14540Call dw_window_set_color desc_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14541desc_lab = dw_text_new( 'Description:', 0 ) 14542Call dw_box_pack_start desc_box, desc_lab, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14543Call dw_window_set_color desc_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14544Call dw_window_set_font desc_lab, !global.!boldfont 14545Call dw_window_set_style desc_lab, dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_LEFT, !REXXDW.!DW_DT_VCENTER ) 14546labels_lab = dw_text_new( 'Labels ', 0 ) 14547Call dw_window_set_font labels_lab, !global.!boldfont 14548Call dw_box_pack_start desc_box, labels_lab, !REXXDW.!DW_SIZE_AUTO, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14549Call dw_window_set_style labels_lab, dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_CENTER, !REXXDW.!DW_DT_VCENTER ) 14550Call dw_window_set_color labels_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14551/* 14552 * Add the description entryfield 14553 */ 14554If !det.!num_desc_lines > 0 Then 14555 Do 14556 idx = !det.!desc_start 14557 !det.!desc = osout.idx 14558 End 14559Else 14560 Do 14561 !det.!desc = '*** None ***' 14562 End 14563desc_entry = dw_entryfield_new( !det.!desc, 0 ) 14564Call dw_box_pack_start rd_box, desc_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14565/* 14566 * Only an administrator on CVS can change the description 14567 */ 14568If !global.!administrator.!!last_repository = 'Y' & !global.!!repository.!!type.!!last_repository = 'cvs' Then Nop 14569Else Call dw_window_disable desc_entry 14570/* 14571 * Create the Working File Details 14572 */ 14573status_box = dw_box_new( !REXXDW.!DW_HORZ ) 14574Call dw_box_pack_start wfd_box, status_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14575Call dw_window_set_color status_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14576status_lab = dw_text_new( 'Status:', 0 ) 14577Call dw_box_pack_start status_box, status_lab, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14578Call dw_window_set_color status_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14579Call dw_window_set_font status_lab, !global.!boldfont 14580status_lab_data = dw_text_new( !det.!wf_status, 0 ) 14581Call dw_box_pack_start status_box, status_lab_data, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14582Call dw_window_set_color status_lab_data, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14583/* 14584 * If we have a working file, display details about it... 14585 */ 14586If prop.0 \= 0 Then 14587 Do 14588 rev_box = dw_box_new( !REXXDW.!DW_HORZ ) 14589 Call dw_box_pack_start wfd_box, rev_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14590 Call dw_window_set_color rev_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14591 rev_lab = dw_text_new( 'Revision:', 0 ) 14592 Call dw_box_pack_start rev_box, rev_lab, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14593 Call dw_window_set_color rev_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14594 Call dw_window_set_font rev_lab, !global.!boldfont 14595 rev_lab_data = dw_text_new( !det.!wf_rev, 0 ) 14596 Call dw_box_pack_start rev_box, rev_lab_data, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14597 Call dw_window_set_color rev_lab_data, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14598 14599 date_box = dw_box_new( !REXXDW.!DW_HORZ ) 14600 Call dw_box_pack_start wfd_box, date_box, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14601 Call dw_window_set_color date_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14602 date_lab = dw_text_new( 'Date:', 0) 14603 Call dw_box_pack_start date_box, date_lab, title_width, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14604 Call dw_window_set_color date_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14605 Call dw_window_set_font date_lab, !global.!boldfont 14606 date_lab_data = dw_text_new( !det.!wf_date, 0 ) 14607 Call dw_box_pack_start date_box, date_lab_data, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14608 Call dw_window_set_color date_lab_data, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14609 End 14610/* 14611 * If we have a reminder for this file, display the reminder text in a text box 14612 */ 14613If reminder_file \= '' Then 14614 Do 14615 rem_box = dw_box_new( !REXXDW.!DW_VERT ) 14616 Call dw_box_pack_start wfd_box, rem_box, 0, rem_height, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14617 Call dw_window_set_color rem_box, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14618 rem_lab = dw_text_new( 'Reminder Text:', 0) 14619 Call dw_box_pack_start rem_box, rem_lab, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14620 Call dw_window_set_color rem_lab, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14621 Call dw_window_set_font rem_lab, !global.!boldfont 14622 t1 = dw_mle_new( 0 ) 14623 Call dw_box_pack_start rem_box, t1, 0, rem_height-!global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 14624 Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 14625 Call dw_window_set_color t1, !REXXDW.!DW_CLR_BLACK, !REXXDW.!DW_CLR_WHITE 14626 Call dw_mle_set_cursor t1, 0 14627 Call dw_mle_delete t1 14628 pos = -1 14629 Call Stream reminder_file, 'C', 'OPEN READ' 14630 Do While Lines( reminder_file ) > 0 14631 pos = dw_mle_import( t1, Linein( reminder_file ), pos ) 14632 End 14633 Call Stream reminder_file, 'C', 'CLOSE' 14634 Call dw_window_disable t1 14635 End 14636/* 14637 * Create the revision history Details 14638 */ 14639depth = dw_color_depth_get() 14640scrollbarwidth = 14 14641!det.!rh_rows = 50 14642!det.!rh_cols = 100 14643!det.!current_row=0 14644!det.!current_col=0 14645/* create box for filecontents and horz scrollbar */ 14646textboxA = dw_box_new( !REXXDW.!DW_VERT ) 14647Call dw_box_pack_start rh_box, textboxA, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 14648 14649/* create render box for filecontents pixmap */ 14650!det.!t2 = dw_render_new( 0 ) 14651Call dw_window_set_font !det.!t2, !global.!fixedfont 14652Parse Value dw_font_text_extents_get( !det.!t2, 0, 'g(' ) With font_width font_height 14653!det.!font_width = (font_width / 2) % 1 -- ensure font width is a whole number 14654!det.!font_height = font_height 14655Call dw_box_pack_start textboxA, !det.!t2, 10, 10, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 14656/* create horizonal scrollbar */ 14657!det.!hscrollbar = dw_scrollbar_new( !REXXDW.!DW_HORZ, 0 ) 14658Call dw_box_pack_start textboxA, !det.!hscrollbar, 100, scrollbarwidth, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14659 14660/* create vertical scrollbar */ 14661vscrollbox = dw_box_new( !REXXDW.!DW_VERT ) 14662!det.!vscrollbar = dw_scrollbar_new( !REXXDW.!DW_VERT, 0 ) 14663Call dw_box_pack_start vscrollbox, !det.!vscrollbar, scrollbarwidth, 100, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 14664/* Pack an area of empty space 14x14 pixels */ 14665Call dw_box_pack_start vscrollbox, 0, scrollbarwidth, scrollbarwidth, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14666Call dw_box_pack_start rh_box, vscrollbox, scrollbarwidth, 0, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 14667pixmap_width = !det.!font_width * !det.!rh_cols 14668pixmap_height = !det.!font_height*!det.!rh_rows 14669!global.!det.!pixmap = dw_pixmap_new( !det.!t2, pixmap_width, pixmap_height, depth ) 14670Call dw_draw_rect 0, !global.!det.!pixmap, !REXXDW.!DW_FILL, 0, 0, pixmap_width, pixmap_height 14671Call dw_signal_connect !det.!t2, !REXXDW.!DW_EXPOSE_EVENT, 'RevisionHistoryExposeCallback' 14672Call dw_signal_connect !det.!t2, !REXXDW.!DW_CONFIGURE_EVENT, 'RevisionHistoryConfigureCallback', !global.!det.!pixmap 14673Call dw_signal_connect !det.!hscrollbar, !REXXDW.!DW_VALUE_CHANGED_EVENT, 'RevisionHistoryValueChangedCallback' 14674Call dw_signal_connect !det.!vscrollbar, !REXXDW.!DW_VALUE_CHANGED_EVENT, 'RevisionHistoryValueChangedCallback' 14675If !global.!administrator.!!last_repository = 'Y' Then 14676 Do 14677 Call dw_signal_connect !det.!t2, !REXXDW.!DW_BUTTON_RELEASE_EVENT, 'RevisionHistoryChangeLogMessageCallback', fn 14678 End 14679Call dw_signal_connect win, !REXXDW.!DW_KEY_PRESS_EVENT, 'RevisionHistoryKeypressCallback' 14680/* 14681 * Create a dialog for the window 14682 */ 14683dialog_wait = dw_dialog_new() 14684Call dw_scrollbar_set_range !det.!hscrollbar, !det.!rh_max_cols, !det.!rh_cols 14685Call dw_scrollbar_set_pos !det.!hscrollbar, 0 14686Call dw_scrollbar_set_range !det.!vscrollbar, !det.!rh_max_rows, !det.!rh_rows 14687Call dw_scrollbar_set_pos !det.!vscrollbar, 0 14688/* 14689 * Draw the first page... 14690 */ 14691Call DrawRevisionHistory 1, 0 14692If !global.!administrator.!!last_repository = 'Y' Then 14693 Do 14694 /* 14695 * Create Apply button 14696 */ 14697 b1 = dw_button_new( 'Apply', 0 ) 14698 Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14699 /* 14700 * Now we know all of the widgets, we can pass these to the callback 14701 */ 14702 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'FilePropertiesApplyCallback', win, dialog_wait, type_lab_data, desc_entry, fn, !det.!type, !det.!desc, locks_cb 14703 buttontext = 'Cancel' 14704 End 14705Else buttontext = 'OK' 14706/* 14707 * Create OK button 14708 */ 14709b1 = dw_button_new( buttontext, 0 ) 14710Call dw_box_pack_start topbox, b1, 0, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 14711/* 14712 * Set our signals now that we have al of the widget details to pass 14713 */ 14714Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 14715Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 14716/* 14717 * Display the window 14718 */ 14719width = (!global.!screen_width % 3 ) * 2 14720height = (!global.!screen_height % 3 ) * 2 14721Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 14722Call dw_window_show win 14723/* 14724 * Wait for the dialog to come back 14725 */ 14726Parse Value dw_dialog_wait( dialog_wait ) With cancel update_flag 14727If cancel \= 'apply' Then update_flag = 'N' 14728 14729Drop osout. prop. 14730Return update_flag 14731 14732/* 14733 * Using the output from 'cvs rlog' and 'cvs status' generate the !det. array 14734 */ 14735DetermineCVSHistoryDetails: Procedure Expose !REXXDW. !global. !!last_repository osout. prop. !det. 14736Parse Arg fn 14737!det.!num_tags = 0 14738!det.!tag_start = 0 14739!det.!tag_width = 0 14740!det.!num_desc_lines = 0 14741!det.!desc_width = 0 14742!det.!desc_start = 0 14743!det.!revision_width = 50 14744!det.!revisions_start = 0 14745!det.!lock = '' 14746in_desc = 0 14747in_revisions = 0 14748in_tags = 0 14749in_locks = 0 14750tab = D2c( 9 ) 14751Do i = 1 To osout.0 14752 Select 14753 When in_revisions Then 14754 Do 14755 Select 14756 When osout.i = Copies( '=', 77 ) Then Leave i 14757 When osout.i = Copies( '-', 28 ) Then Nop 14758 When Countstr( 'date:', osout.i ) = 1 & Countstr( 'author:', osout.i ) = 1 Then Nop 14759 Otherwise 14760 Do 14761 If Length( osout.i ) > !det.!revision_width Then !det.!revision_width = Length( osout.i ) 14762 End 14763 End 14764 End 14765 When osout.i = Copies( '-', 28 ) Then 14766 Do 14767 !det.!revisions_start = i+1 14768 in_revisions = 1 14769 in_desc = 0 14770 End 14771 When in_desc Then 14772 Do 14773 !det.!num_desc_lines = !det.!num_desc_lines + 1 14774 If Length( osout.i) > !det.!desc_width Then !det.!desc_width = Length( osout.i ) 14775 End 14776 When Left( osout.i, 9 ) = 'RCS file:' Then Parse Var osout.i . ': ' !det.!rcs_file 14777 When Left( osout.i, 5 ) = 'head:' Then Parse Var osout.i . ': ' !det.!head 14778 When Left( osout.i, 6 ) = 'locks:' Then in_locks = 1 14779 When Left( osout.i, 15 ) = 'symbolic names:' Then 14780 Do 14781 in_tags = 1 14782 in_locks = 0 14783 End 14784 When Left( osout.i, 1 ) == tab & in_locks Then 14785 Do 14786 Parse Var osout.i (tab) !det.!lock 14787 End 14788 When Left( osout.i, 1 ) == tab & in_tags Then 14789 Do 14790 If !det.!tag_start = 0 Then !det.!tag_start = i 14791 !det.!num_tags = !det.!num_tags + 1 14792 osout.i = Substr( osout.i, 2 ) /* remove leading tab */ 14793 If Length( osout.i ) > !det.!tag_width Then !det.!tag_width = Length( osout.i ) 14794 End 14795 When Left( osout.i, 7 ) = 'keyword' Then 14796 Do 14797 Parse Var osout.i . ': ' type 14798 If type = 'b' Then !det.!type = 'Binary' 14799 Else !det.!type = 'Text' 14800 End 14801 When Left( osout.i, 5 ) = 'total' Then Parse Var osout.i . ': ' !det.!total_revisions ';' . 14802 When Left( osout.i, 12 ) = 'description:' Then 14803 Do 14804 in_desc = 1 14805 !det.!desc_start = i+1 14806 End 14807 Otherwise Nop 14808 End 14809End 14810/* 14811 * Parse the output from cvs status 14812 */ 14813!det.!wf_status = 'Unknown' 14814Do i = 1 To prop.0 14815 Select 14816 When Countstr( 'File:', prop.i ) = 1 & Countstr( 'Status:', prop.i ) = 1 Then Parse Var prop.i . ':' . 'Status: ' !det.!wf_status 14817 When Countstr( 'Working revision:', prop.i ) = 1 Then 14818 Do 14819 Parse Var prop.i . ':' !det.!wf_rev !det.!wf_date 14820 If !det.!wf_rev = 'No' Then 14821 Do 14822 !det.!wf_rev = '' 14823 !det.!wf_date = '' 14824 End 14825 End 14826 Otherwise Nop 14827 End 14828End 14829/* 14830 * Date/time returned by CVS is in UTC, so we need to convert 14831 * to localtime. Unfortunately, CVS does not return the working file 14832 * date/time if running off the server, so we find it ourselves 14833 */ 14834utc_offset_secs = Time('O') / 1000000 14835Parse Var !det.!wf_date . mon day time year 14836If Strip( !det.!wf_date ) = '' | Datatype( mon ) \= 'NUM' Then 14837 Do 14838 Parse Value Stream( fn, 'C', 'QUERY TIMESTAMP' ) With year '-' mon '-' day time 14839 If Datatype( year ) = 'NUM' Then 14840 date_data = Date( 'N', year||mon||day, 'S' ) time 14841 Else 14842 date_data = '*** unknown ***' 14843 End 14844Else 14845 Do 14846 revdate = day mon year 14847 time = Time( 'S', time, 'N' ) + utc_offset_secs 14848 date = Date( 'B', revdate, 'N' ) 14849 If time > 24 * 60 * 60 Then 14850 Do 14851 time = time - (24 * 60 * 60) 14852 date = date + 1 14853 End 14854 If time < 0 Then 14855 Do 14856 time = time + (24 * 60 * 60) 14857 date = date - 1 14858 End 14859 date_data = Date( 'N', date, 'B' ) Time( 'N', time, 'S' ) 14860 End 14861!det.!wf_date = date_data 14862Return 14863 14864/* 14865 * Converts data in osout. array and creates the !det.!rh* arrays 14866 */ 14867GetCVSRevisionHistory: Procedure Expose !REXXDW. !global. !!last_repository osout. !det. 14868background = !REXXDW.!DW_CLR_WHITE 14869utc_offset_secs = Time('O') / 1000000 14870idx = 1 14871max_len = 80 14872/* 14873 * Get "seashell" color for alternate backgrounds 14874 */ 14875seashell = !global.!container_colour 14876Do i = !det.!revisions_start To osout.0 14877 Select 14878 When osout.i = Copies( '=', 77 ) Then Leave 14879 When ( Words( osout.i ) = 2 | Words( osout.i) = 5 ) & Word( osout.i, 1 ) = 'revision' & Strip( Translate( Word( osout.i, 2 ), ' ', '.0123456789' ) ) = '' Then 14880 Do 14881 save_revision = Word( osout.i, 2 ) 14882 End 14883 When osout.i = Copies( '-', 28 ) Then 14884 Do 14885 !det.!rh_text.idx = '' 14886 !det.!rh_type.idx = 'line' 14887 !det.!rh_back.idx = background 14888 If background = !REXXDW.!DW_CLR_WHITE Then background = seashell 14889 Else background = !REXXDW.!DW_CLR_WHITE 14890 idx = idx + 1 /* increment our line counter */ 14891 End 14892 When Countstr( 'date:', osout.i ) = 1 & Countstr( 'author:', osout.i ) = 1 Then 14893 Do 14894 Parse Var osout.i 'date: ' revdate ';' . 'author: ' author ';' . 'state:' state ';' . 14895 /* 14896 * Date/time returned by CVS is is UTC, so we need to convert 14897 * to localtime. 14898 */ 14899 time = Time( 'S', Word( revdate, 2 ), 'N' ) + utc_offset_secs 14900 date = Date( 'B', Changestr( '/', Word( revdate, 1 ), '' ), 'S' ) 14901 If time > 24 * 60 * 60 Then 14902 Do 14903 time = time - (24 * 60 * 60) 14904 date = date + 1 14905 End 14906 If time < 0 Then 14907 Do 14908 time = time + (24 * 60 * 60) 14909 date = date - 1 14910 End 14911 !det.!rh_text.idx = save_revision author Strip( state ) Date( 'N', date, 'B' ) Time( 'N', time, 'S' ) 14912 !det.!rh_type.idx = 'header' 14913 !det.!rh_back.idx = background 14914 idx = idx + 1 14915 End 14916 Otherwise 14917 Do 14918 If Length( osout.i ) > max_len Then max_len = Length( osout.i ) 14919 !det.!rh_text.idx = osout.i 14920 !det.!rh_back.idx = background 14921 !det.!rh_type.idx = 'line' 14922 idx = idx + 1 14923 End 14924 End 14925End 14926lines = idx - 1 14927!det.!rh_text.0 = lines 14928!det.!rh_back.0 = lines 14929!det.!rh_type.0 = lines 14930!det.!rh_max_rows = lines 14931!det.!rh_max_cols = max_len 14932Return 14933 14934RevisionHistoryExposeCallback: Procedure Expose !REXXDW. !global. !!last_repository osout. prop. !det. 14935Parse Arg win, x, y, width, height 14936width = dw_pixmap_width(!global.!det.!pixmap) 14937height = dw_pixmap_height(!global.!det.!pixmap) 14938if trace() = 'F' Then say 'got expose' 14939Call dw_pixmap_bitblt win, , 0, 0, width, height, , !global.!det.!pixmap, 0, 0 14940Call dw_flush 14941parse value dw_window_get_preferred_size( !det.!vscrollbar ) with w h 14942say .line w h 14943return 1 14944 14945RevisionHistoryValueChangedCallback: Procedure Expose !REXXDW. !global. !!last_repository osout. prop. !det. 14946Parse Arg hwnd, value 14947If hwnd = !det.!vscrollbar Then !det.!current_row = value 14948Else !det.!current_col = value 14949if trace() = 'F' Then say 'valuechange' value 14950Call DrawRevisionHistory !det.!current_row, !det.!current_col 14951Return 1 14952 14953RevisionHistoryKeypressCallback: Procedure Expose !REXXDW. !global. !!last_repository osout. prop. !det. 14954Parse Arg win, char, virtualkey, state, data 14955if trace() = 'F' Then Say 'got keypress' '('char')' '('virtualkey')' '('state')' data 14956retcode = 1 14957Select 14958 When virtualkey = !REXXDW.!DW_VK_PRIOR Then 14959 Do 14960 sb = !det.!vscrollbar 14961 current = dw_scrollbar_get_pos( sb ) 14962 value = Max( 0, current - !det.!rh_rows ) 14963 key = 'PRIOR' 14964 End 14965 When virtualkey = !REXXDW.!DW_VK_NEXT Then 14966 Do 14967 sb = !det.!vscrollbar 14968 current = dw_scrollbar_get_pos( sb ) 14969 value = Min( !det.!rh_max_rows - !det.!rh_rows, current + !det.!rh_rows ) 14970 key = 'NEXT' 14971 End 14972 When virtualkey = !REXXDW.!DW_VK_UP Then 14973 Do 14974 sb = !det.!vscrollbar 14975 current = dw_scrollbar_get_pos( sb ) 14976 value = Max( 0, current - 1 ) 14977 key = 'UP' 14978 End 14979 When virtualkey = !REXXDW.!DW_VK_DOWN Then 14980 Do 14981 sb = !det.!vscrollbar 14982 current = dw_scrollbar_get_pos( sb ) 14983 value = Min( !det.!rh_max_rows - !det.!rh_rows, current + 1 ) 14984 key = 'DOWN' 14985 End 14986/* 14987 When virtualkey = !REXXDW.!DW_VK_LEFT Then 14988 Do 14989 sb = !det.!hscrollbar 14990 current = dw_scrollbar_get_pos( sb ) 14991 value = Max( 0, current - 1 ) 14992 key = 'LEFT' 14993 End 14994 When virtualkey = !REXXDW.!DW_VK_RIGHT Then 14995 Do 14996 sb = !det.!hscrollbar 14997 current = dw_scrollbar_get_pos( sb ) 14998if trace() = 'F' Then say !det.!rh_max_cols !det.!rh_cols current + 1 14999 value = Min( !det.!rh_max_cols - !det.!rh_cols, current + 1 ) 15000 key = 'RIGHT' 15001 End 15002*/ 15003 Otherwise 15004 Do 15005 sb = '' 15006 retcode = 0 15007 End 15008End 15009If sb \= '' Then 15010 Do 15011if trace() = 'F' Then say 'key' key 'sb' sb 'current' current 'value' value 15012 Call dw_scrollbar_set_pos sb, value 15013 End 15014Return retcode 15015 15016/* 15017 * Called when left mouse button pressed on Revision History window 15018 */ 15019RevisionHistoryChangeLogMessageCallback: Procedure Expose !REXXDW. !global. !!last_repository osout. prop. !det. 15020Parse Arg win, x, y, ., file 15021-- disconnect our signal 15022Call dw_signal_disconnect win, !REXXDW.!DW_BUTTON_RELEASE_EVENT 15023-- determine the line in the revision history 15024fileline = !det.!rh_text.firstline + y % !det.!font_height 15025If !det.!rh_type.fileline = 'header' Then 15026 Do 15027 Parse Var !det.!rh_text.fileline rev author state date 15028 save_checkin_text = !global.!checkin_text 15029 text = '' 15030 crlf = '' 15031 Do i = fileline To !det.!rh_text.0 15032 If Strip( !det.!rh_text.i ) = '' Then Leave 15033 If i \= fileline Then 15034 Do 15035 text = text || crlf || !det.!rh_text.i 15036 crlf = !global.!crlf 15037 End 15038 End 15039 !global.!checkin_text = text 15040 Parse Value GetCheckinDetails( 'Y', 'checkin', file, , 'Checkin comments: Rev:' rev 'for' ) With cancel . 15041 If cancel = 'close' Then 15042 Do 15043 !global.!checkin_text = save_checkin_text 15044 End 15045 Else 15046 Do 15047 Select 15048 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 15049 Do 15050 text = EscapeQuotes( !global.!checkin_text ) 15051 If !global.!os \= 'UNIX' Then 15052 Do 15053 text = Changestr( !global.!crlf, text, ' ' ) 15054 End 15055 cmd = 'cvs admin -m'rev':"'text'"' quote( file ) 15056 Call RunOsCommand cmd 15057 Call WriteOutputStemsToLogWindow 'default', 'Modify log comments for' quote( file ) 15058 -- get file properties and display 15059 Call GetCVSFileProperties file 15060 Call DetermineCVSHistoryDetails file 15061 -- Parse revision history output into !det.!rh_text. array 15062 Call GetCVSRevisionHistory 15063 Call DrawRevisionHistory !det.!current_row, !det.!current_col 15064 End 15065 Otherwise Nop 15066 End 15067 End 15068 End 15069-- restore the mouse capture for the render window 15070Call dw_signal_connect win, !REXXDW.!DW_BUTTON_RELEASE_EVENT, 'RevisionHistoryChangeLogMessageCallback', file 15071Return 0 15072 15073RevisionHistoryConfigureCallback: Procedure Expose !REXXDW. !global. !!last_repository osout. prop. !det. 15074Parse Arg win, width, height, data 15075depth = dw_color_depth_get() 15076 15077!det.!rh_rows = height % !det.!font_height 15078!det.!rh_cols = width % !det.!font_width 15079 15080if trace() = 'F' Then say 'got configure' !det.!rh_rows !det.!rh_cols 'MAX' !det.!rh_max_rows !det.!rh_max_cols 15081If !det.!rh_rows > !det.!rh_max_rows Then !det.!rh_max_rows = !det.!rh_rows 15082If !det.!rh_cols > !det.!rh_max_cols Then !det.!rh_max_cols = !det.!rh_cols 15083/* Destroy the old pixmaps */ 15084Call dw_pixmap_destroy !global.!det.!pixmap 15085 15086/* Create new pixmaps with the current sizes */ 15087!global.!det.!pixmap = dw_pixmap_new( !det.!t2, width, height, depth) 15088 15089/* Update scrollbar ranges with new values */ 15090Call dw_scrollbar_set_range !det.!hscrollbar, !det.!rh_max_cols, !det.!rh_cols 15091Call dw_scrollbar_set_range !det.!vscrollbar, !det.!rh_max_rows, !det.!rh_rows 15092 15093/* Redraw the window */ 15094Call DrawRevisionHistory !det.!current_row, !det.!current_col 15095return 1 15096 15097DrawRevisionHistory: Procedure Expose !REXXDW. !global. !!last_repository osout. prop. !det. 15098Parse Arg row, col 15099if trace() = 'F' Then say 'got drawrevisionhistory' 15100Call dw_color_foreground_set !REXXDW.!DW_CLR_WHITE 15101Call dw_draw_rect , !global.!det.!pixmap, !REXXDW.!DW_FILL, 0, 0, dw_pixmap_width(!global.!det.!pixmap), dw_pixmap_height(!global.!det.!pixmap) 15102!det.!rh_text.firstline = row + 1 -- save the line number of the first line in the displayed pixmap 15103Do i = 1 To !det.!rh_rows+1 While (i+row) < !det.!rh_text.0+1 15104 fileline = i + row 15105 /* work out the pixel in y direction where text is to start */ 15106 y = (i-1)*!det.!font_height 15107 /* change the background of the window (by drawing a filled rectangle) */ 15108 Call dw_color_foreground_set !det.!rh_back.fileline 15109 Call dw_draw_rect 0, !global.!det.!pixmap, !REXXDW.!DW_FILL, 0, y, dw_pixmap_width(!global.!det.!pixmap), !det.!font_height 15110 /* set the background colour for drawing the text */ 15111 Call dw_color_background_set !det.!rh_back.fileline 15112 /* set the foreground colour */ 15113 If !det.!rh_type.fileline = 'header' Then 15114 Do 15115 Parse Var !det.!rh_text.fileline rev author state date 15116 x = 0 15117 Call dw_color_foreground_set !REXXDW.!DW_CLR_BLUE 15118 Call dw_draw_text 0, !global.!det.!pixmap, !det.!font_width * x, y, 'Revision: ' 15119 15120 x = x + Length( 'Revision: ' ) 15121 Call dw_color_foreground_set !REXXDW.!DW_CLR_BLACK 15122 Call dw_draw_text 0, !global.!det.!pixmap, !det.!font_width * x, y, rev 15123 15124 x = x + Length( rev ) + 1 15125 Call dw_color_foreground_set !REXXDW.!DW_CLR_BLUE 15126 Call dw_draw_text 0, !global.!det.!pixmap, !det.!font_width * x, y, 'Date: ' 15127 15128 x = x + Length( 'Date: ' ) 15129 Call dw_color_foreground_set !REXXDW.!DW_CLR_BLACK 15130 Call dw_draw_text 0, !global.!det.!pixmap, !det.!font_width * x, y, date 15131 15132 x = x + Length( date ) + 1 15133 Call dw_color_foreground_set !REXXDW.!DW_CLR_BLUE 15134 Call dw_draw_text 0, !global.!det.!pixmap, !det.!font_width * x, y, 'Author: ' 15135 15136 x = x + Length( 'Author: ' ) 15137 Call dw_color_foreground_set !REXXDW.!DW_CLR_BLACK 15138 Call dw_draw_text 0, !global.!det.!pixmap, !det.!font_width * x, y, author 15139 15140 If state = 'dead' Then 15141 Do 15142 x = x + Length( author ) + 1 15143 Call dw_color_foreground_set !REXXDW.!DW_CLR_RED 15144 Call dw_draw_text 0, !global.!det.!pixmap, !det.!font_width * x, y, '*** Dead Revision ***' 15145 End 15146 End 15147 Else 15148 Do 15149 Call dw_color_foreground_set !REXXDW.!DW_CLR_BLACK 15150 Call dw_draw_text 0, !global.!det.!pixmap, 0, y, Substr( !det.!rh_text.fileline , col+1 ) 15151 End 15152End 15153Call RevisionHistoryExposeCallback !det.!t2 15154Return 15155 15156 15157FindSyntax: Procedure Expose !REXXDW. !global. !!last_repository 15158Parse Arg ext 15159If Left( !global.!syntax.0, 1 ) \= '!' Then 15160 Do 15161 Do i = 1 To !global.!extension.0 15162 If Wordpos( ext, !global.!extension.i ) \= 0 Then Return !global.!syntax.i 15163 End 15164 End 15165Return '' 15166 15167GetHighlightedLines: Procedure Expose !REXXDW. !global. !!last_repository 15168Parse Arg fn, syntax_flags, line_stem 15169If Left( !global.!!user.!!style, 1 ) = '!' | !global.!!user.!!style = '' Then style = '' 15170Else style = '-s' !global.!!user.!!style 15171If Left( !global.!!user.!!preference.!!tabspaces, 1 ) = '!' | !global.!!user.!!preference.!!tabspaces = 0 Then tabspaces_flag = '' 15172Else tabspaces_flag = '-t' !global.!!user.!!preference.!!tabspaces 15173--Say .line 'highlight' !global.!datadir '-l -I' syntax_flags style tabspaces_flag '-i' fn 15174Address System 'highlight' !global.!datadir '-l -I' syntax_flags style tabspaces_flag '-i' fn With Output Stem high. Error Stem junk. 15175If rc \= 0 Then Return !REXXDW.!DW_CLR_BLACK !REXXDW.!DW_CLR_WHITE 15176 15177if trace() = 'F' Then say 'got' high.0 'lines from highlight' 'with' junk.0 'errors' 15178/* 15179 * Clean up the formatting, so that each line starts with <span><span class="line"> 15180 * and each line ends with </span> 15181 */ 15182classes = '' 15183state = 'head' 15184Do i = 1 To high.0 15185 Select 15186 When Strip( high.i ) = '' Then Nop /* ignore blank lines */ 15187 When Left( high.i, 5 ) = '<pre ' Then 15188 Do 15189 state = 'file' 15190 /* remove the <pre> tag */ 15191 Parse Var high.i . '>' high.i 15192 i = i - 1 15193 End 15194 When state = 'head' Then 15195 Do 15196 Select 15197 When Word( high.i, 1 ) = 'pre.hl' Then 15198 Do 15199 Parse Var high.i . 'color:#' default_fore ';' . 'background-color:#' default_back ';' . 15200 End 15201 When Left( Word( high.i, 1 ), 1 ) = '.' Then 15202 Do 15203 Parse Var high.i '.hl.' class '{' . 'color:#' class_color ';' fontstuff '}' . 15204 class = Strip( Strip( class ), 'B', ' ' ) 15205 classes = classes class 15206 If class_color = '' Then class_color = default_fore 15207 redx = Substr( class_color, 1, 2 ) 15208 greenx = Substr( class_color, 3, 2 ) 15209 bluex = Substr( class_color, 5, 2 ) 15210 !global.!syntax.!color.class = dw_rgb( x2d( redx), x2d( greenx ), x2d( bluex ) ) 15211 Select 15212 When Countstr( 'bold', fontstuff ) \= 0 & Countstr( 'italic', fontstuff ) \= 0 Then !global.!syntax.!font.class = !global.!bolditalicfont 15213 When Countstr( 'bold', fontstuff ) \= 0 Then !global.!syntax.!font.class = !global.!boldfont 15214 When Countstr( 'italic', fontstuff ) \= 0 Then !global.!syntax.!font.class = !global.!italicfont 15215 Otherwise !global.!syntax.!font.class = !global.!fixedfont 15216 End 15217if trace() = 'F' Then say x2d(redx) x2d(greenx) x2d(bluex) !global.!syntax.!color.class 15218 End 15219 Otherwise Nop 15220 End 15221 End 15222 When state = 'file' Then 15223 Do 15224 If Left( high.i, 6 ) = '</pre>' Then Leave 15225/* 15226 If Right( high.i, 7 ) \= '</span>' Then 15227 Do 15228 next = i + 1 15229 If Left( high.next, 7 ) = '</span>' Then 15230 Do 15231 high.i = high.i'</span>' 15232 high.next = Substr( high.next, 8 ) 15233 End 15234 End 15235*/ 15236 /* 15237 * Parse Line number out of line 15238 */ 15239 Parse Var high.i . 'class="hl line">' lno '</span>' line 15240 lno = Strip( lno ) 15241 /* 15242 * Remove any spaning code that doesn't change any characters 15243 */ 15244 Do j = 1 To Words( classes ) 15245 class = Word( classes, j ) 15246 line = Changestr( '<span class="'class'"></span>', line, '' ) 15247 End 15248 fn.lno = line 15249 fn.0 = lno 15250 End 15251 Otherwise Nop 15252 End 15253End 15254Do i = 1 To Words( classes ) 15255 class = Word( classes, i ) 15256if trace() = 'F' Then Say 'color for' class 'is' !global.!syntax.!color.class 15257if trace() = 'F' Then Say 'font for' class 'is' !global.!syntax.!font.class 15258End 15259 15260/* 15261 * Calculate the default foreground color... 15262 */ 15263redx = Substr( default_fore, 1, 2 ) 15264greenx = Substr( default_fore, 3, 2 ) 15265bluex = Substr( default_fore, 5, 2 ) 15266default_fore = dw_rgb( x2d( redx), x2d( greenx ), x2d( bluex ) ) 15267/* 15268 * Calculate the default background color... 15269 */ 15270redx = Substr( default_back, 1, 2 ) 15271greenx = Substr( default_back, 3, 2 ) 15272bluex = Substr( default_back, 5, 2 ) 15273default_back = dw_rgb( x2d( redx), x2d( greenx ), x2d( bluex ) ) 15274if trace() = 'F' Then say 'default' default_fore default_back 15275Call SysStemCopy 'fn.', line_stem 15276Drop fn. 15277Return default_fore default_back 15278 15279ConvertHTMLMnemonics: Procedure 15280Parse Arg fragment 15281fragment = Changestr( '<', fragment, '<' ) 15282fragment = Changestr( '>', fragment, '>' ) 15283fragment = Changestr( '&', fragment, '&' ) 15284fragment = Changestr( '"', fragment, '"' ) 15285str = fragment 15286Do Forever 15287 Parse Var str . '&#' num ';' str 15288 If Datatype( num ) = 'NUM' Then 15289 Do 15290 char = D2c( num ) 15291 fragment = Changestr( '&#'num';', fragment, char ) 15292 End 15293 If Strip( str ) = '' Then Leave 15294End 15295Return fragment 15296 15297ConvertToHTMLMnemonics: Procedure 15298Parse Arg fragment 15299fragment = Changestr( '&', fragment, '&' ) 15300fragment = Changestr( '<', fragment, '<' ) 15301fragment = Changestr( '>', fragment, '>' ) 15302fragment = Changestr( '"', fragment, '"' ) 15303Return fragment 15304 15305BackSlashEscape: Procedure 15306Parse Arg str 15307Return Changestr( '\', str, '\\' ) 15308 15309FindWorkingDir: Procedure Expose !REXXDW. !global. !!last_repository 15310Parse Arg workingdir 15311If Left( !global.!!number_repositories, 1 ) = '!' Then Return 0 15312workingdir = WorkingDirToInternal( workingdir ) 15313Do i = 1 To !global.!!number_repositories 15314 If WorkingDirToInternal( !global.!!repository.!!working_dir.i ) = workingdir Then Return i 15315End 15316Return 0 15317 15318WorkingDirToInternal: Procedure Expose !REXXDW. !global. !!last_repository 15319Parse Arg workingdir 15320wd = Changestr( !global.!ossep, workingdir, '/' ) 15321wd = lower( wd ) 15322If Right( wd, 1 ) \= '/' Then wd = wd'/' 15323Return wd 15324 15325FindMakeCommand: Procedure Expose !REXXDW. !global. !!last_repository 15326Parse Arg dir 15327this_dir = DirToVariable( dir ) 15328pos = Wordpos( !global.!os, !global.!platforms ) 15329If pos = 0 | Left( !global.!dir.!makecommand.this_dir.pos, 1 ) = '!' Then Return '' 15330Return !global.!dir.!makecommand.this_dir.pos 15331 15332FindDebugMakeCommand: Procedure Expose !REXXDW. !global. !!last_repository 15333Parse Arg dir 15334this_dir = DirToVariable( dir ) 15335pos = Wordpos( !global.!os, !global.!platforms ) 15336If pos = 0 | Left( !global.!dir.!debugmakecommand.this_dir.pos, 1 ) = '!' Then Return '' 15337Return !global.!dir.!debugmakecommand.this_dir.pos 15338 15339FindCustomMakeCommand: Procedure Expose !REXXDW. !global. !!last_repository 15340Parse Arg dir 15341this_dir = DirToVariable( dir ) 15342pos = Wordpos( !global.!os, !global.!platforms ) 15343If pos = 0 | Left( !global.!dir.!custommakecommand.this_dir.pos, 1 ) = '!' Then Return '' 15344Return !global.!dir.!custommakecommand.this_dir.pos 15345 15346FindBuildCommand: Procedure Expose !REXXDW. !global. !!last_repository 15347Parse Arg dir 15348this_dir = DirToVariable( dir ) 15349pos = Wordpos( !global.!os, !global.!platforms ) 15350If pos = 0 | Left( !global.!dir.!buildcommand.this_dir.pos, 1 ) = '!' Then Return '' 15351Return !global.!dir.!buildcommand.this_dir.pos 15352 15353FindDebugBuildCommand: Procedure Expose !REXXDW. !global. !!last_repository 15354Parse Arg dir 15355this_dir = DirToVariable( dir ) 15356pos = Wordpos( !global.!os, !global.!platforms ) 15357If pos = 0 | Left( !global.!dir.!debugbuildcommand.this_dir.pos, 1 ) = '!' Then Return '' 15358Return !global.!dir.!debugbuildcommand.this_dir.pos 15359 15360FindCustomBuildCommand: Procedure Expose !REXXDW. !global. !!last_repository 15361Parse Arg dir 15362this_dir = DirToVariable( dir ) 15363pos = Wordpos( !global.!os, !global.!platforms ) 15364If pos = 0 | Left( !global.!dir.!custombuildcommand.this_dir.pos, 1 ) = '!' Then Return '' 15365Return !global.!dir.!custombuildcommand.this_dir.pos 15366 15367FindPromoteCommand: Procedure Expose !REXXDW. !global. !!last_repository 15368Parse Arg dir 15369this_dir = DirToVariable( dir ) 15370pos = Wordpos( !global.!os, !global.!platforms ) 15371If pos = 0 | Left( !global.!dir.!promotecommand.this_dir.pos, 1 ) = '!' Then Return '' 15372Return !global.!dir.!promotecommand.this_dir.pos 15373 15374FindCompilerType: Procedure Expose !REXXDW. !global. !!last_repository 15375Parse Arg dir 15376this_dir = DirToVariable( dir ) 15377pos = Wordpos( !global.!os, !global.!platforms ) 15378If pos = 0 | Left( !global.!dir.!compiler.this_dir.pos, 1 ) = '!' Then Return '' 15379Return !global.!dir.!compiler.this_dir.pos 15380 15381FindMakeDirectory: Procedure Expose !REXXDW. !global. !!last_repository 15382Parse Arg dir 15383this_dir = DirToVariable( dir ) 15384pos = Wordpos( !global.!os, !global.!platforms ) 15385If pos = 0 | Left( !global.!dir.!makedirectory.this_dir.pos, 1 ) = '!' Then Return '' 15386Return !global.!dir.!makedirectory.this_dir.pos 15387 15388FindPromoteDirectory: Procedure Expose !REXXDW. !global. !!last_repository 15389Parse Arg dir 15390this_dir = DirToVariable( dir ) 15391pos = Wordpos( !global.!os, !global.!platforms ) 15392If pos = 0 | Left( !global.!dir.!promotedirectory.this_dir.pos, 1 ) = '!' Then Return '' 15393Return !global.!dir.!promotedirectory.this_dir.pos 15394 15395FindNativeMakeDirectory: Procedure Expose !REXXDW. !global. !!last_repository 15396Parse Arg dir 15397makedir = FindMakeDirectory( dir ) 15398If makedir = '.' Then makedir = '' 15399Else makedir = '/'makedir 15400native_make_dir = Changestr( '/', !global.!!repository.!!working_dir.!!last_repository || dir || makedir, !global.!ossep ) 15401Return native_make_dir 15402 15403FindNativeBuildDirectory: Procedure Expose !REXXDW. !global. !!last_repository 15404Parse Arg dir, lab 15405native_working_dir = Changestr( '/', !global.!!repository.!!working_dir.!!last_repository, !global.!ossep ) 15406build_dir = native_working_dir || !global.!builddir || !global.!ossep || Changestr( '/', dir, !global.!ossep ) || !global.!ossep || lab 15407Return build_dir 15408 15409FindNativePromoteDirectory: Procedure Expose !REXXDW. !global. !!last_repository 15410Parse Arg dir, lab 15411native_working_dir = Changestr( '/', !global.!!repository.!!working_dir.!!last_repository, !global.!ossep ) 15412promote_dir = native_working_dir || !global.!builddir || !global.!ossep || Changestr( '/', dir, !global.!ossep ) || !global.!ossep || lab 15413Return promote_dir 15414 15415FindNativeLogDirectory: Procedure Expose !REXXDW. !global. !!last_repository 15416Return Changestr( '/', !global.!!repository.!!working_dir.!!last_repository||!global.!logdir, !global.!ossep ) 15417 15418FindEmailCommand: Procedure Expose !REXXDW. !global. !!last_repository 15419Parse Arg dir 15420this_dir = DirToVariable( dir ) 15421pos = Wordpos( !global.!os, !global.!platforms ) 15422If pos = 0 | Left( !global.!dir.!emailer.this_dir.pos, 1 ) = '!' Then Return '' 15423Return !global.!dir.!emailer.this_dir.pos 15424 15425ValidLabel: Procedure Expose !REXXDW. !global. !!last_repository 15426Parse Arg lab 15427/* 15428 * Can't use 'Working' or 'Latest' 15429 */ 15430If lab = 'Working' | lab = 'Latest' Then Return 0 "You cannot use 'Latest' or 'Working' as labels. Please use another value." 15431Select 15432 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 15433 Do 15434 /* 15435 * CVS labels can't have '$,.:;@' in them 15436 */ 15437 test_lab = Translate( lab, '######', '$,.:;@' ) 15438 If lab \= test_lab Then Return 0 'The label supplied:' lab 'must not contain special characters: "$,.:;@"' 15439 End 15440 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 15441 Do 15442 End 15443 Otherwise Nop 15444End 15445Return 1 15446 15447/* 15448 * Called when the user first starts QOCCA and they don't have a repository, 15449 * or when they want to add another repository to their accessable list 15450 */ 15451GetNewRepository: Procedure Expose !REXXDW. !global. !!last_repository 15452win = dw_window_new( !REXXDW.!DW_DESKTOP, 'Open Repository', !global.!windowstyle ) 15453/* 15454 * We have to create the window icon here because the main window may not have 15455 * been created yet. 15456 */ 15457qoccaicon = dw_icon_load_from_file( !global.!icondir'qocca' ) 15458Call dw_window_set_icon win, qoccaicon 15459topbox = dw_box_new( !REXXDW.!DW_VERT ) 15460Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 15461/* 15462 * Groupbox for radio buttons 15463 */ 15464g1 = dw_groupbox_new( !REXXDW.!DW_VERT, 'Select Repository Type', !REXXDW.!DW_FONT_BOLD ) 15465Call dw_box_pack_start topbox, g1, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 15466/* 15467 * radio buttons 15468 */ 15469reptype_rb1 = dw_radiobutton_new( 'CVS (Concurrent Versions System)', 111 ) 15470Call dw_box_pack_start g1, reptype_rb1, 200, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 15471reptype_rb2 = dw_radiobutton_new( 'RCS (Revision Control System)', 222 ) 15472Call dw_box_pack_start g1, reptype_rb2, 200, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 15473reptype_rb3 = dw_radiobutton_new( 'HG (Mercurial)', 333 ) 15474Call dw_box_pack_start g1, reptype_rb3, 200, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 15475reptype_rbx = dw_radiobutton_new( 'Select from file...', 444 ) 15476Call dw_box_pack_start g1, reptype_rbx, 200, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 15477Call dw_radiobutton_set reptype_rbx, !REXXDW.!DW_CHECKED 15478/* 15479 * Add Browse button and entry 15480 */ 15481filebox = dw_box_new( !REXXDW.!DW_HORZ ) 15482Call dw_box_pack_start topbox, filebox, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 2 15483file_entry = dw_entryfield_new( "", 0 ) 15484Call dw_box_pack_start filebox, file_entry, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15485abutton = dw_bitmapbutton_new_from_file( "Browse...", 0, !global.!icondir||'modulecheckedout' ) 15486Call dw_box_pack_start filebox, abutton, 25, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15487Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericFileSelector', file_entry, 'Select Repository file:', '', 0, !REXXDW.!DW_FILE_OPEN, 'repository' 15488/* 15489 * Create a dialog for the window 15490 */ 15491dialog_wait = dw_dialog_new( ) 15492/* 15493 * Create Cancel and Apply buttons 15494 */ 15495b1 = dw_button_new( 'Apply', 0 ) 15496Call dw_box_pack_start topbox, b1, 200, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15497Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GetNewRepositoryApplyCallback', win, dialog_wait, file_entry, reptype_rb1, reptype_rb2, reptype_rb3, reptype_rbx 15498b2 = dw_button_new( 'Cancel', 0 ) 15499Call dw_box_pack_start topbox, b2, 200, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15500Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 15501/* 15502 * We now have everything setup, we can connect the destroying of the top-level window 15503 * to the 'close' callback 15504 */ 15505Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 15506/* 15507 * Display the window 15508 */ 15509width = 240 15510height = 260 /* text_height + cb_height + 80 */ 15511Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 15512Call dw_window_show win 15513 Call dw_main_sleep 10 15514/* 15515 * Wait for the dialog to come back 15516 */ 15517Parse Value dw_dialog_wait( dialog_wait ) With res type fn 15518/* 15519 * If we are to close, go back now 15520 */ 15521If res = 'close' Then Return res 15522/* 15523 * If it is a file selection, pre-process the file and then continue with a normal 15524 * type selection... 15525 */ 15526If type = 'file' Then 15527 Do 15528 /* 15529 * Check the file is valid, then read the contents and set variables 15530 * as appropriate 15531 */ 15532 If Stream( fn, 'C', 'QUERY EXISTS' ) = '' Then 15533 Do 15534 Call dw_messagebox 'Invalid file', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), 'File selected does not exist.' 15535 Return 'close' 15536 End 15537 Call Stream fn, 'C', 'OPEN READ' 15538 If Charin( fn, 1, 2 ) \= '!!' Then 15539 Do 15540 Call dw_messagebox 'Invalid file', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), 'File does not contain valid QOCCA repository settings.' 15541 Call Stream fn, 'C', 'CLOSE' 15542 Return 'close' 15543 End 15544 Call Stream fn, 'C', 'CLOSE' 15545 /* 15546 * Set repno to 1 + last repository 15547 */ 15548 !global.!!number_repositories = !global.!!number_repositories + 1 15549 repno = !global.!!number_repositories 15550 Call Stream fn, 'C', 'OPEN READ' 15551 Do While Lines( fn ) > 0 15552 Parse Value Linein(fn) With key '=' value 15553 If key \= '' Then 15554 Do 15555 If Left( value, 8 ) = '"!GLOBAL.' Then value = '' 15556 a = Value( key )'.'Value( repno ) 15557 Interpret '!GLOBAL'.a '=' value 15558 End 15559 End 15560 Call Stream fn, 'C', 'CLOSE' 15561 /* 15562 * Now set the repository type 15563 */ 15564 type = !global.!!repository.!!type.repno 15565 End 15566Else repno = 0 15567Select 15568 When type = 'rcs' Then res = GetRCSRepository( 'Y', repno ) 15569 When type = 'cvs' Then res = GetCVSRepository( 'Y', repno ) 15570 When type = 'hg' Then res = GetHGRepository( 'Y', repno ) 15571 Otherwise Nop 15572End 15573If res \= 'close' Then Call WriteUserSettingsFile 15574Return res 15575 15576GetNewRepositoryApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 15577Parse Arg button, window, dialog, file_entry, reptype_rb1, reptype_rb2, reptype_rb3, reptype_rbx 15578fn = '' 15579Select 15580 When dw_radiobutton_get( reptype_rb1 ) Then type = 'cvs' 15581 When dw_radiobutton_get( reptype_rb2 ) Then type = 'rcs' 15582 When dw_radiobutton_get( reptype_rb3 ) Then type = 'hg' 15583 When dw_radiobutton_get( reptype_rbx ) Then 15584 Do 15585 type = 'file' 15586 fn = Strip( dw_window_get_text( file_entry ) ) 15587 End 15588 Otherwise type = '' 15589End 15590Call dw_window_destroy window 15591Call dw_dialog_dismiss dialog, 'apply' type fn 15592Return 0 15593 15594/* 15595 * Called when the user is adding a new repository to their available list 15596 * and when displaying repository properties. 15597 */ 15598GetCVSRepository: Procedure Expose !REXXDW. !global. !!last_repository 15599Parse Arg newrep, repno 15600/* 15601 * For CVS repositories, display: 15602 * 15603 * +----------------------------------------------------------+ 15604 * | Text | 15605 * | | 15606 * +----------------------------------------------------------+ 15607 * | Edit Repository Settings | 15608 * +----------------------------------------------------------+ 15609 * | o Local | 15610 * | o CVS Password Server | 15611 * | o RSH Authentication | 15612 * | o SSH Authentication | 15613 * | | 15614 * | Name: ___________________________ | 15615 * | Server: ___________________________ | 15616 * | Port: ___________________________ | 15617 * | Path: ___________________________ | 15618 * | User: ___________________________ | 15619 * | Password: ___________________________ | 15620 * | Public CVS: x | 15621 * | Enhanced CVS: x | 15622 * | Working Dir: ___________________________ Browse... | 15623 * +----------------------------------------------------------+ 15624 */ 15625cvstype.1 = 'Local repository' 15626cvstype.2 = 'CVS Password Server' 15627cvstype.3 = 'RSH Authentication' 15628cvstype.4 = 'SSH Authentication' 15629!global.!getcvsrepository.?title.1 = 'Repository Name:' ; !global.!getcvsrepository.?type.1 = '' 15630!global.!getcvsrepository.?title.2 = 'Server:' ; !global.!getcvsrepository.?type.2 = '' 15631!global.!getcvsrepository.?title.3 = 'Port:' ; !global.!getcvsrepository.?type.3 = '' 15632!global.!getcvsrepository.?title.4 = 'Path:' ; !global.!getcvsrepository.?type.4 = '' 15633!global.!getcvsrepository.?title.5 = 'User:' ; !global.!getcvsrepository.?type.5 = '' 15634!global.!getcvsrepository.?title.6 = 'Password:' ; !global.!getcvsrepository.?type.6 = 'password' 15635!global.!getcvsrepository.?title.7 = 'Public CVS:' ; !global.!getcvsrepository.?type.7 = 'check' 15636!global.!getcvsrepository.?title.8 = 'Enhanced CVS:' ; !global.!getcvsrepository.?type.8 = 'check' 15637!global.!getcvsrepository.?title.9 = 'CVS Compression:' ; !global.!getcvsrepository.?type.9 = '' 15638!global.!getcvsrepository.?title.10 = 'Public CVS Modules:' ; !global.!getcvsrepository.?type.10 = '' 15639!global.!getcvsrepository.?title.12 = 'Working Dir:' ; !global.!getcvsrepository.?type.12 = 'dirbrowse(Select Working Directory)' 15640!global.!getcvsrepository.?title.0 = 12 15641If repno = 0 Then 15642 Do 15643 default. = '' 15644 default.0 = 1 15645 End 15646Else 15647 Do 15648 default.1 = !global.!!repository.!!name.repno 15649 default.2 = !global.!!repository.!!server.repno 15650 default.3 = !global.!!repository.!!cvsport.repno 15651 default.4 = !global.!!repository.!!shortpath.repno 15652 default.5 = !global.!!repository.!!username.repno 15653 default.6 = !global.!!repository.!!password.repno 15654 default.7 = !global.!!repository.!!public_cvs.repno 15655 default.8 = !global.!!repository.!!enhanced_cvs.repno 15656 default.9 = !global.!!repository.!!cvs_compression.repno 15657 default.10 = !global.!!repository.!!public_cvs_dirs.repno 15658 default.12 = !global.!!repository.!!working_dir.repno 15659 Do i = 1 To !global.!getcvsrepository.?title.0 15660 If Left( default.i, 1 ) = '!' Then default.i = '' 15661 End 15662 End 15663 15664win = dw_window_new( !REXXDW.!DW_DESKTOP, 'CVS Repository Details', !global.!windowstyle ) 15665/* 15666 * We have to create the window icon here because the main window may not have 15667 * been created yet. 15668 */ 15669qoccaicon = dw_icon_load_from_file( !global.!icondir'qocca' ) 15670Call dw_window_set_icon win, qoccaicon 15671topbox = dw_box_new( !REXXDW.!DW_VERT ) 15672Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 15673/* 15674 * MLE for entry instructions 15675 */ 15676t1 = dw_mle_new( 0 ) 15677Call dw_box_pack_start topbox, t1, 400, 50, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 15678Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 15679inst = 'Select the type of CVS authentication you will be using, the server that contains the repository, the full path to the repository on that server, and the username used to connect.' 15680Call dw_mle_import t1, inst, -1 15681Call dw_window_disable t1 15682/* 15683 * Groupbox for radio buttons 15684 */ 15685g1 = dw_groupbox_new( !REXXDW.!DW_VERT, 'Select CVS Connection Method', !REXXDW.!DW_FONT_BOLD ) 15686Call dw_box_pack_start topbox, g1, 120, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 15687/* 15688 * radio buttons 15689 */ 15690Do i = 1 To 4 15691 cvstype_rb.i = dw_radiobutton_new( cvstype.i, 100*i ) 15692 Call dw_box_pack_start g1, cvstype_rb.i, 100, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 2 15693End 15694If repno = 0 Then idx = 1 15695Else idx = Wordpos( !global.!!repository.!!contype.repno, !global.!validcvstypes ) 15696Call dw_radiobutton_set cvstype_rb.idx, !REXXDW.!DW_CHECKED 15697/* 15698 * If we are an administrator for this repository, add a button to enable 15699 * editing of the repository (only if not adding a repository) 15700 */ 15701If !global.!administrator.!!last_repository = 'Y' & newrep \= 'Y' Then 15702 Do 15703 b1 = dw_button_new( 'Edit Repository Settings', 0 ) 15704 Call dw_box_pack_start topbox, b1, 200, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15705 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'RepositorySettingsCallback' 15706 End 15707/* 15708 * Now the individual entry fields 15709 */ 15710Do i = 1 To !global.!getcvsrepository.?title.0 15711 box = dw_box_new( !REXXDW.!DW_HORZ ) 15712 Call dw_box_pack_start topbox, box, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 15713 !global.!getcvsrepository.?text.i = dw_text_new( !global.!getcvsrepository.?title.i, i ) 15714 Call dw_box_pack_start box, !global.!getcvsrepository.?text.i, 120, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15715 Call dw_window_set_style !global.!getcvsrepository.?text.i, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 15716 Select 15717 When !global.!getcvsrepository.?type.i = 'password' Then 15718 Do 15719 !global.!getcvsrepository.?entry.i = dw_entryfield_password_new( default.i, 0 ) 15720 End 15721 When !global.!getcvsrepository.?type.i = 'check' Then 15722 Do 15723 !global.!getcvsrepository.?entry.i = dw_checkbox_new( '', 0 ) 15724 If default.i = 'Y' Then Call dw_checkbox_set !global.!getcvsrepository.?entry.i, !REXXDW.!DW_CHECKED 15725 Else Call dw_checkbox_set !global.!getcvsrepository.?entry.i, !REXXDW.!DW_UNCHECKED 15726 End 15727 Otherwise 15728 Do 15729 !global.!getcvsrepository.?entry.i = dw_entryfield_new( default.i, 0 ) 15730 End 15731 End 15732 Call dw_box_pack_start box, !global.!getcvsrepository.?entry.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15733 /* 15734 * If browse button required... 15735 */ 15736 If Left( !global.!getcvsrepository.?type.i, 9 ) = 'dirbrowse' Then 15737 Do 15738 Parse Var !global.!getcvsrepository.?type.i . '(' title ')' 15739 abutton = dw_bitmapbutton_new_from_file( title, 0, !global.!icondir||'modulecheckedout' ) 15740 Call dw_box_pack_start box, abutton, 25, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15741 Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericDirectorySelector', !global.!getcvsrepository.?entry.i, title':' 15742 End 15743End 15744/* 15745 * Set the default field to put the cursor in to start with 15746 */ 15747If repno = 0 | newrep \= 'Y' Then default_idx = 1 15748Else default_idx = 5 15749Call dw_window_default win, !global.!getcvsrepository.?entry.default_idx 15750/* 15751 * Create Cancel and Apply buttons 15752 */ 15753b1 = dw_button_new( 'Apply', 0 ) 15754Call dw_box_pack_start topbox, b1, 200, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15755b2 = dw_button_new( 'Cancel', 0 ) 15756Call dw_box_pack_start topbox, b2, 200, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 15757/* 15758 * Display the window 15759 */ 15760width = 425 15761height = 600 /* text_height + cb_height + 80 */ 15762Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 15763Call dw_window_show win 15764 Call dw_main_sleep 10 15765 15766Do Forever 15767 /* 15768 * Create a dialog for the window 15769 */ 15770 dialog_wait = dw_dialog_new( ) 15771 /* 15772 * We now have everything setup, we can connect the destroying of the top-level window 15773 * to the 'close' callback 15774 */ 15775 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GetCVSRepositoryApplyCallback', win, dialog_wait, newrep, repno, cvstype_rb.1, cvstype_rb.2, cvstype_rb.3, cvstype_rb.4 15776 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 15777 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 15778 /* 15779 * Wait for the dialog to come back 15780 */ 15781 cancel = dw_dialog_wait( dialog_wait ) 15782 /* 15783 * All successful processing done in the 'applycallback', so simply get 15784 * out of the loop if we don't have any validation issues 15785 */ 15786 If cancel \= 'retry' Then Leave 15787End 15788Return cancel 15789 15790GetCVSRepositoryApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 15791Parse Arg button, window, dialog, newrep, repno, cvstype_rb1, cvstype_rb2, cvstype_rb3, cvstype_rb4 15792Select 15793 When dw_radiobutton_get( cvstype_rb1 ) Then contype = Word( !global.!validcvstypes, 1 ) 15794 When dw_radiobutton_get( cvstype_rb2 ) Then contype = Word( !global.!validcvstypes, 2 ) 15795 When dw_radiobutton_get( cvstype_rb3 ) Then contype = Word( !global.!validcvstypes, 3 ) 15796 When dw_radiobutton_get( cvstype_rb4 ) Then contype = Word( !global.!validcvstypes, 4 ) 15797 Otherwise type = '' 15798End 15799/* 15800 * Get the contents of the entry fields 15801 */ 15802name = Strip( dw_window_get_text( !global.!getcvsrepository.?entry.1 ) ) 15803server = Strip( dw_window_get_text( !global.!getcvsrepository.?entry.2 ) ) 15804port = Strip( dw_window_get_text( !global.!getcvsrepository.?entry.3 ) ) 15805path = Strip( dw_window_get_text( !global.!getcvsrepository.?entry.4 ) ) 15806user = Strip( dw_window_get_text( !global.!getcvsrepository.?entry.5 ) ) 15807password = Strip( dw_window_get_text( !global.!getcvsrepository.?entry.6 ) ) 15808If dw_checkbox_get( !global.!getcvsrepository.?entry.7 ) Then public_cvs = 'Y' 15809Else public_cvs = 'N' 15810If dw_checkbox_get( !global.!getcvsrepository.?entry.8 ) Then enhanced_cvs = 'Y' 15811Else enhanced_cvs = 'N' 15812cvs_compression = Strip( dw_window_get_text( !global.!getcvsrepository.?entry.9 ) ) 15813public_cvs_dirs = Strip( dw_window_get_text( !global.!getcvsrepository.?entry.10 ) ) 15814working_dir = Strip( dw_window_get_text( !global.!getcvsrepository.?entry.12 ) ) 15815/* 15816 * Validate that all mandatory fields are supplied 15817 * x means not required, o means required 15818 * contype name server path user password working_dir 15819 * local o x o x x o 15820 * pserver o o o o o o 15821 * rsh o o o o x o 15822 * ssh o o o o x o 15823 */ 15824t_working_dir = Strip( Strip( Changestr( !global.!ossep, working_dir, '/' ) ), 'T', '/' ) 15825Select 15826 When Words( name ) \= 1 Then 15827 Do 15828 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Name field is empty or contains spaces. Please re-enter.' 15829 Call dw_dialog_dismiss dialog, 'retry' 15830 Return 0 15831 End 15832 When type = '' Then 15833 Do 15834 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'No CVS connection type selected. Please re-enter.' 15835 Call dw_dialog_dismiss dialog, 'retry' 15836 Return 0 15837 End 15838 When server = '' & contype \= 'local' Then 15839 Do 15840 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Server field is empty. Please re-enter.' 15841 Call dw_dialog_dismiss dialog, 'retry' 15842 Return 0 15843 End 15844 When path = '' Then 15845 Do 15846 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Path field is empty. Please re-enter.' 15847 Call dw_dialog_dismiss dialog, 'retry' 15848 Return 0 15849 End 15850 When user = '' & contype \= 'local' Then 15851 Do 15852 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'User field is empty. Please re-enter.' 15853 Call dw_dialog_dismiss dialog, 'retry' 15854 Return 0 15855 End 15856 When password = '' & contype = 'pserver' Then 15857 Do 15858 If dw_messagebox( 'Invalid entry', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_WARNING ), 'Password field is empty. Continue with blank password?' ) = !REXXDW.!DW_MB_RETURN_NO Then 15859 Do 15860 Call dw_dialog_dismiss dialog, 'retry' 15861 Return 0 15862 End 15863 End 15864 When working_dir = '' Then 15865 Do 15866 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Working Dir is empty please re-enter.' 15867 Call dw_dialog_dismiss dialog, 'retry' 15868 Return 0 15869 End 15870 When Stream( t_working_dir, C, 'QUERY EXISTS' ) \= '' & Word( Stream( t_working_dir, 'C', 'FSTAT' ), 8 ) \= 'Directory' Then 15871 Do 15872 /* 15873 * Stream exists, but its not a directory 15874 */ 15875 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Working Dir specified is not a directory. Please re-enter.' 15876 Call dw_dialog_dismiss dialog, 'retry' 15877 Return 0 15878 End 15879 When Stream( t_working_dir, C, 'QUERY EXISTS' ) = '' Then 15880 Do 15881 /* 15882 * Stream doesn't exist 15883 */ 15884 If dw_messagebox( 'Invalid entry', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_WARNING ), 'Working Dir specified does not exist. Do you want to create it?' ) = !REXXDW.!DW_MB_RETURN_NO Then 15885 Do 15886 Call dw_dialog_dismiss dialog, 'retry' 15887 Return 0 15888 End 15889 End 15890 Otherwise Nop 15891End 15892/* 15893 * Validate that name and working_dir are unique 15894 */ 15895working_dir = WorkingDirToInternal( working_dir ) 15896If Left( !global.!!number_repositories, 1 ) \= '!' & newrep = 'Y' Then 15897 Do 15898 foundrep = FindRepository( name ) 15899 If foundrep \= 0 & foundrep \= repno Then 15900 Do 15901 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Name is already used. Please re-enter.' 15902 Call dw_dialog_dismiss dialog, 'retry' 15903 Return 0 15904 End 15905 foundwd = FindWorkingDir( working_dir ) 15906 If foundwd \= 0 & foundwd \= repno Then 15907 Do 15908 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Working Dir is already used. Please re-enter.' 15909 Call dw_dialog_dismiss dialog, 'retry' 15910 Return 0 15911 End 15912 End 15913/* 15914 * Validate cvsport if supplied 15915 */ 15916If port = '' | Left( port, 1 ) = '!' Then port = 2401 15917/* 15918 * If CVS pserver, we need to Call 'cvs login' to save the password 15919 * The method employed below allows 'cvs login' to take the password 15920 * from an environment variable rather than prompting the user. 15921 */ 15922If contype = 'pserver' Then 15923 Do 15924 fullpath = ':pserver:'user'@'server':'path 15925 Call Value 'CVS_PASS', password, 'ENVIRONMENT' 15926 Call Value 'CVS_PORT', port, 'ENVIRONMENT' 15927 rcode = RunOsCommand( 'cvs' '-d' quote( fullpath ) 'login' ) 15928 Call Value 'CVS_PASS', '', 'ENVIRONMENT' 15929 Call Value 'CVS_PORT', '', 'ENVIRONMENT' 15930 If rcode \= 0 Then 15931 Do 15932 If !global.!mainwindow = '' Then Call WriteOutputStemsToConsole 'default', 'Results of cvs login to' fullpath 15933 Else Call WriteOutputStemsToLogWindow 'default', 'Results of cvs login to' fullpath 15934 /* 15935 * Got an error logging in. Display a message box and 15936 * ask for the password again. 15937 */ 15938 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Invalid password. Please re-enter.' 15939 Call dw_dialog_dismiss dialog, 'retry' 15940 Return 0 15941 End 15942 End 15943/* 15944 * All validation done now, so add the new repository 15945 */ 15946/* 15947 * Create the working directory if it doesn't exist 15948 */ 15949Call CreateDirectory Translate( working_dir, '/', !global.!ossep ) 15950 15951if trace() = 'F' Then say contype name server user path password working_dir 15952 15953If repno = 0 Then 15954 Do 15955 If !global.!!number_repositories = 0 | Left( !global.!!number_repositories, 1 ) = '!' Then !global.!!number_repositories = 1 15956 Else !global.!!number_repositories = !global.!!number_repositories + 1 15957 idx = !global.!!number_repositories 15958 End 15959Else idx = repno 15960 15961!global.!!repository.!!type.idx = 'cvs' 15962Select 15963 When contype = 'local' Then !global.!!repository.!!path.idx = ':local:'path 15964 When contype = 'pserver' Then !global.!!repository.!!path.idx = fullpath 15965 Otherwise !global.!!repository.!!path.idx = ':ext:'user'@'server':'path 15966End 15967!global.!!repository.!!contype.idx = contype 15968!global.!!repository.!!username.idx = user 15969!global.!!repository.!!password.idx = password 15970!global.!!repository.!!shortpath.idx = path 15971!global.!!repository.!!server.idx = server 15972!global.!!repository.!!cvsport.idx = port 15973!global.!!repository.!!public_cvs.idx = public_cvs 15974!global.!!repository.!!enhanced_cvs.idx = enhanced_cvs 15975!global.!!repository.!!name.idx = name 15976!global.!!repository.!!working_dir.idx = working_dir 15977!global.!!repository.!!last_tree_opened.idx = '' 15978!global.!!repository.!!public_cvs_dirs.idx = public_cvs_dirs 15979!global.!!repository.!!cvs_compression.idx = cvs_compression 15980 15981!!last_repository = idx 15982 15983Call dw_window_destroy window 15984Call dw_dialog_dismiss dialog, 'apply' 15985/* 15986 * Save the user's settings now if this is an update of details 15987 */ 15988If newrep \= 'Y' Then Call WriteUserSettingsFile 15989Return 0 15990 15991/* 15992 * Called when the user is adding a new repository to their available list 15993 * and when displaying repository properties. 15994 */ 15995GetHGRepository: Procedure Expose !REXXDW. !global. !!last_repository 15996Parse Arg newrep, repno 15997/* 15998 * For HG repositories, display: 15999 * 16000 * +----------------------------------------------------------+ 16001 * | Text | 16002 * | | 16003 * +----------------------------------------------------------+ 16004 * | Edit Repository Settings | 16005 * +----------------------------------------------------------+ 16006 * | Name: ___________________________ | 16007 * | URL: ___________________________ | 16008 * | User: ___________________________ | 16009 * | Password: ___________________________ | 16010 * | Working Dir: ___________________________ Browse... | 16011 * +----------------------------------------------------------+ 16012 */ 16013!global.!gethgrepository.?title.1 = 'Repository Name:' ; !global.!gethgrepository.?type.1 = '' 16014!global.!gethgrepository.?title.2 = 'URL:' ; !global.!gethgrepository.?type.2 = '' 16015!global.!gethgrepository.?title.3 = 'User:' ; !global.!gethgrepository.?type.3 = '' 16016!global.!gethgrepository.?title.4 = 'Password:' ; !global.!gethgrepository.?type.4 = 'password' 16017!global.!gethgrepository.?title.5 = 'Working Dir:' ; !global.!gethgrepository.?type.5 = 'dirbrowse(Select Working Directory)' 16018!global.!gethgrepository.?title.0 = 5 16019If repno = 0 Then 16020 Do 16021 default. = '' 16022 default.0 = 1 16023 End 16024Else 16025 Do 16026 default.1 = !global.!!repository.!!name.repno 16027 default.2 = !global.!!repository.!!url.repno 16028 default.3 = !global.!!repository.!!username.repno 16029 default.4 = !global.!!repository.!!password.repno 16030 default.5 = !global.!!repository.!!working_dir.repno 16031 Do i = 1 To !global.!gethgrepository.?title.0 16032 If Left( default.i, 1 ) = '!' Then default.i = '' 16033 End 16034 End 16035 16036win = dw_window_new( !REXXDW.!DW_DESKTOP, 'HG Repository Details', !global.!windowstyle ) 16037/* 16038 * We have to create the window icon here because the main window may not have 16039 * been created yet. 16040 */ 16041qoccaicon = dw_icon_load_from_file( !global.!icondir'qocca' ) 16042Call dw_window_set_icon win, qoccaicon 16043topbox = dw_box_new( !REXXDW.!DW_VERT ) 16044Call dw_box_pack_start win, topbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 16045/* 16046 * MLE for entry instructions 16047 */ 16048t1 = dw_mle_new( 0 ) 16049Call dw_box_pack_start topbox, t1, 400, 50, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 16050Call dw_mle_set_word_wrap t1, !REXXDW.!DW_WORD_WRAP 16051inst = 'Select the URL that contains the repository and the username used to connect.' 16052Call dw_mle_import t1, inst, -1 16053Call dw_window_disable t1 16054/* 16055 * If we are an administrator for this repository, add a button to enable 16056 * editing of the repository (only if not adding a repository) 16057 */ 16058If !global.!administrator.!!last_repository = 'Y' & newrep \= 'Y' Then 16059 Do 16060 b1 = dw_button_new( 'Edit Repository Settings', 0 ) 16061 Call dw_box_pack_start topbox, b1, 200, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 16062 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'RepositorySettingsCallback' 16063 End 16064/* 16065 * Now the individual entry fields 16066 */ 16067Do i = 1 To !global.!gethgrepository.?title.0 16068 box = dw_box_new( !REXXDW.!DW_HORZ ) 16069 Call dw_box_pack_start topbox, box, 0, 0, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_EXPAND_VERT, 0 16070 !global.!gethgrepository.?text.i = dw_text_new( !global.!gethgrepository.?title.i, i ) 16071 Call dw_box_pack_start box, !global.!gethgrepository.?text.i, 120, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 16072 Call dw_window_set_style !global.!gethgrepository.?text.i, dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER) , dw_or( !REXXDW.!DW_DT_RIGHT, !REXXDW.!DW_DT_VCENTER ) 16073 Select 16074 When !global.!gethgrepository.?type.i = 'password' Then 16075 Do 16076 !global.!gethgrepository.?entry.i = dw_entryfield_password_new( default.i, 0 ) 16077 End 16078 When !global.!gethgrepository.?type.i = 'check' Then 16079 Do 16080 !global.!gethgrepository.?entry.i = dw_checkbox_new( '', 0 ) 16081 If default.i = 'Y' Then Call dw_checkbox_set !global.!gethgrepository.?entry.i, !REXXDW.!DW_CHECKED 16082 Else Call dw_checkbox_set !global.!gethgrepository.?entry.i, !REXXDW.!DW_UNCHECKED 16083 End 16084 Otherwise 16085 Do 16086 !global.!gethgrepository.?entry.i = dw_entryfield_new( default.i, 0 ) 16087 End 16088 End 16089 Call dw_box_pack_start box, !global.!gethgrepository.?entry.i, 0, !global.!widgetheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 16090 /* 16091 * If browse button required... 16092 */ 16093 If Left( !global.!gethgrepository.?type.i, 9 ) = 'dirbrowse' Then 16094 Do 16095 Parse Var !global.!gethgrepository.?type.i . '(' title ')' 16096 abutton = dw_bitmapbutton_new_from_file( title, 0, !global.!icondir||'modulecheckedout' ) 16097 Call dw_box_pack_start box, abutton, 25, !global.!widgetheight, !REXXDW.!DW_DONT_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 16098 Call dw_signal_connect abutton, !REXXDW.!DW_CLICKED_EVENT, 'GenericDirectorySelector', !global.!gethgrepository.?entry.i, title':' 16099 End 16100End 16101/* 16102 * Set the default field to put the cursor in to start with 16103 */ 16104If repno = 0 | newrep \= 'Y' Then default_idx = 1 16105Else default_idx = 5 16106Call dw_window_default win, !global.!gethgrepository.?entry.default_idx 16107/* 16108 * Create Cancel and Apply buttons 16109 */ 16110b1 = dw_button_new( 'Apply', 0 ) 16111Call dw_box_pack_start topbox, b1, 200, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 16112b2 = dw_button_new( 'Cancel', 0 ) 16113Call dw_box_pack_start topbox, b2, 200, !global.!buttonheight, !REXXDW.!DW_EXPAND_HORZ, !REXXDW.!DW_DONT_EXPAND_VERT, 0 16114/* 16115 * Display the window 16116 */ 16117width = 425 16118height = 600 /* text_height + cb_height + 80 */ 16119Call dw_window_set_pos_size win, (!global.!screen_width % 2) - (width % 2), (!global.!screen_height % 2) - (height % 2), width, height 16120Call dw_window_show win 16121 Call dw_main_sleep 10 16122 16123Do Forever 16124 /* 16125 * Create a dialog for the window 16126 */ 16127 dialog_wait = dw_dialog_new( ) 16128 /* 16129 * We now have everything setup, we can connect the destroying of the top-level window 16130 * to the 'close' callback 16131 */ 16132 Call dw_signal_connect b1, !REXXDW.!DW_CLICKED_EVENT, 'GetHGRepositoryApplyCallback', win, dialog_wait, newrep, repno 16133 Call dw_signal_connect b2, !REXXDW.!DW_CLICKED_EVENT, 'GenericCloseCallback', win, dialog_wait 16134 Call dw_signal_connect win, !REXXDW.!DW_DELETE_EVENT, 'GenericCloseCallback', win, dialog_wait 16135 /* 16136 * Wait for the dialog to come back 16137 */ 16138 cancel = dw_dialog_wait( dialog_wait ) 16139 /* 16140 * All successful processing done in the 'applycallback', so simply get 16141 * out of the loop if we don't have any validation issues 16142 */ 16143 If cancel \= 'retry' Then Leave 16144End 16145Return cancel 16146 16147GetHGRepositoryApplyCallback: Procedure Expose !REXXDW. !global. !!last_repository 16148Parse Arg button, window, dialog, newrep, repno 16149/* 16150 * Get the contents of the entry fields 16151 */ 16152name = Strip( dw_window_get_text( !global.!gethgrepository.?entry.1 ) ) 16153url = Strip( dw_window_get_text( !global.!gethgrepository.?entry.2 ) ) 16154user = Strip( dw_window_get_text( !global.!gethgrepository.?entry.3 ) ) 16155password = Strip( dw_window_get_text( !global.!gethgrepository.?entry.4 ) ) 16156working_dir = Strip( dw_window_get_text( !global.!gethgrepository.?entry.5 ) ) 16157/* 16158 * Validate that all mandatory fields are supplied 16159 * x means not required, o means required 16160 * name url user password working_dir 16161 * o o x x o 16162 */ 16163t_working_dir = Strip( Strip( Changestr( !global.!ossep, working_dir, '/' ) ), 'T', '/' ) 16164Select 16165 When Words( name ) \= 1 Then 16166 Do 16167 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Name field is empty or contains spaces. Please re-enter.' 16168 Call dw_dialog_dismiss dialog, 'retry' 16169 Return 0 16170 End 16171 When url = '' Then 16172 Do 16173 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'URL field is empty. Please re-enter.' 16174 Call dw_dialog_dismiss dialog, 'retry' 16175 Return 0 16176 End 16177 When working_dir = '' Then 16178 Do 16179 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Working Dir is empty please re-enter.' 16180 Call dw_dialog_dismiss dialog, 'retry' 16181 Return 0 16182 End 16183 When Stream( t_working_dir, C, 'QUERY EXISTS' ) \= '' & Word( Stream( t_working_dir, 'C', 'FSTAT' ), 8 ) \= 'Directory' Then 16184 Do 16185 /* 16186 * Stream exists, but its not a directory 16187 */ 16188 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Working Dir specified is not a directory. Please re-enter.' 16189 Call dw_dialog_dismiss dialog, 'retry' 16190 Return 0 16191 End 16192 When Stream( t_working_dir, C, 'QUERY EXISTS' ) = '' Then 16193 Do 16194 /* 16195 * Stream doesn't exist 16196 */ 16197 If dw_messagebox( 'Invalid entry', dw_or( !REXXDW.!DW_MB_YESNO, !REXXDW.!DW_MB_WARNING ), 'Working Dir specified does not exist. Do you want to create it?' ) = !REXXDW.!DW_MB_RETURN_NO Then 16198 Do 16199 Call dw_dialog_dismiss dialog, 'retry' 16200 Return 0 16201 End 16202 End 16203 Otherwise Nop 16204End 16205/* 16206 * Validate that name and working_dir are unique 16207 */ 16208working_dir = WorkingDirToInternal( working_dir ) 16209If Left( !global.!!number_repositories, 1 ) \= '!' & newrep = 'Y' Then 16210 Do 16211 foundrep = FindRepository( name ) 16212 If foundrep \= 0 & foundrep \= repno Then 16213 Do 16214 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Name is already used. Please re-enter.' 16215 Call dw_dialog_dismiss dialog, 'retry' 16216 Return 0 16217 End 16218 foundwd = FindWorkingDir( working_dir ) 16219 If foundwd \= 0 & foundwd \= repno Then 16220 Do 16221 Call dw_messagebox 'Invalid entry', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Working Dir is already used. Please re-enter.' 16222 Call dw_dialog_dismiss dialog, 'retry' 16223 Return 0 16224 End 16225 End 16226/* 16227 * Clone the repository in the working directory. 16228 * Save the username and password in .hgrc 16229 */ 16230rcode = RunOsCommand( 'hg' 'clone' quote( url ) working_dir ) 16231If rcode \= 0 Then 16232 Do 16233 If !global.!mainwindow = '' Then Call WriteOutputStemsToConsole 'default', 'Results of "hg clone" to' working_dir 16234 Else Call WriteOutputStemsToLogWindow 'default', 'Results of "hg clone" to' working_dir 16235 /* 16236 * Got an error cloning. Display a message box and 16237 * ask for the password again. 16238 */ 16239 Call dw_messagebox 'Clone failed', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Check all details and try again.' 16240 Call dw_dialog_dismiss dialog, 'retry' 16241 Return 0 16242 End 16243/* 16244 * Update INI file 16245 */ 16246Parse Var url prot ':' other '//' server '/' . 16247base = prot':'other'//'server'/' 16248inifn = Value( 'HOME', , 'ENVIRONMENT' )'/.hgrc' 16249basename = Lower( Changestr( ' ', name, '' ) ) 16250trace i 16251Call SysIni inifn, 'auth', basename'.prefix',base 16252Call SysIni inifn, 'auth', basename'.username',user 16253Call SysIni inifn, 'auth', basename'.password',password 16254trace o 16255/* 16256 * All validation done now, so add the new repository 16257 */ 16258if trace() = 'F' Then say name url user path password working_dir 16259 16260If repno = 0 Then 16261 Do 16262 If !global.!!number_repositories = 0 | Left( !global.!!number_repositories, 1 ) = '!' Then !global.!!number_repositories = 1 16263 Else !global.!!number_repositories = !global.!!number_repositories + 1 16264 idx = !global.!!number_repositories 16265 End 16266Else idx = repno 16267 16268!global.!!repository.!!type.idx = 'hg' 16269!global.!!repository.!!username.idx = user 16270!global.!!repository.!!password.idx = password 16271!global.!!repository.!!url.idx = url 16272!global.!!repository.!!name.idx = name 16273!global.!!repository.!!working_dir.idx = working_dir 16274!global.!!repository.!!last_tree_opened.idx = '' 16275 16276!!last_repository = idx 16277 16278Call dw_window_destroy window 16279Call dw_dialog_dismiss dialog, 'apply' 16280/* 16281 * Save the user's settings now if this is an update of details 16282 */ 16283If newrep \= 'Y' Then Call WriteUserSettingsFile 16284Return 0 16285 16286/* 16287 * Generates a job base file, and creates a description file 16288 * Uses the repository's log directory. If it doesn't exist, create it 16289 */ 16290GenerateJobBaseFile: Procedure Expose !REXXDW. !global. !!last_repository 16291nativelogdir = FindNativeLogDirectory() 16292Call CreateDirectory nativelogdir 16293bfn = Changestr( '/', nativelogdir||!global.!ossep||'qocca_bg_'||Date('S')||Changestr(':', Time(), '' ), !global.!ossep ) 16294Return bfn 16295 16296CreateDescriptionFile: Procedure Expose !REXXDW. !global. !!last_repository 16297Parse Arg basefile, desc, type, compiler_type 16298/* 16299 * Write the contents of the description file 16300 */ 16301nativedesc = basefile'.desc' 16302Call Stream nativedesc, 'C', 'OPEN WRITE REPLACE' 16303Call Lineout nativedesc, desc 16304Call Lineout nativedesc, type 16305Call Lineout nativedesc, compiler_type 16306Call Stream nativedesc, 'C', 'CLOSE' 16307Return 16308/* 16309 * Check if any pending background events have completed 16310 */ 16311CheckEventsCallback: Procedure Expose !REXXDW. !global. !!last_repository 16312done_events = '' 16313/* 16314 * Disconnect our timer - IncrementRunningJobs reinstigates it if necessary 16315 */ 16316Call dw_timer_disconnect !global.!event_timer 16317Do i = 1 To Words( !global.!running_jobs ) 16318 event_file = Word( !global.!running_jobs, i ) 16319 If Stream( event_file, 'C', 'QUERY EXISTS' ) \= '' Then 16320 Do 16321 /* 16322 * As soon as the event has completed, add the word index of this 16323 * event into the list of running jobs to delete 16324 */ 16325 done_events = i done_events 16326 End 16327End 16328 16329/* 16330 * Remove the events that have completed. We do this by going through a 16331 * variable with indexes in it rather than at the time we are looping through 16332 * the array, as that would stuff up the looping, and the indexes are put in 16333 * in reverse order 16334 */ 16335Do i = 1 to Words( done_events ) 16336 done_event = Word( done_events, i ) 16337 !global.!running_jobs = Delword( !global.!running_jobs, done_event ) 16338End 16339 16340Call SetJobsButtonTitle 16341/* return 0 here to ensure that timer is NOT re-armed */ 16342Return 0 16343 16344IncrementRunningJobs: Procedure Expose !REXXDW. !global. !!last_repository 16345Parse Arg nativefile 16346!global.!running_jobs = !global.!running_jobs nativefile 16347Call SetJobsButtonTitle 16348Return 16349 16350SetJobsButtonTitle: Procedure Expose !REXXDW. !global. !!last_repository 16351Call dw_window_set_text !global.!jobstatus, 'Active Jobs:' Words( !global.!running_jobs ) 16352/* 16353 * If we have any outstanding jobs, wake up and check them in 5 seconds 16354 */ 16355If Words( !global.!running_jobs ) > 0 Then !global.!event_timer = dw_timer_connect( 5000, 'CheckEventsCallback' ) 16356Return 16357 16358WriteBuildConf: Procedure Expose !REXXDW. !global. !!last_repository 16359Parse Arg msg 16360If msg = '' Then msg = 'new version' 16361/* 16362 * Check out the build.conf file for update, write the new contents, 16363 * check the new version in 16364 */ 16365Select 16366 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 16367 Do 16368 /* TODO */ 16369 rcsfile = _root'/admin/RCS/build.conf,v' 16370 Address System 'co -l -f' rcsfile !global.!working_conf !global.!devnull 16371 If rc \= 0 Then 16372 Do 16373 Call TkMessageBox '-message', 'Unable to check out configuration file:' rcsfile, '-title', 'Error', '-type', 'ok', '-icon', 'error' 16374 Return 16375 End 16376 Call UpdateBuildConf 16377 Address System 'ci -q -u -m"'msg'"' !global.!working_conf rcsfile !global.!devnull 16378 If rc \= 0 Then 16379 Do 16380 Call TkMessageBox '-message', 'Unable to check in configuration file:' rcsfile, '-title', 'Error', '-type', 'ok', '-icon', 'error' 16381 Return 16382 End 16383 End 16384 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 16385 Do 16386 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout admin/build.conf' 16387 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16388 Address System cmd With Output Stem osout. Error Stem oserr. 16389 If rc \= 0 Then 16390 Do 16391 Call dw_messagebox 'Error!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Unable to check out configuration file:' !global.!!repository.!!path.!!last_repository'/admin/build.conf' 16392 Call WriteOutputStemsToLogWindow 'default', 'Checking out admin/build.conf' 16393 Return 16394 End 16395 Call UpdateBuildConf 16396 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -m "'msg'" admin/build.conf' 16397 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16398 Address System cmd With Output Stem osout. Error Stem oserr. 16399 If rc \= 0 Then 16400 Do 16401 Call dw_messagebox 'Error!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), 'Unable to check in configuration file:' !global.!!repository.!!path.!!last_repository'/admin/build.conf' 16402 Call WriteOutputStemsToLogWindow 'default', 'Checking in admin/build.conf' 16403 Return 16404 End 16405 End 16406 Otherwise Nop 16407End 16408Return 16409 16410UpdateBuildConf: Procedure Expose !REXXDW. !global. !!last_repository 16411/* 16412 * Write the repositories... 16413 */ 16414Call Stream !global.!working_conf, 'C', 'OPEN WRITE REPLACE' 16415Call Lineout !global.!working_conf,'; indicates if this repository requires reserved checkouts for all files' 16416Call Lineout !global.!working_conf,'!reservedcheckout='QuoteAndBlankBang( !global.!reservedcheckout ) 16417Call Lineout !global.!working_conf,'; the list of users that can do admin functions on this repository' 16418Call Lineout !global.!working_conf,'!admin_users='QuoteAndBlankBang(!global.!admin_users) 16419Call Lineout !global.!working_conf,'; the list of admin users email addresses' 16420Call Lineout !global.!working_conf,'!admin_email='QuoteAndBlankBang(!global.!admin_email) 16421Call Lineout !global.!working_conf,'; the list of users that can build on this repository' 16422Call Lineout !global.!working_conf,'!build_users='QuoteAndBlankBang(!global.!build_users) 16423Call Lineout !global.!working_conf,'; the list of users that can update files in this repository. ie CheckOut for RCS, CheckIn for CVS' 16424Call Lineout !global.!working_conf,'!update_users='QuoteAndBlankBang(!global.!update_users) 16425Call Lineout !global.!working_conf,'; the user mappings for this repository.' 16426Call Lineout !global.!working_conf,'!user_mappings='QuoteAndBlankBang(!global.!user_mappings) 16427Call Lineout !global.!working_conf,'; can a user delete from the repository' 16428Call Lineout !global.!working_conf,'!user_can_delete='QuoteAndBlankBang(!global.!user_can_delete) 16429Call Lineout !global.!working_conf,'; the list of platforms on which this repository can be built' 16430Call Lineout !global.!working_conf,'!platforms='QuoteAndBlankBang(!global.!platforms) 16431Call Lineout !global.!working_conf,'; the list of directories under the root of this repository that can be worked on' 16432Call Lineout !global.!working_conf,'!targets='QuoteAndBlankBang(!global.!targets) 16433Call Lineout !global.!working_conf,'; the list of environments that can be promoted to' 16434Call Lineout !global.!working_conf,'!runtime_envs='QuoteAndBlankBang(!global.!runtime_envs) 16435Call Lineout !global.!working_conf,'; this specifies file extensions to ignore when adding new files' 16436Call Lineout !global.!working_conf,'!ignorefiles='QuoteAndBlankBang(!global.!ignorefiles) 16437Call Lineout !global.!working_conf,'; this specifies file extensions that are binary' 16438Call Lineout !global.!working_conf,'!binaryfiles='QuoteAndBlankBang(!global.!binaryfiles) 16439Call Lineout !global.!working_conf,'; this specifies the environment variable that is set to the version being built' 16440Call Lineout !global.!working_conf,'!versionenvvar='QuoteAndBlankBang(!global.!versionenvvar) 16441Call Lineout !global.!working_conf,'; this specifies the environment variable that is set to the build number being built' 16442Call Lineout !global.!working_conf,'!buildenvvar='QuoteAndBlankBang(!global.!buildenvvar) 16443Call Lineout !global.!working_conf,'; this specifies the directory where builds are done' 16444Call Lineout !global.!working_conf,'!builddir='QuoteAndBlankBang(!global.!builddir) 16445Call Lineout !global.!working_conf,'; this specifies the directory where logs are written' 16446Call Lineout !global.!working_conf,'!logdir='QuoteAndBlankBang(!global.!logdir) 16447 16448Call Lineout !global.!working_conf,'; the directories that are common to multiple modules' 16449Call Lineout !global.!working_conf,'!common_dir.0='QuoteAndBlankBang(!global.!common_dir.0) 16450Do i = 1 To !global.!common_dir.0 16451 Call Lineout !global.!working_conf,'!common_dir.'i'='QuoteAndBlankBang(!global.!common_dir.i) 16452End 16453 16454Call Lineout !global.!working_conf,'; the directories that are linked to common directories' 16455Call Lineout !global.!working_conf,'!linked_dir.0='QuoteAndBlankBang(!global.!linked_dir.0) 16456Call Lineout !global.!working_conf,'!linked_idx.0='QuoteAndBlankBang(!global.!linked_idx.0) 16457Do i = 1 To !global.!linked_dir.0 16458 Call Lineout !global.!working_conf,'!linked_dir.'i'='QuoteAndBlankBang(!global.!linked_dir.i) 16459 Call Lineout !global.!working_conf,'!linked_idx.'i'='QuoteAndBlankBang(!global.!linked_idx.i) 16460End 16461 16462Do i = 1 To Words( !global.!targets ) 16463 target = Word( !global.!targets, i ) 16464 If Left( !global.!dir.!makecommand.target.0, 1 ) \= '!' Then 16465 Do j = 0 To !global.!dir.!makecommand.target.0 16466 If j \= 0 Then Call Lineout !global.!working_conf,'; directory where a make is to be run from - relative path' Word( !global.!platforms, j ) 16467 Call Lineout !global.!working_conf,'!dir.!makedirectory.'target'.'j'='QuoteAndBlankBang(!global.!dir.!makedirectory.target.j) 16468 If j \= 0 Then Call Lineout !global.!working_conf,'; if this value is non-blank, then this directory can be made under' Word( !global.!platforms, j ) 16469 Call Lineout !global.!working_conf,'!dir.!makecommand.'target'.'j'='QuoteAndBlankBang(!global.!dir.!makecommand.target.j) 16470 If j \= 0 Then Call Lineout !global.!working_conf,'; if this value is non-blank, then this directory can be debug made under' Word( !global.!platforms, j ) 16471 Call Lineout !global.!working_conf,'!dir.!debugmakecommand.'target'.'j'='QuoteAndBlankBang(!global.!dir.!debugmakecommand.target.j) 16472 If j \= 0 Then Call Lineout !global.!working_conf,'; if this value is non-blank, then this directory can be custom made under' Word( !global.!platforms, j ) 16473 Call Lineout !global.!working_conf,'!dir.!custommakecommand.'target'.'j'='QuoteAndBlankBang(!global.!dir.!custommakecommand.target.j) 16474 If j \= 0 Then Call Lineout !global.!working_conf,'; if this value is non-blank, then this directory can be built under' Word( !global.!platforms, j ) 16475 Call Lineout !global.!working_conf,'!dir.!buildcommand.'target'.'j'='QuoteAndBlankBang(!global.!dir.!buildcommand.target.j) 16476 If j \= 0 Then Call Lineout !global.!working_conf,'; if this value is non-blank, then this directory can be debug built under' Word( !global.!platforms, j ) 16477 Call Lineout !global.!working_conf,'!dir.!debugbuildcommand.'target'.'j'='QuoteAndBlankBang(!global.!dir.!debugbuildcommand.target.j) 16478 If j \= 0 Then Call Lineout !global.!working_conf,'; if this value is non-blank, then this directory can be custom built under' Word( !global.!platforms, j ) 16479 Call Lineout !global.!working_conf,'!dir.!custombuildcommand.'target'.'j'='QuoteAndBlankBang(!global.!dir.!custombuildcommand.target.j) 16480 If j \= 0 Then Call Lineout !global.!working_conf,'; directory where a promote is to be run from - relative path' Word( !global.!platforms, j ) 16481 Call Lineout !global.!working_conf,'!dir.!promotedirectory.'target'.'j'='QuoteAndBlankBang(!global.!dir.!promotedirectory.target.j) 16482 If j \= 0 Then Call Lineout !global.!working_conf,'; if this value is non-blank, then this directory can be promoted under' Word( !global.!platforms, j ) 16483 Call Lineout !global.!working_conf,'!dir.!promotecommand.'target'.'j'='QuoteAndBlankBang(!global.!dir.!promotecommand.target.j) 16484 If j \= 0 Then Call Lineout !global.!working_conf,'; if this value is non-blank, then this directory can be installed under' Word( !global.!platforms, j ) 16485 Call Lineout !global.!working_conf,'!dir.!installcommand.'target'.'j'='QuoteAndBlankBang(!global.!dir.!installcommand.target.j) 16486 If j \= 0 Then Call Lineout !global.!working_conf,'; directories to be included in promote under' Word( !global.!platforms, j ) 16487 Call Lineout !global.!working_conf,'!dir.!installdirs.'target'.'j'='QuoteAndBlankBang(!global.!dir.!installdirs.target.j) 16488 If j \= 0 Then Call Lineout !global.!working_conf,'; default compiler for' Word( !global.!platforms, j ) 16489 Call Lineout !global.!working_conf,'!dir.!compiler.'target'.'j'='QuoteAndBlankBang(!global.!dir.!compiler.target.j) 16490 If j \= 0 Then Call Lineout !global.!working_conf,'; email template for' Word( !global.!platforms, j ) 16491 Call Lineout !global.!working_conf,'!dir.!emailer.'target'.'j'='QuoteAndBlankBang(!global.!dir.!emailer.target.j) 16492 End 16493 Call Lineout !global.!working_conf,'; indicates if all files in this directory are subject to reserved checkout' 16494 Call Lineout !global.!working_conf,'!dir.!reservedcheckout.'target'='QuoteAndBlankBang(!global.!dir.!reservedcheckout.target) 16495End 16496 16497Call Lineout !global.!working_conf,'; syntax theme to file extension mappings' 16498Call Lineout !global.!working_conf,'!syntax.0='QuoteAndBlankBang(!global.!syntax.0) 16499Call Lineout !global.!working_conf,'!extension.0='QuoteAndBlankBang(!global.!extension.0) 16500If Left( !global.!syntax.0, 1 ) \= '!' Then 16501 Do i = 1 To !global.!syntax.0 16502 Call Lineout !global.!working_conf,'!syntax.'i'='QuoteAndBlankBang(!global.!syntax.i) 16503 Call Lineout !global.!working_conf,'!extension.'i'='QuoteAndBlankBang(!global.!extension.i) 16504 End 16505 16506Call Stream !global.!working_conf, 'C', 'CLOSE' 16507Return 16508 16509/* 16510 * For public_cvs = Y, we have to create a dummy build.conf so the rest of 16511 * QOCCA can run 16512 */ 16513CreateDummyBuildConf: Procedure Expose !REXXDW. !global. !!last_repository 16514Parse Arg reservedcheckout 16515!global.!reservedcheckout=reservedcheckout 16516!global.!admin_users=!global.!user 16517!global.!admin_email=!global.!user 16518!global.!build_users=!global.!user 16519!global.!update_users=!global.!user 16520!global.!user_can_delete="Y" 16521!global.!platforms=!global.!os 16522!global.!targets="" 16523!global.!runtime_envs="" 16524!global.!ignorefiles="" 16525!global.!binaryfiles="" 16526!global.!versionenvvar="VERSION" 16527!global.!buildenvvar="BUILD" 16528!global.!builddir="build" 16529!global.!logdir="log" 16530!global.!common_dir.0="0" 16531!global.!linked_dir.0="0" 16532!global.!linked_idx.0="0" 16533!global.!syntax.0="0" 16534!global.!extension.0="0" 16535Call UpdateBuildConf 16536Return 16537 16538/* 16539 * Determines where temporary files are saved 16540 */ 16541GetUserTempDirectory: Procedure Expose !REXXDW. !global. !!last_repository 16542envs = 'TEMP TMP TMPDIR' 16543Do i = 1 To Words( envs ) 16544 tmpdir = Value( Word( envs, i ), , 'ENVIRONMENT' ) 16545 If tmpdir \= '' Then Return tmpdir 16546End 16547/* 16548 * To get here we don't have a TEMP env variable, so depending on the platform, 16549 * set it to a know value. 16550 */ 16551If !global.!os = 'UNIX' Then tmpdir = Value( 'HOME', , 'ENVIRONMENT' ) 16552Else tmpdir = !global.!home'temp' 16553Return tmpdir 16554 16555SetLockedStatusIcon: Procedure Expose !REXXDW. !global. !!last_repository 16556this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 16557If !global.!dir.!reservedcheckout.this_dir = 'Y' | !global.!reservedcheckout = 'Y' Then 16558 Call dw_window_enable !global.!lock_bitmap 16559Else 16560 Call dw_window_disable !global.!lock_bitmap 16561Return 16562 16563/* 16564 * Batch commands... 16565 */ 16566 16567LabelModule: Procedure Expose !REXXDW. !global. !!last_repository 16568/* 16569 * Called from batch only 16570 */ 16571Parse Arg batch, lab, overwrite_label 16572/* 16573 * Check if module exists first. 16574 */ 16575If IsModuleInRepository( !global.!current_dirname.!!last_repository, !!last_repository ) = 0 Then Call Aborttext 'Cannot label: nothing known about module:' !global.!current_dirname.!!last_repository 16576Parse Value GenerateLabelFile( batch, 'Latest', lab, overwrite_label ) With new_label_file labelbasefile 16577retcode = ApplyLabelFile( batch, new_label_file, 0, lab, labelbasefile ) 16578Return retcode 16579 16580GenerateLabelFile: Procedure Expose !REXXDW. !global. !!last_repository 16581Parse Arg batch, based_on, lab, overwrite_label 16582labelbasefile = '.label-'lab 16583/* 16584 * Ensure label does not contain special characters... 16585 */ 16586test_chars = '$,.:;@' 16587test_lab = Translate( lab, Copies( '#', Length( test_lab ) ), test_chars ) 16588If lab \= test_lab Then 16589 Do 16590 msg = 'The label supplied:' lab 'must not contain special characters:' quote( test_chars ) 16591 If batch = '' Then 16592 Do 16593 Call dw_messagebox 'Error!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_ERROR ), msg 16594 Return 'N' 16595 End 16596 Else 16597 Do 16598 Call Aborttext msg 16599 End 16600 End 16601new_label_file = 1 16602Select 16603 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 16604 Do 16605 If batch = '' Then Call SetCursorWait 16606 new_rev = '1.1' 16607 labelworkfile = !global.!current_dirname.!!last_repository'/'labelbasefile 16608 /* 16609 * If the working directory doesn't exist, we need to check it out so 16610 * we can add the new label file. 16611 */ 16612 If DirectoryExists( !global.!current_dirname.!!last_repository'/CVS' ) = 0 Then 16613 Do 16614 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout -l' !global.!current_dirname.!!last_repository 16615 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16616 Address System cmd 16617 End 16618 /* 16619 * Check if !global.!current_dirname'label.'ver already exists 16620 */ 16621 rem = '' 16622 If !global.!!repository.!!public_cvs.!!last_repository = 'Y' Then 16623 Do 16624 root = !global.!!repository.!!shortpath.!!last_repository'/'!global.!current_dirname.!!last_repository'/' 16625 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q rlog -hbN' quote( labelworkfile ) 16626 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16627 Address System cmd With Output FIFO '' Error Stem err. 16628 fn = '' 16629 Do Queued() 16630 Parse Pull Line 16631 Select 16632 When Left( line, 9 ) = 'RCS file:' Then 16633 Do 16634 Parse Var line (root) fn ',v' 16635 End 16636 When Left( line, 5 ) = 'head:' Then 16637 Do 16638 Parse Var line . ': ' maj '.' min 16639 End 16640 Otherwise Nop 16641 End 16642 End 16643 End 16644 Else 16645 Do 16646 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list' quote( labelworkfile ) 16647 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16648 Address System cmd With Output Stem out. Error Stem err. 16649 fn = '' 16650 If out.0 \= 0 Then Parse Var out.1 . maj '.' min . . . . . fn 16651 End 16652 If batch = '' Then Call SetCursorNoWait 16653 Select 16654 When fn = labelworkfile & overwrite_label Then 16655 Do 16656 new_label_file = 0 16657 If Datatype( min ) = 'NUM' Then new_rev = Strip( maj )'.'min+1 16658 /* 16659 * In case this label file was created by someone else and we don't have 16660 * a copy of it in our working directory, we need to get the latest 16661 * version. 16662 */ 16663 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q get' quote( labelworkfile ) 16664 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16665 Address System cmd With Output Stem junk. Error Stem junk. 16666 End 16667 When fn = labelworkfile Then 16668 Do 16669 msg = "Label file exists and you didn't say to overwrite it." 16670 If batch = '' Then 16671 Do 16672 Call dw_messagebox 'Warning!', dw_or( !REXXDW.!DW_MB_OK, !REXXDW.!DW_MB_WARNING ), msg 16673 Return 'N' 16674 End 16675 Else 16676 Do 16677 Call Aborttext msg 16678 End 16679 End 16680 Otherwise Nop 16681 End 16682 If batch = '' Then Call SetCursorWait 16683 Call Stream labelworkfile,'C','OPEN WRITE REPLACE' 16684 Call Lineout labelworkfile, '; QOCCA Label File:' labelbasefile 'for' !global.!current_dirname.!!last_repository 16685 If based_on = 'Latest' Then 16686 Do 16687 /* 16688 * If based on 'Latest', then get latest revision of files from repository 16689 */ 16690 If !global.!!repository.!!public_cvs.!!last_repository = 'Y' Then 16691 Do 16692 root = !global.!!repository.!!shortpath.!!last_repository'/'!global.!current_dirname.!!last_repository'/' 16693 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q rlog -hbN' quote( !global.!current_dirname.!!last_repository ) 16694 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16695 Address System cmd With Output FIFO '' Error Stem err. 16696 Do Queued() 16697 Parse Pull Line 16698 Select 16699 When Left( line, 9 ) = 'RCS file:' Then 16700 Do 16701 Parse Var line (root) fn ',v' 16702 End 16703 When Left( line, 5 ) = 'head:' Then 16704 Do 16705 Parse Var line . ': ' maj '.' min 16706 /* 16707 * If the label file exists, don't include it here; we do this later 16708 * with the correct version of the file 16709 */ 16710 If fn \= labelworkfile Then Call Lineout labelworkfile,rel fn 16711 End 16712 Otherwise Nop 16713 End 16714 End 16715 End 16716 Else 16717 Do 16718 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list' quote( !global.!current_dirname.!!last_repository ) 16719 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16720 Address System cmd With Output FIFO '' Error Stem err. 16721 Do Queued() 16722 Parse Pull 1 . 12 rel 28 . 88 flen 91 . 92 fn +(flen) +1 . 16723 rel = Strip( rel ) 16724 fn = Strip( fn ) 16725 /* 16726 * If the label file exists, don't include it here; we do this later 16727 * with the correct version of the file 16728 */ 16729 If fn \= labelworkfile Then Call Lineout labelworkfile,rel fn 16730 End 16731 End 16732 End 16733 Else 16734 Do 16735 /* 16736 * If based on a previous label, then 'copy' this label file to our working one 16737 */ 16738 oldlabelbasefile = '.label-'based_on 16739 oldlabelworkfile = !global.!current_dirname.!!last_repository'/'oldlabelbasefile 16740 /* 16741 * make sure we have the latest copy from the repository... 16742 */ 16743 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q get -p' quote( oldlabelworkfile ) 16744 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16745 Address System cmd With Output FIFO '' Error Stem junk. 16746 Do Queued() 16747 Parse Pull rel fn 16748 If rel \= ';' Then 16749 Do 16750 /* 16751 * If the label file exists, don't include it here; we do this later 16752 * with the correct version of the file 16753 */ 16754 If fn \= labelworkfile Then Call Lineout labelworkfile,rel fn 16755 End 16756 End 16757 End 16758 /* 16759 * Fudge the inclusion of the label file itself into this version's label 16760 * file. 16761 */ 16762 Call Lineout labelworkfile, new_rev labelworkfile 16763 Call Stream labelworkfile,'C','CLOSE' 16764 If batch = '' Then Call SetCursorNoWait 16765 End 16766 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 16767 Do 16768 /* TODO */ 16769 labelworkfile = !global.!current_dirname || !global.!ossep || labelbasefile 16770 labelrcsfile = !global.!current_dirname || !global.!ossep || 'RCS' || !global.!ossep || labelbasefile || ',v' 16771 se = Stream( labelrcsfile, 'C', 'QUERY EXISTS' ) 16772 Select 16773 When se = '' Then Nop 16774 When se \= '' & overwrite_label Then 16775 Do 16776 Call SysFileDelete labelworkfile 16777 Call SysFileDelete labelrcsfile 16778 End 16779 Otherwise 16780 Do 16781 msg = "Label file exists and you didn't say to overwrite it." 16782 If batch = '' Then 16783 Do 16784 Call TkMessageBox '-message', msg, '-title', 'Warning!', '-type', 'ok', '-icon', 'warning' 16785 Return 'N' 16786 End 16787 Else 16788 Do 16789 Call Aborttext msg 16790 End 16791 End 16792 End 16793 Call Stream labelworkfile,'C','OPEN WRITE REPLACE' 16794 Call Lineout labelworkfile, '; QOCCA Label File:' labelbasefile 'for' !global.!current_dirname 16795 If Stream( !global.!current_dirname, 'C','QUERY EXISTS' ) = '' Then rcsfile.0 = 0 16796 Else Call SysFileTree !global.!current_dirname||!global.!ossep'*,v', 'RCSFILE.', 'FLS' 16797 Do i = 1 To rcsfile.0 16798 cmd = 'rlog -h' Word(rcsfile.i,5) 16799 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16800 Address System cmd With Output FIFO '' Error Stem err. 16801 Do Queued() 16802 Parse Pull Line 16803 Select 16804 When Left( line, 9 ) = 'RCS file:' Then 16805 Do 16806 Parse Var line . 'RCS file:' fn ',v' 16807 End 16808 When Left( line, 5 ) = 'head:' Then 16809 Do 16810 Parse Var line . 'head:' ver 16811 Call Lineout labelworkfile, Left(Strip(ver),10) Strip(fn) 16812 End 16813 Otherwise Nop 16814 End 16815 End 16816 End 16817 /* 16818 * Fudge the inclusion of the label file itself into this version's label 16819 * file. 16820 */ 16821 Call Lineout labelworkfile, Left('1.1',10) labelrcsfile 16822 Call Stream labelworkfile,'C','CLOSE' 16823 End 16824 Otherwise Nop 16825End 16826Return new_label_file labelbasefile 16827 16828ApplyLabelFile: Procedure Expose !REXXDW. !global. !!last_repository 16829Parse Arg batch, new_label_file, edit_label_file, lab, labelbasefile 16830retcode = 0 16831/* 16832 * Change to the working directory 16833 */ 16834here = Directory() 16835Call Directory( !global.!current_dirname.!!last_repository ) 16836Select 16837 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 16838 Do 16839 /* 16840 * Add the label file to the repository 16841 */ 16842 cvs_tag = Changestr( ' ', Changestr( '/', !global.!current_dirname.!!last_repository, '_'), '-' ) || '_' || lab 16843 If batch = '' Then 16844 Do 16845 If new_label_file Then 16846 Do 16847 Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'add' '-m"QOCCA label file for:' lab'"' quote( labelbasefile ) 16848 Call WriteOutputStemsToLogWindow 'default', 'Addition of label file' quote( labelbasefile ) 16849 End 16850 Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -m"Addition of label file"' quote( labelbasefile ) 16851 Call WriteOutputStemsToLogWindow 'default', 'Committing label file' quote( labelbasefile ) 16852 /* 16853 * If we edited the label file, we need to rtag each individual file... 16854 */ 16855 If edit_label_file Then 16856 Do 16857 Call WriteMessageHeaderToLogWindow 'Tagging with label:' quote( cvs_tag ) 16858 Call Stream labelbasefile, 'C', 'OPEN READ' 16859 Do While Lines( labelbasefile ) > 0 16860 Parse Value Linein( labelbasefile ) With rev fn 16861 If rev = ';' Then Iterate 16862 Call WriteMessageToLogWindow ' 'rev fn 16863 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q rtag -F -l -r'rev quote( cvs_tag ) quote( fn ) 16864 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16865 Address Command cmd With Output FIFO '' Error FIFO '' 16866 Do Queued() 16867 Parse Pull line 16868 Call WriteMessageToLogWindow ' 'line 16869 End 16870 End 16871 Call Stream labelbasefile, 'C', 'CLOSE' 16872 Call WriteMessageTrailerToLogWindow 'Tagging with label:' quote( cvs_tag ) 16873 End 16874 Else 16875 Do 16876 Call RunOSCommand 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q rtag -F -R' quote( cvs_tag ) quote( !global.!current_dirname.!!last_repository ) 16877 Call WriteOutputStemsToLogWindow 'default', 'Tagging with label:' quote( cvs_tag ) 16878 End 16879 End 16880 Else 16881 Do 16882 If new_label_file Then 16883 Do 16884 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'add' '-m"QOCCA label file for:' lab'"' quote( labelbasefile ) 16885 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16886 Address System cmd 16887 End 16888 retcode = rc 16889 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -m"Addition of label file"' quote( labelbasefile ) 16890 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16891 Address System cmd 16892 retcode = rc 16893 /* 16894 * In batch mode only the latest revision of a module can be labeled, so rtag 16895 * of the directory is possible 16896 */ 16897 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q rtag -F -R' quote( cvs_tag ) quote( !global.!current_dirname.!!last_repository ) 16898 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 16899 Address System cmd 16900 retcode = rc 16901 End 16902 End 16903 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 16904 Do 16905 /* TODO */ 16906 textmsg = 'Label file for:' lab 16907 Address System 'ci -q -u -t-"'textmsg'"' labelworkfile labelrcsfile 16908 End 16909 Otherwise Nop 16910End 16911/* 16912 * Change directory back to the root working dir 16913 */ 16914Call Directory( here ) 16915Return retcode 16916 16917/* 16918 * Run in batch mode 16919 * Only the "build user(s)" can do this - in build.conf 16920 */ 16921Batch: Procedure Expose !REXXDW. !global. !!last_repository 16922_arg.0 = Queued() 16923Do i = 1 To _arg.0 16924 Parse Pull _arg.i 16925End 16926cmd = Translate( _arg.1 ) 16927!global.!validcmds = 'init label mods build promote copy add export' 16928/* 16929 * mods - report module differences (batch or user) 16930 */ 16931!global.!validargs.mods = '-n -N -m -M -v -V -p -w -B -T -W -A' 16932!global.!vars.mods = 'repository earlier_repository _current_dirname _earlier_dirname newlab oldlab noprogress ignorewhitespace _basefile _trace_flag _wc_flag _sa_flag' 16933!global.!opt.mods = 'Repository EarlierRepository Module EarlierModule Version EarlierVersion NoProgress IgnoreWhitespace BaseFile TraceFlag WordCompareFlag ShowAllCompareFlag' 16934!global.!desc.mods.1 = 'Name of Repository for Later Version' 16935!global.!desc.mods.2 = 'Name of Repository for Earlier Version' 16936!global.!desc.mods.3 = 'Module for Later Version; eg mytop/myproj' 16937!global.!desc.mods.4 = 'Module for Earlier Version; eg mytop/myproj' 16938!global.!desc.mods.5 = 'Later Version string; eg Latest or Working or mytop/myproj,1_3_2' 16939!global.!desc.mods.6 = 'Earlier Version string; eg Latest or Working or mytop/myproj,1_3_1' 16940!global.!desc.mods.7 = 'Indicates no progress dots displayed' 16941!global.!desc.mods.8 = 'Ignore whitespace in file comparisons' 16942!global.!desc.mods.9 = 'Base file (internal use only)' 16943!global.!desc.mods.10 = 'Trace flag (no value: minimal tracing, value: VERY verbose tracing)' 16944!global.!desc.mods.11 = 'Indicates if Word documents are compared' 16945!global.!desc.mods.12 = 'Indicates if All files are to be reported or just those that differ' 16946!global.!desc.mods.0 = 12 16947!global.!mandatory.mods = '0 0 1 0 1 1 0 0 0 0 0 0' 16948!global.!valuereq.mods = '1 1 1 1 1 1 0 0 1 0 0 0' 16949/* 16950 * label - label a module (batch or user) 16951 */ 16952!global.!validargs.label = '-n -m -v -o -B -T' 16953!global.!vars.label = 'repository _current_dirname lab overwrite _basefile _trace_flag' 16954!global.!opt.label = 'Repository Module Version OverwriteLabel BaseFile TraceFlag' 16955!global.!desc.label.1 = 'Name of Repository' 16956!global.!desc.label.2 = 'Module to label; eg mytop/myproj' 16957!global.!desc.label.3 = 'Version string; eg 1_3_2' 16958!global.!desc.label.4 = 'Flag to indicate that existing Version file to be overwritten' 16959!global.!desc.label.5 = 'Base file (internal use only)' 16960!global.!desc.label.6 = 'Trace flag (no value: minimal tracing, value: VERY verbose tracing)' 16961!global.!desc.label.0 = 6 16962!global.!mandatory.label = '0 1 1 0 0 0' 16963!global.!valuereq.label = '1 1 1 0 1 0' 16964/* 16965 * build - build a module with configured build command (batch or user) 16966 */ 16967!global.!validargs.build = '-n -m -v -b -o -C -c -t -B -T -w' 16968!global.!vars.build = 'repository _current_dirname lab buildtype overwritebuild dontcheckout continuecheckout testbuild _basefile _trace_flag _working_dir' 16969!global.!opt.build = 'Repository Module Version BuildType OverwriteBuild DontCheckout ContinueCheckout TestBuild BaseFile TraceFlag WorkingDir' 16970!global.!desc.build.1 = 'Name of Repository' 16971!global.!desc.build.2 = 'Module to build: eg mytop/myproj' 16972!global.!desc.build.3 = 'Version string (must have been labelled); eg 1_3_2' 16973!global.!desc.build.4 = 'Type of build to perform: "debug" or "custom"' 16974!global.!desc.build.5 = 'Flag to indicate that existing build to be overwritten' 16975!global.!desc.build.6 = 'Flag to indicate to not checkout files (previous build was done for module/version)' 16976!global.!desc.build.7 = 'Flag to indicate to continue checking out files that have been checked out (previous checkout failed)' 16977!global.!desc.build.8 = 'Flag to indicate that current build is a test build' 16978!global.!desc.build.9 = 'Base file (internal use only)' 16979!global.!desc.build.10 = 'Trace flag (no value: minimal tracing, value: VERY verbose tracing)' 16980!global.!desc.build.11 = 'Working Directory (override dir in repository file)' 16981!global.!desc.build.0 = 11 16982!global.!mandatory.build = '0 1 1 0 0 0 0 0 0 0 0' 16983!global.!valuereq.build = '1 1 1 1 0 0 0 0 1 0 1' 16984/* 16985 * promote - promote a module with configured promote command (batch or user) 16986 */ 16987!global.!validargs.promote = '-n -m -v -e -B -T' 16988!global.!vars.promote = 'repository _current_dirname lab env _basefile _trace_flag' 16989!global.!opt.promote = 'Repository Module Version Environment BaseFile TraceFlag' 16990!global.!desc.promote.1 = 'Name of Repository' 16991!global.!desc.promote.2 = 'Module to promote: eg mytop/myproj' 16992!global.!desc.promote.3 = 'Version string (must have been built)' 16993!global.!desc.promote.4 = 'Environment to promote to' 16994!global.!desc.promote.5 = 'Base file (internal use only)' 16995!global.!desc.promote.6 = 'Trace flag (no value: minimal tracing, value: VERY verbose tracing)' 16996!global.!desc.promote.0 = 6 16997!global.!mandatory.promote = '0 1 1 0 0 0' 16998!global.!valuereq.promote = '1 1 1 1 1 0' 16999/* 17000 * copy - copy a module as a new repository (batch or user) 17001 */ 17002!global.!validargs.copy = '-n -m -d -v -o -B -T' 17003!global.!vars.copy = 'repository _current_dirname new_dirname lab overwrite _basefile _trace_flag' 17004!global.!opt.copy = 'Repository Module NewDirectory Version Overwrite BaseFile TraceFlag' 17005!global.!desc.copy.1 = 'Name of current Repository' 17006!global.!desc.copy.2 = 'Module to copy: eg mytop/myproj' 17007!global.!desc.copy.3 = 'Directory for new repository' 17008!global.!desc.copy.4 = 'Version string (must have been labeled)' 17009!global.!desc.copy.5 = 'Flag to indicate that existing directory to be overwritten' 17010!global.!desc.copy.6 = 'Base file (internal use only)' 17011!global.!desc.copy.7 = 'Trace flag (no value: minimal tracing, value: VERY verbose tracing)' 17012!global.!desc.copy.0 = 7 17013!global.!mandatory.copy = '0 1 1 1 0 0 0' 17014!global.!valuereq.copy = '1 1 1 1 0 1 0' 17015/* 17016 * init - initialise a new repository (batch only) 17017 */ 17018!global.!validargs.init = '-r -t -u -p -m -e -T' 17019!global.!vars.init = 'repository _sourcecontrol _username _password _module _extraadminuser _trace_flag' 17020!global.!opt.init = 'Repository SourceControl UserName Password InitialModule ExtraAdminUser TraceFlag' 17021!global.!desc.init.1 = 'Location of repository to initialise' 17022!global.!desc.init.2 = 'Type of repository: cvs, rcs' 17023!global.!desc.init.3 = 'Username to connect to repository (if required)' 17024!global.!desc.init.4 = 'Password to connect to repository (if required)' 17025!global.!desc.init.5 = 'Initial Module to create under Repository Root' 17026!global.!desc.init.6 = 'Extra Admin User' 17027!global.!desc.init.7 = 'Trace flag (no value: minimal tracing, "I" or "R": VERY verbose tracing)' 17028!global.!desc.init.0 = 7 17029!global.!mandatory.init = '1 1 0 0 0 0 0' 17030!global.!valuereq.init = '1 1 1 1 1 1 0' 17031/* 17032 * add - add a new repository to a user's profile (.qocca file) (batch only) 17033 */ 17034!global.!validargs.add = '-n -t -c -e -s -r -u -p -w -d -T' 17035!global.!vars.add = '_name _sourcecontrol _cvstype _enhanced _server repository _username _password _working _tmpdir _trace_flag' 17036!global.!opt.add = 'Name SourceControl CVSType EnhancedCVS Server Repository UserName Password WorkingDir TmpDir TraceFlag' 17037!global.!desc.add.1 = 'Name of repository to add' 17038!global.!desc.add.2 = 'Type of repository: cvs, rcs' 17039!global.!desc.add.3 = 'Connection type for CVS. One of:' !global.!validcvstypes 17040!global.!desc.add.4 = 'Specifies the CVS repository supports "enhanced CVS"' 17041!global.!desc.add.5 = 'Server where repository is located' 17042!global.!desc.add.6 = 'Location of repository to add' 17043!global.!desc.add.7 = 'Username' 17044!global.!desc.add.8 = 'Password' 17045!global.!desc.add.9 = 'Working Directory' 17046!global.!desc.add.10 = 'Temporary Directory' 17047!global.!desc.add.11 = 'Trace flag (no value: minimal tracing, value: VERY verbose tracing)' 17048!global.!desc.add.0 = 11 17049!global.!mandatory.add = '1 1 0 0 0 1 0 0 1 1 0' 17050!global.!valuereq.add = '1 1 1 0 1 1 1 1 1 1 0' 17051/* 17052 * export - export a module to a location (batch) 17053 */ 17054!global.!validargs.export = '-n -m -v -T -w' 17055!global.!vars.export = 'repository _current_dirname lab _trace_flag _working_dir' 17056!global.!opt.export = 'Repository Module Version TraceFlag WorkingDir' 17057!global.!desc.export.1 = 'Name of Repository' 17058!global.!desc.export.2 = 'Module to build: eg mytop/myproj' 17059!global.!desc.export.3 = 'Version string (must have been labelled); eg 1_3_2' 17060!global.!desc.export.4 = 'Trace flag (no value: minimal tracing, value: VERY verbose tracing)' 17061!global.!desc.export.5 = 'Working Directory (override dir in repository file)' 17062!global.!desc.export.0 = 5 17063!global.!mandatory.export = '0 1 1 0 1' 17064!global.!valuereq.export = '1 1 1 0 1' 17065 17066retcode = 0 17067 17068/* 17069 * Display version and usage if only arg is "-h" 17070 */ 17071If cmd = '-H' Then 17072 Do 17073 Say 'This is QOCCA Version:' !global.!version 17074 Call Usage 17075 End 17076If Wordpos( cmd, Translate( !global.!validcmds ) ) = 0 Then 17077 Do 17078 Say 'Invalid batch command:' _arg.1'. Must be one of' !global.!validcmds 17079 Call Usage 17080 End 17081 17082Do i = 2 To _arg.0 17083 Do j = 1 To Words( !global.!validargs.cmd ) 17084 If Substr( _arg.i, 1, 2 ) = Word( !global.!validargs.cmd, j ) Then 17085 Do 17086 optval = Strip( Substr( _arg.i, 3 ) ) 17087 optvar = Word( !global.!vars.cmd, j ) 17088 Interpret optvar '= optval' 17089 Leave j 17090 End 17091 End 17092End 17093error = 0 17094Do i = 1 To Words( !global.!vars.cmd ) 17095 Select 17096 When Translate( Value( Word( !global.!vars.cmd, i ) ) ) = Translate( Word( !global.!vars.cmd, i ) ) & Word( !global.!mandatory.cmd, i ) = 1 Then 17097 Do 17098 Say 'Mandatory parameter' Word( !global.!validargs.cmd, i ) 'not supplied' 17099 error = 1 17100 End 17101 When Word( !global.!valuereq.cmd, i ) = 1 & Value( Word( !global.!vars.cmd, i ) ) = '' Then 17102 Do 17103 Say 'No value supplied for parameter' Word( !global.!validargs.cmd, i ) 17104 error = 1 17105 End 17106 Otherwise Nop 17107 End 17108End 17109If error = 1 Then Call Usage cmd 17110/* 17111 * Lets start the verbose tracing from here if required... 17112 */ 17113Select 17114 When _trace_flag = '' Then _trace_flag = 'R' 17115 When _trace_flag = '_TRACE_FLAG' Then _trace_flag = 'O' 17116 When Translate( _trace_flag ) = 'I' | Translate( _trace_flag ) = 'R' | Translate( _trace_flag ) = 'L' Then 17117 Do 17118 Trace Value _trace_flag 17119 End 17120 Otherwise 17121 Do 17122 Say 'Invalid Trace Flag:' _trace_flag'. Must be one of "L", "I" or "R"' 17123 Call Usage 17124 End 17125End 17126/* 17127 * Get the details from the user's preferences file 17128 */ 17129Call ReadUserSettingsFile 17130/* 17131 * INIT and ADD commands do not require a user to have a .qocca profile file; all 17132 * other batch commands do! 17133 */ 17134Select 17135 When cmd = 'INIT' Then 17136 Do 17137 If Wordpos( _sourcecontrol, !global.!valid_repository_types ) = 0 Then 17138 Call AbortText 'Invalid repository type:' quote( _sourcecontrol ) 'specified. Must be one of:' !global.!valid_repository_types 17139/* 17140 If Left( !global.!!tmpdir, 1 ) = '!' Then 17141 Do 17142 !global.!!tmpdir = !global.!home||SysTempFileName( 'dir?????' )|| !global.!ossep 17143 Call SysMkdir !global.!!tmpdir 17144 End 17145*/ 17146 End 17147 When cmd = 'ADD' Then 17148 Do 17149 If Wordpos( _sourcecontrol, !global.!valid_repository_types ) = 0 Then 17150 Call AbortText 'Invalid repository type:' quote( _sourcecontrol ) 'specified. Must be one of:' !global.!valid_repository_types 17151 If _sourcecontrol = 'cvs' Then 17152 Do 17153 If Wordpos( _cvstype, !global.!validcvstypes ) = 0 Then 17154 Call AbortText 'Invalid CVS type:' quote( _cvstype ) 'specified. Must be one of:' !global.!validcvstypes 17155 End 17156 If FindRepository( _name ) \= 0 Then 17157 Call AbortText 'You already have a repository of that name in your profile' 17158 If Stream( _working, C, 'QUERY EXISTS' ) \= '' & Word( Stream( _working, 'C', 'FSTAT' ), 8 ) \= 'Directory' Then 17159 Call AbortText 'The working directory specified:' quote( _working ) 'is not a directory' 17160 _working = WorkingDirToInternal( _working ) 17161 If FindWorkingDir( _working ) \= 0 Then 17162 Call AbortText 'You already have that working directory in your profile' 17163 If DirectoryExists( _tmpdir ) = 0 Then 17164 Call AbortText 'The temp directory specified:' quote( _tmpdir ) 'does not exist' 17165 !global.!!tmpdir = WorkingDirToInternal( _tmpdir ) 17166 End 17167 Otherwise 17168 Do 17169 If repository = 'REPOSITORY' Then 17170 Do 17171 repno = !!last_repository 17172 repository = !global.!!repository.!!name.repno 17173 End 17174 Else 17175 Do 17176 repno = FindRepository( repository ) 17177 If repno = 0 Then 17178 Do 17179 Call AbortText 'Could not find any reference to "'repository'" in your user profile.' 17180 End 17181 Else 17182 Do 17183 !!last_repository = repno 17184 End 17185 End 17186 /* 17187 * All generic parameters are now valid, check we are the "build user", 17188 * and then Call the appropriate function... 17189 * Can't do this if running "init". 17190 */ 17191 Call SetRepositoryEnvs 17192 Call ConnectToRepository !!last_repository 17193 Call GetConfigurationFile 17194 Call SetupEnvironment 17195 /* 17196 * If not build user, abort 17197 */ 17198 If !global.!build_user = 'N' Then 17199 Do 17200 Call AbortText 'You are not a build user for this repository. Rack off!!' 17201 End 17202 If cmd = 'BUILD' | cmd = 'EXPORT' Then 17203 Do 17204 If _working_dir \= '_WORKING_DIR' Then 17205 Do 17206 !global.!!repository.!!working_dir.!!last_repository = _working_dir 17207 End 17208 End 17209 /* 17210 * Ensure we are in the "correct" directory 17211 */ 17212 native_working_dir = Changestr( '/', !global.!!repository.!!working_dir.!!last_repository, !global.!ossep ) 17213 here = Directory() 17214 Call Directory native_working_dir 17215 End 17216End 17217/* 17218 * If run direct from batch set our basefile here 17219 */ 17220If _basefile = '_BASEFILE' Then batch = 1 17221Else batch = 0 17222/* 17223 * Set !global.!current_dirname.!!last_repository to the value of the arg, 17224 * as existing code expects it set 17225 * It doesn't matter if _current_dirname is not a valid arg, as it won't be 17226 * used for those commands that don't expect it as an argument. 17227 */ 17228!global.!current_dirname.!!last_repository = _current_dirname 17229/* 17230 * Execute the code for each of the batch commands... 17231 */ 17232Select 17233 When cmd = 'INIT' Then /* batch only */ 17234 Do 17235 Call InitRepository repository, _sourcecontrol, _username, _password, _module, _extraadminuser 17236 End 17237 When cmd = 'LABEL' Then 17238 Do 17239 If batch Then _basefile = GenerateJobBaseFile() 17240 If overwrite = '' Then overwrite_label = 1 17241 Else overwrite_label = 0 17242 retcode = LabelModule( 'batch', lab, overwrite_label ) 17243 End 17244 When cmd = 'MODS' Then 17245 Do 17246 /* 17247 * If no -M specified, then use _current_dirname 17248 * This check MUST be done BEFORE the test for no -n or no -N 17249 */ 17250 If _earlier_dirname = '_EARLIER_DIRNAME' Then _earlier_dirname = _current_dirname 17251 /* 17252 * If no -n specified, then use !!last_repository (we have already validated this above) 17253 * If no -N specified, then use same value for -n 17254 */ 17255 If earlier_repository = 'EARLIER_REPOSITORY' Then 17256 Do 17257 earlier_repostitory = repository 17258 earlier_repno = repno 17259 !global.!current_dirname.repno = _earlier_dirname 17260 End 17261 Else 17262 Do 17263 earlier_repno = FindRepository( earlier_repository ) 17264 If earlier_repno = 0 Then 17265 Do 17266 Call AbortText 'Could not find any reference to "'earlier_repository'" in your user profile.' 17267 End 17268 !global.!current_dirname.earlier_repno = _earlier_dirname 17269 End 17270 17271 If IsModuleInRepository( _current_dirname, repno ) = 0 Then Call Aborttext 'Later Module:' _current_dirname 'does not exist.' 17272 If earlier_repno \= repno Then 17273 Do 17274 If IsModuleInRepository( _earlier_dirname, earlier_repno ) = 0 Then Call Aborttext 'Earlier Module:' _earlier_dirname 'does not exist.' 17275 End 17276 17277 If batch Then _basefile = GenerateJobBaseFile() 17278 retcode = ModsReport( repno, earlier_repno, newlab, oldlab, noprogress, ignorewhitespace, _basefile, batch, _current_dirname, _earlier_dirname, _wc_flag, _sa_flag ) 17279 /* 17280 * Write the return code to the indicator file... 17281 */ 17282 Call Stream _basefile, 'C', 'OPEN WRITE REPLACE' 17283 Call Lineout _basefile,retcode 17284 Call Stream _basefile, 'C', 'CLOSE' 17285 End 17286 When cmd = 'COPY' Then 17287 Do 17288 If batch Then _basefile = GenerateJobBaseFile() 17289 retcode = CopyRepository( repository, new_dirname, lab, overwrite, _basefile, batch ) 17290 /* 17291 * Write the return code to the indicator file... 17292 */ 17293 Call Stream _basefile, 'C', 'OPEN WRITE REPLACE' 17294 Call Lineout _basefile,retcode 17295 Call Stream _basefile, 'C', 'CLOSE' 17296 End 17297 When cmd = 'BUILD' Then 17298 Do 17299 If batch Then _basefile = GenerateJobBaseFile() 17300 retcode = RunBuild( repository, lab, buildtype, overwritebuild, testbuild, _basefile, batch, dontcheckout, continuecheckout ) 17301 /* 17302 * Write the return code to the indicator file... 17303 */ 17304 Call Stream _basefile, 'C', 'OPEN WRITE REPLACE' 17305 Call Lineout _basefile,retcode 17306 Call Stream _basefile, 'C', 'CLOSE' 17307 End 17308 When cmd = 'PROMOTE' Then 17309 Do 17310 If batch Then _basefile = GenerateJobBaseFile() 17311 retcode = RunPromote( repository, lab, _basefile, batch ) 17312 /* 17313 * Write the return code to the indicator file... 17314 */ 17315 Call Stream _basefile, 'C', 'OPEN WRITE REPLACE' 17316 Call Lineout _basefile,retcode 17317 Call Stream _basefile, 'C', 'CLOSE' 17318 End 17319 When cmd = 'ADD' Then 17320 Do 17321 /* 17322 * Set the new repository details in the array, and write out the new 17323 * .qocca 17324 */ 17325 /* 17326 * If CVS pserver, we need to Call 'cvs login' to save the password 17327 * The method employed below allows 'cvs login' to take the password 17328 * from an environment variable rather than prompting the user. 17329 */ 17330 If _cvstype = 'pserver' Then 17331 Do 17332 /* 17333 ( If no username/password supplied there must be an existing 17334 * password in .cvspass for this repository 17335 */ 17336 fullpath = ':pserver:'_username'@'_server':'repository 17337 If _password = '_PASSWORD' Then Nop 17338 Else 17339 Do 17340 Call Value 'CVS_PASS', _password, 'ENVIRONMENT' 17341 cmd = 'cvs -q -d' fullpath 'login' 17342 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 17343 Address System cmd 17344 If rc \= 0 Then 17345 Call AbortText 'An error occured logging onto the repository at:' fullpath 17346 Call Value 'CVS_PASS', '', 'ENVIRONMENT' 17347 End 17348 End 17349 If !global.!!number_repositories = 0 | Left( !global.!!number_repositories, 1 ) = '!' Then !global.!!number_repositories = 1 17350 Else !global.!!number_repositories = !global.!!number_repositories + 1 17351 idx = !global.!!number_repositories 17352 17353 !global.!!repository.!!type.idx = _sourcecontrol 17354 If !global.!!repository.!!type.idx = 'cvs' Then 17355 Do 17356 Select 17357 When _cvstype = 'local' Then !global.!!repository.!!path.idx = ':local:'repository 17358 When _cvstype = 'pserver' Then !global.!!repository.!!path.idx = fullpath 17359 Otherwise !global.!!repository.!!path.idx = ':ext:'user'@'server':'repository 17360 End 17361 !global.!!repository.!!contype.idx = _cvstype 17362 !global.!!repository.!!enhanced_cvs.idx = 'Y' 17363 !global.!!repository.!!cvsport.idx = '2401' 17364 End 17365 Else 17366 Do 17367 !global.!!repository.!!contype.idx = '' 17368 !global.!!repository.!!path.idx = repository 17369 !global.!!repository.!!enhanced_cvs.idx = '' 17370 !global.!!repository.!!cvsport.idx = '' 17371 End 17372 !global.!!repository.!!username.idx = _username 17373 !global.!!repository.!!password.idx = '' 17374 !global.!!repository.!!shortpath.idx = repository 17375 !global.!!repository.!!server.idx = _server 17376 !global.!!repository.!!name.idx = _name 17377 !global.!!repository.!!working_dir.idx = _working 17378 !global.!!repository.!!last_tree_opened.idx = '' 17379 !global.!!repository.!!public_cvs.idx = '' 17380 !global.!!repository.!!public_cvs_dirs.idx = '' 17381 !global.!!repository.!!filefilters.idx = '' 17382 !global.!!repository.!!cvs_compression.idx = '-z3' 17383 /* 17384 * Create the working directory if it dowsn't exist 17385 */ 17386 Call CreateDirectory _working 17387 /* 17388 * Ensure that WriteUserSettingsFile() actually works 17389 */ 17390 !!last_repository = idx 17391 !global.!!user.!!textpager = 'more' 17392 Call WriteUserSettingsFile 17393 End 17394 When cmd = 'EXPORT' Then 17395 Do 17396 Call Time 'R' 17397 /* 17398 * If not exporting Latest, check if it has been labeled 17399 */ 17400 If lab \= 'Latest' Then 17401 Do 17402 If IsFileInRepository( !global.!current_dirname.!!last_repository'/.label-'lab ) = 0 Then 17403 Do 17404 Call AbortText '"ERROR: Module:' quote( !global.!current_dirname.!!last_repository ) 'does not have a label of:' lab'"' 17405 Return 1 17406 End 17407 End 17408 build_dir = !global.!current_dirname.!!last_repository 17409 /* 17410 * Ensure the specified working directory is not the same as the project's 17411 * working directory 17412 */ 17413 If Stream( build_dir, 'C', 'QUERY EXISTS' ) = Stream( native_working_dir, 'C', 'QUERY EXISTS' ) Then 17414 Do 17415 Call AbortText '"ERROR: Specified working directory:' quote( native_working_dir ) "cannot be the same as the project's working directory of:" quote( build_dir ) 17416 Return 1 17417 End 17418 /* 17419 * Create the working directory if necessary 17420 */ 17421 Address System !global.!cmdmkdir quote( native_working_dir ) 17422 /* 17423 * ... and change to it 17424 */ 17425 Call Directory( native_working_dir ) 17426 outputfile = Changestr( '/', native_working_dir||!global.!ossep||'qocca_bg_'||Date('S')||Changestr(':', Time(), '' ), !global.!ossep ) || '.out' 17427 /* 17428 * Export the directory tree 17429 * Due to an annoying feature of CVS, we can't export to a local 17430 * directory pointed to by the -d switch, so we have to check out 17431 * each file seperately to the correct directory 17432 */ 17433 If lab = 'Latest' Then 17434 Do 17435 /* 17436 * Get a list of all files in the module with their revision 17437 * numbers 17438 */ 17439 Select 17440 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 17441 Do 17442 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list' quote( !global.!current_dirname.!!last_repository ) 17443 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 17444 Address System cmd With Output Stem out. Error Stem err. 17445 /* TODO don't use cvs list!!! */ 17446 Do i = 1 To out.0 17447 Parse Var out.i . rev . . . . flen . 17448 Parse Var out.i 92 fn +(flen) +1 . 17449 out.i = rev fn 17450 End 17451 End 17452 Otherwise Nop 17453 End 17454 End 17455 Else 17456 Do 17457 /* 17458 * Read the label file from the repository into a stem 17459 */ 17460 Select 17461 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 17462 Do 17463 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q checkout -p' quote( !global.!current_dirname.!!last_repository'/.label-'lab ) 17464 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 17465 Address System cmd With Output Stem out. Error Stem junk. 17466 End 17467 Otherwise Nop 17468 End 17469 End 17470 dirlen = Length( !global.!current_dirname.!!last_repository ) 17471 /* 17472 * If the OS can handle symlinks, then check if the common dirs are in the out. stem 17473 * and check these out first. Then we can create local symlinks and not have to checkout 17474 * all the linked files. 17475 * We then ignore the files we checked out previously 17476 */ 17477 ignore. = 0 17478 If !global.!symlink \= '' Then 17479 Do 17480 Do j = 1 To !global.!common_dir.0 17481 dir = Substr( !global.!common_dir.j, 2 ) || '/' 17482 len = Length( dir ) 17483 Do i = 1 To out.0 17484 If Strip( out.i) = '' | Left( out.i, 1 ) = ';' Then Iterate i 17485 Parse Var out.i rev fn 17486 If Left( fn, len ) = dir Then 17487 Do 17488 have_common_dir.j = 1 17489 ignore.i = 1 -- this ensures we don't check this file out again below 17490 Call CheckoutAFile rev, fn, build_dir, dirlen, batch, outputfile, continuecheckout 17491 End 17492 End 17493 End 17494 /* 17495 * Now for all files check if they are in the linked directories 17496 * that we have checked out above and set their ignore flag 17497 */ 17498 Do i = 1 To out.0 17499 If Strip( out.i) = '' | Left( out.i, 1 ) = ';' Then Iterate i 17500 Parse Var out.i rev fn 17501 Do j = 1 To !global.!linked_dir.0 17502 ld = Substr( !global.!linked_dir.j, 2 ) || '/' 17503 len = Length( ld ) 17504 If ld = Left( fn, len ) Then 17505 Do 17506 idx = !global.!linked_idx.j 17507 If have_common_dir.idx = 1 Then 17508 Do 17509 ignore.i = 1 17510 End 17511 End 17512 End 17513 End 17514 /* 17515 * Now create symbolic links so any updated files get 17516 * checked out into the common area 17517 */ 17518 tmpdir = Directory() 17519 /* 17520 * We now need to go through the linked directories and setup all of the 17521 * symbolic links to the common dirs 17522 */ 17523 Do j = 1 To !global.!linked_dir.0 17524 common_idx = !global.!linked_idx.j 17525 If have_common_dir.common_idx = 1 Then 17526 Do 17527 Call Directory tmpdir 17528 /* 17529 * Work out how to get the correct relative path for linking 17530 */ 17531 pos = Lastpos( '/', !global.!linked_dir.j ) 17532 linked_dirname = Substr( !global.!linked_dir.j, 1, pos - 1 ) /* eg /test/dir1/dir2 */ 17533 common_dirname = !global.!common_dir.common_idx /* /common */ 17534 mycomm = common_dirname 17535 newdir = linked_dirname 17536 Do i = 1 To Min( Length( mycomm ), Length( newdir ) ) 17537 If Substr( mycomm, i, 1 ) = '/' Then last_dir_pos = i 17538 If Substr( mycomm, i, 1 ) \= Substr( newdir, i, 1 ) Then Leave 17539 End 17540 rel_linked = Substr( newdir, last_dir_pos + 1 ) 17541 rel_common = Substr( mycomm, last_dir_pos + 1 ) 17542 /* 17543 * Now symlink the common dir to the linked dirname 17544 * eg. Linking /tmfps/common to /tmfps/app/common 17545 * cd /tmfps/app 17546 * ln -sf ../common . 17547 */ 17548 Say '"Linking directory' quote( build_dir'/'rel_common ) 'to current directory:' quote( build_dir'/'rel_linked )'"' 17549 /* 17550 * Create (it doesn't exist) and change directory to linked dir 17551 */ 17552 Call CreateDirectory build_dir'/'rel_linked 17553 Call Directory build_dir'/'rel_linked 17554 cmd = !global.!symlink quote( '../'rel_common ) '.' 17555 Address Command cmd 17556 End 17557 End 17558 Call Directory tmpdir 17559 End 17560 /* 17561 * We now have a stem; out. with all files and their revision numbers 17562 */ 17563 checkedout_dirs.0 = 0 17564 Do i = 1 To out.0 17565 If Strip( out.i) = '' | Left( out.i, 1 ) = ';' Then Iterate i 17566 /* 17567 * If we have our ignore flag set, ignore the entry 17568 */ 17569 If ignore.i = 1 Then Iterate i 17570 Parse Var out.i rev fn 17571 /* 17572 * Determine if we have already checked out this directory. 17573 */ 17574 outfile = build_dir||Substr( fn, dirlen+1 ) 17575 outpos = Lastpos( '/', outfile ) 17576 outdir = Substr( outfile, 1, outpos-1 ) 17577 found = 0 17578 Do j = 1 To checkedout_dirs.0 17579 If outdir = checkedout_dirs.j Then 17580 Do 17581 found = 1 17582 Leave 17583 End 17584 End 17585 If found = 0 Then 17586 Do 17587 Call Runner batch, outputfile, !global.!cmdecho '"Checking out files for directory:' outdir'"' 17588 j = 1 + checkedout_dirs.0 17589 checkedout_dirs.j = outdir 17590 checkedout_dirs.0 = j 17591 End 17592 rc = CheckoutAFile( rev, fn, build_dir, dirlen, batch, outputfile, continuecheckout ) 17593 If rc \= 0 Then 17594 Do 17595 Return rc 17596 End 17597 End 17598 -- remove the outputfile; we don't need it 17599 Call SysFileDelete outputfile 17600 et = Time( 'E' ) 17601 Parse Var et et '.' . 17602 If et = '' Then et = 0 17603 hr = et % 3600 17604 et = et // 3600 17605 mi = et % 60 17606 se = et // 60 17607 Say '">>>>Completed successfully at' Date() Time() 'Elapsed:' Right( hr, 2, 0 )':'Right( mi, 2, 0 )':'Right( se, 2, 0)'"' 17608 End 17609 Otherwise 17610 Do 17611 Say 'This batch command has not been implemented yet.' 17612 End 17613End 17614 17615Call Directory here 17616Call CleanupAndExit retcode 17617Return /* shouldn't get here! as CleanupAndExit() exits */ 17618 17619/* 17620 * Called from batch, so use Runner etc to log details 17621 */ 17622CopyRepository: Procedure Expose !REXXDW. !global. !!last_repository 17623Parse Arg repository, new_dirname, lab, overwrite, _basefile, batch 17624outputfile = _basefile'.out' 17625retcode = 0 17626/* 17627 * If called from batch, create our description file so we can see 17628 * the job in the GUI QOCCA and use "tee" so the output goes to the ".out" file 17629 * for later viewing 17630 */ 17631If batch Then 17632 Do 17633 desc = 'Copy of version' quote( lab ) 'of' quote( !global.!current_dirname.!!last_repository ) 'to' quote( new_dirname ) 17634 type = 'copy' 17635 compiler_type = '.' 17636 Call CreateDescriptionFile _basefile, desc, type, compiler_type 17637 End 17638/* 17639 * Validate the parameters... 17640 */ 17641here = Directory() 17642If DirectoryExists( new_dirname ) = 1 & overwrite = 'OVERWRITE' Then 17643 Do 17644 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The new directory:' new_dirname 'already exists and you did not request it be overwritten."' 17645 Return 1 17646 End 17647 17648Select 17649 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 17650 Do 17651 End 17652 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 17653 Do 17654 Call Runner batch, outputfile, !global.!cmdecho '">>>>Getting label file for:' lab'"' 17655 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list' !global.!current_dirname.!!last_repository'/.label-'lab 17656 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 17657 Address Command cmd With Output Stem out. Error Stem err. 17658 If out.0 \= 1 Then 17659 Do 17660 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The supplied module:' !global.!current_dirname.!!last_repository 'does not have a label of:' lab'."' 17661 Return 1 17662 End 17663 /* 17664 * Checkout the label file into the stack, and for each 17665 * CI, export it to a temporary directory 17666 */ 17667 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout -p' !global.!current_dirname.!!last_repository'/.label-'lab 17668 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 17669 Address Command cmd With Output Stem label. Error Stem err. 17670 If label.0 = 0 Then 17671 Do 17672 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: No configuration items found in label file for version:' lab 'for module:' !global.!current_dirname.!!last_repository'."' 17673 Do i = 1 To err.0 17674 Call Runner batch, outputfile, !global.!cmdecho '"ERROR:' err.i'"' 17675 End 17676 Return 1 17677 End 17678 /* 17679 * Clean up the working directory and the new dir... 17680 */ 17681 Call Runner batch, outputfile, !global.!cmdecho '">>>>Cleaning up working directory and new repository."' 17682 cvs_tag = Changestr( '/', !global.!current_dirname.!!last_repository, '_') || '_' || lab 17683 Call Runner batch, outputfile, !global.!cmddelr working_dir 17684 Call Runner batch, outputfile, !global.!cmdmkdir working_dir 17685 17686 Call Runner batch, outputfile, !global.!cmddelr new_dirname 17687 /* 17688 * Create the new CVS repository 17689 */ 17690 Call Runner batch, outputfile, !global.!cmdecho '">>>>Creating the new repository."' 17691 Call Runner batch, outputfile, 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d' new_dirname 'init' 17692 /* 17693 * Copy repository files from old repository to new repository... 17694 * Don't copy files that are in linked directories; copy the originals 17695 * instead and create the links 17696 */ 17697 linked_dirs = '' 17698 Call Runner batch, outputfile, !global.!cmdecho '">>>>Copying repository files..."' 17699 Do i = 1 To label.0 17700 Parse Var label.i ver fn 17701 If ver = ';' Then Iterate i 17702 17703 /* 17704 * For each file, copy the CVS repository file from one 17705 * directory to another 17706 */ 17707 wrkfn = Changestr( '/', fn , !global.!ossep ) 17708 wkpos = Lastpos( !global.!ossep, wrkfn ) 17709 wkdir = Substr( wrkfn, 1, wkpos-1 ) 17710 new_repdir = new_dirname'/'wkdir 17711 old_repdir = !global.!!repository.!!shortpath.!!last_repository'/'wkdir 17712 old_fn = !global.!!repository.!!shortpath.!!last_repository'/'fn',v' 17713 /* 17714 * Is the directory linked ? 17715 */ 17716 Do j = 1 To !global.!linked_dir.0 17717 If !global.!linked_dir.j = '/'wkdir Then 17718 Do 17719 If Wordpos( j, linked_dirs ) = 0 Then 17720 Do 17721 linked_dirs = linked_dirs j 17722 End 17723 Iterate i 17724 End 17725 End 17726 If DirectoryExists( new_repdir ) = 0 Then 17727 Do 17728 /* 17729 * Create the directory in the repository if it doesn't exist 17730 */ 17731 Call Runner batch, outputfile, !global.!cmdecho '"Creating directory in repository:' new_repdir'"' 17732 Call CreateDirectory new_repdir 17733 End 17734 /* 17735 * Copy the file into the repository directory 17736 */ 17737 Call Runner batch, outputfile, !global.!cmdecho '"Copying:' old_fn 'to' new_repdir'"' 17738 retcode = Runner( batch, outputfile, 'cp' quote( old_fn ) quote( new_repdir ) ) 17739 If retcode \= 0 Then 17740 Do 17741 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: Copying' fn'"' 17742 Return 1 17743 End 17744 End 17745 /* 17746 * Find the original directories that were linked into this part of the repository 17747 * and copy all the files to the new repository. 17748 * Then symbolically link the "common" directories into the copied directories 17749 */ 17750 Call Runner batch, outputfile, !global.!cmdecho '">>>>Copying linked directories and linking directories..."' 17751 tmpdir = Directory() 17752 Call Directory new_dirname 17753 Do i = 1 To Words( linked_dirs ) 17754 idx = Word( linked_dirs, i ) 17755 common_idx = !global.!linked_idx.idx 17756 /* 17757 * If we haven't copied the common directory into the destination, 17758 * do it now 17759 */ 17760 full_common = new_dirname || !global.!common_dir.common_idx 17761 If DirectoryExists( full_common ) = 0 Then 17762 Do 17763 Call Runner batch, outputfile, !global.!cmdecho '"Creating directory in repository:' full_common'"' 17764 Call CreateDirectory full_common 17765 Call Directory !global.!!repository.!!shortpath.!!last_repository || !global.!common_dir.common_idx 17766 Address System 'tar cf - * .??* | (cd' quote( full_common )'; tar xvf -)' 17767/* 17768 Address System 'cp -pR' quote( !global.!!repository.!!shortpath.!!last_repository || !global.!common_dir.common_idx )'/$*' quote( full_common ) 17769 */ 17770 End 17771 /* 17772 * Work out how to get the correct relative path for linking 17773 */ 17774 pos = Lastpos( '/', !global.!linked_dir.idx ) 17775 linked_dirname = Substr( !global.!linked_dir.idx, 1, pos - 1 ) /* eg /test/dir1/dir2 */ 17776 common_dirname = !global.!common_dir.common_idx /* /common */ 17777 /* 17778 * Get the last directory component of the current directory 17779 */ 17780 mycomm = Strip( common_dirname, 'T', '/' ) 17781 lp = Lastpos( '/', mycomm ) 17782 lastdir = Substr( mycomm, lp ) 17783 newdir = linked_dirname || lastdir 17784 mytail = mycomm 17785 /* 17786 * Determine how many common, leading directories there are. This is used to reduce 17787 * the number of relative directories we need to go back up to find the linked 17788 * directory. 17789 * eg: 17790 * mycomm = /dir1/apath 17791 * newdir = /dir1/fred/apath 17792 * 17793 * Should result in ln -s ../apath . rather than ../../dir1/apath 17794 */ 17795 Do j = 1 To Min( Length( mycomm ), Length( newdir ) ) 17796 If Substr( mycomm, j, 1 ) = '/' Then last_dir_pos = j 17797 If Substr( mycomm, j, 1 ) \= Substr( newdir, j, 1 ) Then Leave 17798 End 17799 num_common_dirs = Countstr( '/', Substr( mycomm, 1, j ) ) - 1 17800 If num_common_dirs \= 0 Then mytail = Substr( mytail, last_dir_pos ) 17801 /* 17802 * Now symlink the common dir to the linked dirname 17803 * eg. Linking /tmfps/common to /tmfps/app/common 17804 * cd /tmfps/app 17805 * ln -sf ../common . 17806 */ 17807 Call Directory new_dirname||linked_dirname 17808 num_dots = Countstr( '/', linked_dirname ) - num_common_dirs 17809 linkdir = Copies( '../', num_dots ) || Substr( mytail, 2 ) 17810 Call Runner batch, outputfile, !global.!cmdecho '"Linking directory' quote( linkdir ) 'to current directory:' quote( new_dirname||linked_dirname )'"' 17811 Address Command !global.!symlink quote( linkdir ) . 17812 17813/* 17814 Call Directory new_dirname 17815 dest = Substr( !global.!linked_dir.idx, 2 ) 17816 pos = Lastpos( '/', dest ) 17817 dest = Substr( dest, 1, pos - 1 ) 17818 Call Runner batch, outputfile, !global.!cmdecho '"Linking directory' quote( Substr( !global.!common_dir.common_idx, 2 ) ) 'to' quote( dest )'"' 17819 Address Command !global.!symlink quote( Substr( !global.!common_dir.common_idx, 2 ) ) quote( dest ) 17820*/ 17821 17822 17823 End 17824 Call Directory tmpdir 17825 /* 17826 * Copy admin/build.conf from old repository and put it 17827 * in the new one... 17828 */ 17829 new_repdir = new_dirname'/admin' 17830 Call CreateDirectory new_repdir 17831 old_fn = !global.!!repository.!!shortpath.!!last_repository'/admin/build.conf,v' 17832 Call Runner batch, outputfile, !global.!cmdecho '">>>>Copying admin repository files..."' 17833 retcode = Runner( batch, outputfile, 'cp' quote( old_fn ) quote( new_repdir ) ) 17834 17835 working_dir = !global.!!tmpdir || 'tmpdir_' || Random( 1, 5000 ) 17836 Call Runner batch, outputfile, !global.!cmdecho '">>>>Changing to temporary working directory:' working_dir'"' 17837 Call CreateDirectory working_dir 17838 Call Directory( working_dir ) 17839 /* 17840 * Checkout the complete copied repository now, so we can work on the individual files 17841 */ 17842 Call Runner batch, outputfile, !global.!cmdecho '">>>>Checking out repository..."' 17843 Call Runner batch, outputfile, 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d:local:'new_dirname 'checkout' '.' 17844 Call Runner batch, outputfile, !global.!cmdecho '">>>>Removing recent revisions..."' 17845 file_labels = '' 17846 Do i = 1 To label.0 17847 Parse Var label.i ver fn 17848 If ver = ';' Then Iterate i 17849 /* 17850 * Get the label information out of the file in the repository 17851 */ 17852 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d:local:'new_dirname 'rlog -h' quote( fn ) 17853 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 17854 Address System cmd With Output Stem head. Error Stem err. 17855 If rc \= 0 Then 17856 Do 17857 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: Obtaining labels for' fn'"' 17858 Do j = 1 To err.0 17859 Call Runner batch, outputfile, !global.!cmdecho '"'err.j'"' 17860 End 17861 Return 1 17862 End 17863 idx = 0 17864 Do j = 1 To head.0 17865 If Strip( head.j) \= '' & Left( head.j, 1 ) = ' ' Then 17866 Do 17867 idx = idx + 1 17868 tag.idx = head.j 17869 End 17870 End 17871 tag.0 = idx 17872 /* 17873 * For each label find the revision 17874 */ 17875 Do j = 1 To tag.0 17876 Parse var tag.j ' ' lab ':' rev 17877 rev = Strip( rev ) 17878 If Datatype( ver ) \= 'NUM' Then 17879 Do 17880 /* 17881 * All numeric versions are > the labeled revision 17882 */ 17883 If Datatype( rev ) = 'NUM' Then 17884 Do 17885 If Wordpos( lab, file_labels ) = 0 Then file_labels = file_labels lab 17886 Call Runner batch, outputfile, 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d:local:'new_dirname 'rtag -d' lab quote( fn ) 17887 End 17888 End 17889 Else 17890 Do 17891 If Datatype( rev ) = 'NUM' Then 17892 Do 17893 If rev > ver Then 17894 Do 17895 If Wordpos( lab, file_labels ) = 0 Then file_labels = file_labels lab 17896 Call Runner batch, outputfile, 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d:local:'new_dirname 'rtag -d' lab quote( fn ) 17897 End 17898 End 17899 End 17900 End 17901 /* 17902 * All tags for the file after out rev have gone, delete the revisions 17903 */ 17904 If ver = '1.1.1.1' Then ver = '1.1' 17905 Call Runner batch, outputfile, 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d:local:'new_dirname 'admin -o'ver'::' quote( fn ) 17906 End 17907 /* 17908 * For each label, delete the label file... TODO 17909 */ 17910 Call Runner batch, outputfile, !global.!cmdecho '">>>>Deleting label files..."' 17911 Do j = 1 To Words( file_labels ) 17912say 'deleting label:' Word( file_labels, j ) 17913 End 17914 /* 17915 * Can't label it as the repository hasn't been set up yet 17916 * in the user's .qocca - should we? 17917 */ 17918 Call Runner batch, outputfile, !global.!cmdecho '">>>>Manual intervention required..."' 17919 Call Runner batch, outputfile, !global.!cmdecho '"If using cvs pserver, you will need to add' new_dirname 'as another repository for cvs pserver to watch."' 17920 Call Runner batch, outputfile, !global.!cmdecho '"Under Linux, this is done by changing /etc/xinted.d/cvspserver"' 17921 /* 17922 * Remove working directory 17923 */ 17924 Call Directory here 17925 Call Runner batch, outputfile, !global.!cmddelr working_dir 17926 Call Runner batch, outputfile, !global.!cmdecho '">>>>Copy complete at' Date() Time()'"' 17927 End 17928 Otherwise Nop 17929End 17930Return 0 17931 17932InitRepository: Procedure Expose !REXXDW. !global. !!last_repository 17933Parse Arg repository, _sourcecontrol, _username, _password, _module, _extraadminuser 17934Select 17935 When _sourcecontrol = 'cvs' Then 17936 Do 17937 !global.!!tmpdir = !global.!home || 'tmpdir_' || Random( 1, 5000 ) 17938 Call CreateDirectory !global.!!tmpdir 17939 Call Value 'CVSROOT', ':local:'repository, 'ENVIRONMENT' 17940 Address System !global.!cmdmkdir repository 17941 Address System 'cvs -d :local:'repository 'init' 17942 If rc \= 0 Then Call AbortText 'Cannot initialise the CVS repository for' repository 17943 Call Directory repository 17944 /* 17945 * Change to the repository root and create the admin directory and the initial 17946 * module directory. The initial module is so that an initial checkout can be 17947 * done by the client. 17948 */ 17949 Call SysMkdir 'admin' 17950 If _module \= '_MODULE' Then Call SysMkdir _module 17951 /* 17952 * As this is assumed to run on a Unix box (running :local:) 17953 * then this should be safe... 17954 */ 17955 Address System 'chmod 775 admin' 17956 Address System 'chmod 775 .' 17957 If _module \= '_MODULE' Then Address System 'chmod 775' _module 17958 /* 17959 * Create the default build.conf file 17960 */ 17961 Call Directory !global.!!tmpdir 17962 Address System 'cvs -d :local:'repository 'get .' 17963 Call Directory !global.!!tmpdir || !global.!ossep || 'admin' 17964 tmpfile = 'build.conf' 17965 If _extraadminuser = '_EXTRAADMINUSER' Then users = !global.!user 17966 Else users = !global.!user _extraadminuser 17967 Call BuildFirstBuildConf tmpfile, users 17968 Address System 'cvs -d :local:'repository 'add' tmpfile 17969 Address System 'cvs -d :local:'repository 'commit -m"Creation of build.conf"' tmpfile 17970 /* 17971 * Create build.no with number = 0 17972 */ 17973 tmpfile = 'build.no' 17974 Call Stream tmpfile, 'C', 'OPEN WRITE REPLACE' 17975 Call Lineout tmpfile, '0' 17976 Call Stream tmpfile, 'C', 'CLOSE' 17977 Address System 'cvs -d :local:'repository 'add' tmpfile 17978 Address System 'cvs -d :local:'repository 'commit -m"Creation of build.no"' tmpfile 17979 /* 17980 * Checkout the admin directory 17981 Call Directory !global.!!repository.!!working_dir.!!last_repository 17982 Address System 'cvs -d :local:'repository 'get admin' 17983 */ 17984 Call Directory !global.!home 17985 Address System !global.!cmddelr !global.!!tmpdir 17986 End 17987 Otherwise Nop 17988End 17989Return 17990 17991/* 17992 * TODO - look at consolidating this and CreateDummyBuildConf 17993 */ 17994BuildFirstBuildConf: Procedure Expose !REXXDW. !global. !!last_repository 17995Parse Arg tmpfile, users 17996Call Stream tmpfile, 'C', 'OPEN WRITE REPLACE' 17997Call Lineout tmpfile, '!admin_users="'users'"' 17998Call Lineout tmpfile, '!admin_email="'users'"' 17999Call Lineout tmpfile, '!build_users="'users'"' 18000Call Lineout tmpfile, '!update_users="'users'"' 18001Call Lineout tmpfile, '!platforms="'!global.!os'"' 18002Call Lineout tmpfile, '!common_dir.0="0"' 18003Call Lineout tmpfile, '!linked_dir.0="0"' 18004Call Lineout tmpfile, '!linked_idx.0="0"' 18005Call Lineout tmpfile, '!reservedcheckout="N"' 18006Call Lineout tmpfile, '!versionenvvar="VERSION"' 18007Call Lineout tmpfile, '!buildenvvar="BUILD"' 18008Call Lineout tmpfile, '!builddir="build"' 18009Call Lineout tmpfile, '!logdir="log"' 18010Call Lineout tmpfile, '!runtime_envs=""' 18011Call Lineout tmpfile, '!ignorefiles=""' 18012Call Stream tmpfile, 'C', 'CLOSE' 18013Return 18014 18015/* 18016 * Run a command with output going to the specified 'outputfile' 18017 * For a command run in batch the output also goes to 'stdout' 18018 */ 18019Runner: Procedure Expose !REXXDW. !global. !!last_repository 18020Parse Arg batch, outputfile, cmd 18021If batch Then 18022 Do 18023 Address System cmd '2>&1 |' !global.!cmdtee '-a' outputfile 18024 retcode = rc 18025 End 18026Else 18027 Do 18028 Address System cmd With Output Append Stream outputfile Error Append Stream outputfile 18029 retcode = rc 18030 End 18031Return retcode 18032 18033/* 18034 * Write the specified text to the specified 'outputfile' 18035 * For a batch echo, also 'say' it 18036 */ 18037Echo: Procedure Expose !REXXDW. !global. !!last_repository 18038Parse Arg batch, outputfile, str 18039Call Stream outputfile, 'C', 'OPEN WRITE APPEND' 18040Call Lineout outputfile,str 18041Call Stream outputfile, 'C', 'CLOSE' 18042If batch Then Say str 18043Return 0 18044 18045ModsReport: Procedure Expose !REXXDW. !global. !!last_repository 18046Parse Arg repno, earlier_repno, newlab, oldlab, noprogress, ignorewhitespace, _basefile, batch, _latest_dirname, _earlier_dirname, _wc_flag, _sa_flag 18047If _wc_flag = '_WC_FLAG' Then _wc_flag = 0 18048Else _wc_flag = 1 18049If _sa_flag = '_SA_FLAG' Then _sa_flag = 0 18050Else _sa_flag = 1 18051/* 18052 * - Check if both newlab and oldlab labels exist for the module in the repository 18053 * - Compare the label files for each label 18054 */ 18055new_heading = !global.!!repository.!!name.repno':'_latest_dirname'('newlab')' 18056old_heading = !global.!!repository.!!name.earlier_repno':'_earlier_dirname'('oldlab')' 18057diffs = old_heading 'and' new_heading 18058If batch Then 18059 Do 18060 /* 18061 * Called from batch, create our description file so we can see 18062 * the job in the GUI QOCCA and use "tee" so the output goes to the ".out" file 18063 * for later viewing 18064 */ 18065 report_desc = 'Report differences between:' diffs 18066 type = 'mods' 18067 compiler_type = '.' 18068 Call CreateDescriptionFile _basefile, report_desc, type, compiler_type 18069 End 18070outputfile = _basefile'.out' 18071Call Runner batch, outputfile, !global.!cmdecho '">>>>Reading label files from repository..."' 18072 18073if trace() = 'F' Then say repno earlier_repno newlab oldlab noprogress ignorewhitespace basefile 18074dirlen = Length( _latest_dirname ) 18075earlier_dirlen = Length( _earlier_dirname ) 18076/* 18077 * Both repository types must be the same... 18078 */ 18079If !global.!!repository.!!type.repno \= !global.!!repository.!!type.earlier_repno Then Call AbortText 'The repository types are different;' !global.!!repository.!!name.repno 'is' !global.!!repository.!!type.repno',' !global.!!repository.!!name.earlier_repno 'is' !global.!!repository.!!type.earlier_repno 18080Select 18081 When !global.!!repository.!!type.repno = 'cvs' Then 18082 Do 18083 /* 18084 * Check value of label for "earlier" version... 18085 */ 18086 /* 18087 * First check if label is "Latest". If so, get the list of files from the 18088 * repository, not the label file 18089 */ 18090 Select 18091 When oldlab = 'Latest' Then 18092 Do 18093 /* 18094 * We need to be in the working_dir for earlier_repno 18095 */ 18096 here = Directory() 18097 Call Directory !global.!!repository.!!working_dir.earlier_repno 18098 olddir = _earlier_dirname 18099 If GetListOfCVSFilesInDirectory( earlier_repno, _earlier_dirname, 0 ) \= 0 Then 18100 Do 18101 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: Getting Latest file list from:' !global.!!repository.!!name.earlier_repno' Command:' cmd'"' 18102 Do i = 1 To err.0 18103 Call Runner batch, outputfile, !global.!cmdecho '" 'err.i'"' 18104 End 18105 Call Directory here 18106 Return 1 18107 End 18108 Do i = 1 To item.0 18109 Parse Var item.i . rev . . . . flen . 18110 Parse Var item.i 92 fn +(flen) +1 . 18111 oldfile.i = rev fn 18112 End 18113 oldfile.0 = item.0 18114 Drop item. 18115 Call Directory here 18116 End 18117 When oldlab = 'Working' Then 18118 Do 18119 offset = Length( !global.!!repository.!!shortpath.earlier_repno||!global.!ossep ) + 1 18120 olddir = _earlier_dirname 18121 /* 18122 * We need to be in the working_dir for earlier_repno 18123 */ 18124 here = Directory() 18125 Call Directory !global.!!repository.!!working_dir.earlier_repno 18126 cmd = 'cvs' !global.!!repository.!!cvs_compression.earlier_repno '-d'!global.!!repository.!!path.earlier_repno '-q status' quote( _earlier_dirname ) 18127 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 18128 Address System cmd With Output Stem out. Error Stem err. 18129 If rc \= 0 Then 18130 Do 18131 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: Getting Working file list from working directory for:' _earlier_dirname 'in repository' !global.!!repository.!!name.earlier_repno'"' 18132 Do i = 1 To err.0 18133 Call Runner batch, outputfile, !global.!cmdecho err.i 18134 End 18135 Call Directory here 18136 Return 1 18137 End 18138 idx = 0 18139 Do i = 1 To out.0 18140 Parse Var out.i . 'Status:' stat 18141 If stat \= '' Then 18142 Do 18143 i_off = i + 2 18144 Parse Var out.i_off . 'Working revision:' rev . 18145 i_off = i_off + 1 18146 Parse Var out.i_off . 'Repository revision:' rep_rev fn 18147 If Datatype( Changestr( '.', rep_rev, '' ) ) = 'NUM' Then 18148 Do 18149 idx = idx + 1 18150 If stat = 'Locally Modified' Then rev = rev'+' 18151 oldfile.idx = Substr( fn, offset ) 18152 oldfile.idx = rev Left( oldfile.idx, Length( oldfile.idx ) - 2 ) 18153 End 18154 End 18155 End 18156 Call Directory here 18157 oldfile.0 = idx 18158 End 18159 Otherwise /* explicit version */ 18160 Do 18161 Parse Var oldlab olddir ',' oldlab 18162 oldlabelfile = olddir || '/.label-' || oldlab 18163 /* 18164 * We need to be in the working_dir for earlier_repno 18165 */ 18166 here = Directory() 18167 Call Directory !global.!!repository.!!working_dir.earlier_repno 18168 cmd = 'cvs' !global.!!repository.!!cvs_compression.earlier_repno '-d'!global.!!repository.!!path.earlier_repno '-q get -p' quote( oldlabelfile ) 18169 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 18170 Address System cmd With Output Stem oldfile. Error Stem junk. 18171 If oldfile.0 = 0 Then 18172 Do 18173 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The Earlier Version:' oldlab 'has not been labeled"' 18174 Call Directory here 18175 Return 1 18176 End 18177 Call Directory here 18178 End 18179 End 18180 /* 18181 * Check value of label for "later" version... 18182 */ 18183 /* 18184 * First check if label is "Latest". If so, get the list of files from the 18185 * repository, not the label file 18186 */ 18187 Select 18188 When newlab = 'Latest' Then 18189 Do 18190 /* 18191 * We need to be in the working_dir for repno 18192 */ 18193 here = Directory() 18194 Call Directory !global.!!repository.!!working_dir.repno 18195 newdir = _latest_dirname 18196 If GetListOfCVSFilesInDirectory( repno, _latest_dirname, 0 ) \= 0 Then 18197 Do 18198 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: Getting Latest file list from:' !global.!!repository.!!name.repno' Command:' cmd'"' 18199 Do i = 1 To err.0 18200 Call Runner batch, outputfile, !global.!cmdecho '" 'err.i'"' 18201 End 18202 Call Directory here 18203 Return 1 18204 End 18205 Do i = 1 To item.0 18206 Parse Var item.i . rev . . . . flen . 18207 Parse Var item.i 92 fn +(flen) +1 . 18208 newfile.i = rev fn 18209 End 18210 newfile.0 = item.0 18211 Drop item. 18212 Call Directory here 18213 End 18214 When newlab = 'Working' Then 18215 Do 18216 offset = Length( !global.!!repository.!!shortpath.repno||!global.!ossep ) + 1 18217 newdir = _latest_dirname 18218 /* 18219 * We need to be in the working_dir for repno 18220 */ 18221 here = Directory() 18222 Call Directory !global.!!repository.!!working_dir.repno 18223 cmd = 'cvs' !global.!!repository.!!cvs_compression.repno '-d'!global.!!repository.!!path.repno '-q status' quote( _latest_dirname ) 18224 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 18225 Address System cmd With Output Stem out. Error Stem err. 18226 If rc \= 0 Then 18227 Do 18228 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: Getting Working file list from working directory for:' _latest_dirname 'in repository' !global.!!repository.!!name.repno'"' 18229 Do i = 1 To err.0 18230 Call Runner batch, outputfile, !global.!cmdecho err.i 18231 End 18232 Call Directory here 18233 Return 1 18234 End 18235 idx = 0 18236 Do i = 1 To out.0 18237 Parse Var out.i . 'Status:' stat 18238 If stat \= '' Then 18239 Do 18240 i_off = i + 2 18241 Parse Var out.i_off . 'Working revision:' rev . 18242 i_off = i_off + 1 18243 Parse Var out.i_off . 'Repository revision:' rep_rev fn 18244 If Datatype( Changestr( '.', rep_rev, '' ) ) = 'NUM' Then 18245 Do 18246 idx = idx + 1 18247 If stat = 'Locally Modified' Then rev = rev'+' 18248 newfile.idx = Substr( fn, offset ) 18249 newfile.idx = rev Left( newfile.idx, Length( newfile.idx ) - 2 ) 18250 End 18251 End 18252 End 18253 Call Directory here 18254 newfile.0 = idx 18255 End 18256 Otherwise /* explicit version */ 18257 Do 18258 Parse Var newlab newdir ',' newlab 18259 newlabelfile = newdir || '/.label-' || newlab 18260 /* 18261 * We need to be in the working_dir for repno 18262 */ 18263 here = Directory() 18264 Call Directory !global.!!repository.!!working_dir.repno 18265 cmd = 'cvs' !global.!!repository.!!cvs_compression.repno '-d'!global.!!repository.!!path.repno '-q get -p' quote( newlabelfile ) 18266 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 18267 Address System cmd With Output Stem newfile. Error Stem junk. 18268 If newfile.0 = 0 Then 18269 Do 18270 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The Later Version:' newlab 'has not been labeled"' 18271 Call Directory here 18272 Return 1 18273 End 18274 Call Directory here 18275 End 18276 End 18277 End 18278 Otherwise Nop 18279End 18280 18281Call Runner batch, outputfile, !global.!cmdecho '">>>>Sorting label files..."' 18282/* 18283 * Remove comments and other junk from (earlier) label file and sort it 18284 */ 18285idx = 0 18286Do i = 1 To oldfile.0 18287 rev = Word( oldfile.i, 1 ) 18288 mod = Subword( oldfile.i, 2 ) 18289 /* 18290 * Support old label files that had the ,v files listed. Strip the ,v if it exists 18291 */ 18292 If Right( mod, 2 ) = ',v' Then mod = Changestr( ',v', mod, '' ) 18293 /* 18294 * Only include non-comment lines and modules that have the 18295 * same leading directory as the specified module (this is for 18296 * reporting on a label done at a higher level than where we are ) 18297 */ 18298 If rev \= ';' & Left( mod, earlier_dirlen ) = _earlier_dirname Then 18299 Do 18300 idx = idx + 1 18301/* 18302 oldfile.idx = Left( rev, 10 ) mod 18303*/ 18304 oldfile.idx = Left( rev, 10 ) Substr( mod, earlier_dirlen+2 ) 18305 End 18306End 18307oldfile.0 = idx 18308Call SysStemSort 'oldfile.', 'ascending', 'sensitive', , , 12, 250 18309 18310/* 18311 * Remove comments and other junk from (later) label file and sort it 18312 */ 18313idx = 0 18314Do i = 1 To newfile.0 18315 rev = Word( newfile.i, 1 ) 18316 mod = Subword( newfile.i, 2 ) 18317 /* 18318 * Support old label files that had the ,v files listed. Strip the ,v if it exists 18319 */ 18320 If Right( mod, 2 ) = ',v' Then mod = Changestr( ',v', mod, '' ) 18321 /* 18322 * Only include non-comment lines and modules that have the 18323 * same leading directory as the specified module (this is for 18324 * reporting on a label done at a higher level than where we are ) 18325 */ 18326 If rev \= ';' & Left( mod, dirlen ) = _latest_dirname Then 18327 Do 18328 idx = idx + 1 18329/* 18330 newfile.idx = Left( rev, 10 ) mod 18331*/ 18332 newfile.idx = Left( rev, 10 ) Substr( mod, dirlen+2 ) 18333 End 18334End 18335newfile.0 = idx 18336Call SysStemSort 'newfile.', 'ascending', 'sensitive', , , 12, 250 18337Call Runner batch, outputfile, !global.!cmdecho '">>>>Comparing label files..."' 18338old_file = Strip( SubWord( oldfile.1, 2 ) ) 18339old_rev = Strip( Word( oldfile.1, 1 ) ) 18340new_file = Strip( SubWord( newfile.1, 2 ) ) 18341new_rev = Strip( Word( newfile.1, 1 ) ) 18342old_idx = 1 18343new_idx = 1 18344comb_idx = 0 18345eof = Copies('z', 10) 18346Do Forever 18347 Select 18348 When old_file > new_file Then /* added in new */ 18349 Do 18350 comb_idx = comb_idx + 1 18351 comb.comb_idx = '-' new_rev new_file 18352 If new_idx = newfile.0 Then new_file = eof 18353 Else 18354 Do 18355 new_idx = new_idx + 1 18356 new_file = Strip( SubWord( newfile.new_idx, 2 ) ) 18357 new_rev = Strip( Word( newfile.new_idx, 1 ) ) 18358 End 18359 End 18360 When old_file < new_file Then /* deleted in new */ 18361 Do 18362 comb_idx = comb_idx + 1 18363 comb.comb_idx = old_rev '-' old_file 18364 If old_idx = oldfile.0 Then old_file = eof 18365 Else 18366 Do 18367 old_idx = old_idx + 1 18368 old_file = Strip( SubWord( oldfile.old_idx, 2 ) ) 18369 old_rev = Strip( Word( oldfile.old_idx, 1 ) ) 18370 End 18371 End 18372 Otherwise /* same file */ 18373 Do 18374 comb_idx = comb_idx + 1 18375 comb.comb_idx = old_rev new_rev old_file 18376 If old_idx = oldfile.0 Then old_file = eof 18377 Else 18378 Do 18379 old_idx = old_idx + 1 18380 old_file = Strip( SubWord( oldfile.old_idx, 2 ) ) 18381 old_rev = Strip( Word( oldfile.old_idx, 1 ) ) 18382 End 18383 If new_idx = newfile.0 Then new_file = eof 18384 Else 18385 Do 18386 new_idx = new_idx + 1 18387 new_file = Strip( SubWord( newfile.new_idx, 2 ) ) 18388 new_rev = Strip( Word( newfile.new_idx, 1 ) ) 18389 End 18390 End 18391 End 18392 If old_file = eof & new_file = eof Then Leave 18393End 18394comb.0 = comb_idx 18395color_changed = '#87ceeb' 18396color_deleted = '#ff7800' 18397color_added = '#2eee57' 18398/* 18399 * Write the reports 18400 */ 18401 18402Call Runner batch, outputfile, !global.!cmdecho '">>>>Writing report files..."' 18403 18404jobdatetime = Right( _basefile, 14 ) 18405jobdate = Date( 'N', Left( jobdatetime, 8 ), 'S' ) 18406jobtime = Substr( jobdatetime, 9, 2 )':'Substr( jobdatetime, 11, 2 )':'Substr( jobdatetime, 13, 2 ) 18407jobdatetime = 'Job started on:' jobdate 'at' jobtime 18408rbasefile = '.'Substr( _basefile, Lastpos( !global.!ossep, _basefile ) ) 18409If _sa_flag Then 18410 Do 18411 detail = _basefile'.detail.html' 18412 Call Stream detail, 'C', 'OPEN WRITE REPLACE' 18413 Call Lineout detail, '<html><head><title>Details of Differences between:' diffs'</title></head><body bgcolor='!global.!color_background'>' 18414 Call Lineout detail, '<center><h1>Details of Differences</h1></center>' 18415 Call Lineout detail, '<center><h2>'old_heading'</h2></center>' 18416 Call Lineout detail, '<center><h2>'new_heading'</h2></center>' 18417 Call Lineout detail, '<center><h2>'jobdatetime'</h2></center>' 18418 Call Lineout detail, '<hr>' 18419 Call Lineout detail, '<center><table border=1 cellspacing=5 cellpadding=2><tr align="center">' 18420 Call Lineout detail, '<td width=33% bgcolor='color_changed'>File Changed</td><td width=33% bgcolor='color_added'>File Added</td><td width=33% bgcolor='color_deleted'>File Deleted</td>' 18421 Call Lineout detail, '</tr></table><//center><p>' 18422 Call Lineout detail, '<center><table border=1 cellspacing=5 cellpadding=2><tr align="center">' 18423 Call Lineout detail, '<td><b>'!global.!!repository.!!name.earlier_repno'<br>'olddir'<br>'oldlab'</b></td>' 18424 Call Lineout detail, '<td><b>'!global.!!repository.!!name.repno'<br>'newdir'<br>'newlab'</b></td>' 18425 Call Lineout detail, '<td><b>File</b></td>' 18426 Call Lineout detail, '</tr>' 18427 End 18428 18429summary = _basefile'.summary.html' 18430Call Stream summary, 'C', 'OPEN WRITE REPLACE' 18431Call Lineout summary, '<html><head><title>Summary of Differences between:' diffs'</title></head><body bgcolor='!global.!color_background'>' 18432Call Lineout summary, '<center><h1>Summary of Differences</h1></center>' 18433Call Lineout summary, '<center><h2>'old_heading'</h2></center>' 18434Call Lineout summary, '<center><h2>'new_heading'</h2></center>' 18435Call Lineout summary, '<center><h2>'jobdatetime'</h2></center>' 18436Call Lineout summary, '<hr>' 18437Call Lineout summary, '<center><table border=1 cellspacing=5 cellpadding=2><tr align="center">' 18438Call Lineout summary, '<td width=33% bgcolor='color_changed'>File Changed</td><td width=33% bgcolor='color_added'>File Added</td><td width=33% bgcolor='color_deleted'>File Deleted</td>' 18439Call Lineout summary, '</tr></table><//center><p>' 18440Call Lineout summary, '<center><table border=1 cellspacing=5 cellpadding=2><tr align="center">' 18441Call Lineout summary, '<td><b>'!global.!!repository.!!name.earlier_repno'<br>'olddir'<br>'oldlab'</b></td>' 18442Call Lineout summary, '<td><b>'!global.!!repository.!!name.repno'<br>'newdir'<br>'newlab'</b></td>' 18443Call Lineout summary, '<td><b>File</b></td>' 18444Call Lineout summary, '</tr>' 18445 18446If _sa_flag Then 18447 Do 18448 currents = _basefile'.currents.html' 18449 Call Stream currents, 'C', 'OPEN WRITE REPLACE' 18450 Call Lineout currents, '<html><head><title>Current Revisions between:' diffs'</title></head><body bgcolor='!global.!color_background'>' 18451 Call Lineout currents, '<center><h1>Current Revisions</h1></center>' 18452 Call Lineout currents, '<center><h2>'new_heading'</h2></center>' 18453 Call Lineout currents, '<center><h2>'jobdatetime'</h2></center>' 18454 Call Lineout currents, '<hr>' 18455 Call Lineout currents, '<center><table border=1 cellspacing=5 cellpadding=2><tr align="center">' 18456 Call Lineout currents, '<td width=33% bgcolor='color_changed'>File Changed</td><td width=33% bgcolor='color_added'>File Added</td><td width=33% bgcolor='color_deleted'>File Deleted</td>' 18457 Call Lineout currents, '</tr></table><//center><p>' 18458 Call Lineout currents, '<center><table border=1 cellspacing=5 cellpadding=2><tr align="center">' 18459 Call Lineout currents, '<td><b>'!global.!!repository.!!name.repno'<br>'newdir'<br>'newlab'</b></td>' 18460 Call Lineout currents, '<td><b>File</b></td>' 18461 Call Lineout currents, '</tr>' 18462 End 18463 18464differences_item = 0 18465differences = _basefile'.differences.html' 18466rdifferences = '.'Substr( differences, Lastpos( !global.!ossep, differences ) ) 18467Call Stream differences, 'C', 'OPEN WRITE REPLACE' 18468Call Lineout differences, '<html><head><title>Detailed Differences between:' diffs'</title></head><body bgcolor='!global.!color_background'>' 18469Call Lineout differences, '<a name="item0"></a>' 18470Call Lineout differences, '<center><h1>Detailed Differences</h1></center>' 18471Call Lineout differences, '<center><h2>'old_heading'</h2></center>' 18472Call Lineout differences, '<center><h2>'new_heading'</h2></center>' 18473Call Lineout differences, '<center><h2>'jobdatetime'</h2></center>' 18474Call Lineout differences, '<p>' 18475 18476comments_item = 0 18477comments = _basefile'.comments.html' 18478rcomments = '.'Substr( comments, Lastpos( !global.!ossep, comments ) ) 18479Call Stream comments, 'C', 'OPEN WRITE REPLACE' 18480Call Lineout comments, '<html><head><title>Detailed Comments between:' diffs'</title></head><body bgcolor='!global.!color_background'>' 18481Call Lineout comments, '<a name="item0"></a>' 18482Call Lineout comments, '<center><h1>Detailed Comments</h1></center>' 18483Call Lineout comments, '<center><h2>'old_heading'</h2></center>' 18484Call Lineout comments, '<center><h2>'new_heading'</h2></center>' 18485Call Lineout comments, '<center><h2>'jobdatetime'</h2></center>' 18486Call Lineout comments, '<center>If comparing between the "Working" version and the "Latest" version, no comments are produced.</center>' 18487Call Lineout comments, '<p>' 18488Call Lineout comments, '<hr>' 18489 18490Call Runner batch, outputfile, !global.!cmdecho '">>>> Summary report: ' summary'"' 18491If _sa_flag Then 18492 Do 18493 Call Runner batch, outputfile, !global.!cmdecho '">>>> Detail report: ' detail'"' 18494 Call Runner batch, outputfile, !global.!cmdecho '">>>> Current Revisions report: ' currents'"' 18495 End 18496Call Runner batch, outputfile, !global.!cmdecho '">>>> Differences report: ' differences'"' 18497Call Runner batch, outputfile, !global.!cmdecho '">>>> Comments report: ' comments'"' 18498If ignorewhitespace = '' Then diffflags = '-bw' 18499Else diffflags = '' 18500 18501If !global.!!repository.!!enhanced_cvs.!!last_repository = 'Y' Then logcmd = 'rlog' 18502Else logcmd = 'log' 18503 18504Do i = 1 To comb.0 18505 oldrev = Word( comb.i, 1 ) 18506 newrev = Word( comb.i, 2 ) 18507 fn = SubWord( comb.i, 3 ) 18508 _latest_fn = _latest_dirname'/'fn 18509 _earlier_fn = _earlier_dirname'/'fn 18510 /* 18511 * We need to get the description of the file now so it can be added to the 18512 * details report filename 18513 */ 18514 state = 'start' 18515 fn_desc = '' 18516 Select 18517 When !global.!!repository.!!type.repno = 'cvs' Then 18518 Do 18519 If _sa_flag | oldrev \= newrev Then 18520 Do 18521 cmd = 'cvs' !global.!!repository.!!cvs_compression.repno '-d'!global.!!repository.!!path.repno '-q' logcmd '-t' quote( _latest_fn ) 18522 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 18523 Address System cmd With Output FIFO '' 18524 Do Queued() 18525 Parse Pull line 18526 Select 18527 When state = 'start' Then 18528 Do 18529 If Left( line, 12 ) = 'description:' Then state = 'desc' 18530 End 18531 When state = 'desc' Then 18532 Do 18533 If Left( line, 10 ) = Copies( '=', 10 ) Then state = 'done' 18534 Else fn_desc = fn_desc'<br>'line 18535 End 18536 Otherwise Nop 18537 End 18538 End 18539 End 18540 End 18541 Otherwise Nop 18542 End 18543 If _sa_flag Then 18544 Do 18545 Call Lineout currents, '<tr><td>'newrev'</td><td><b>'fn'</b>'fn_desc'</td></tr>' 18546 End 18547 If oldrev = newrev Then 18548 Do 18549 If _sa_flag Then 18550 Do 18551 Call Lineout detail, '<tr><td>'oldrev'</td><td>'newrev'</td><td>'fn'</td></tr>' 18552 End 18553 End 18554 Else 18555 Do 18556 Select 18557 When oldrev = '-' Then color = color_added 18558 When newrev = '-' Then color = color_deleted 18559 Otherwise color = color_changed 18560 End 18561 row = '<tr bgcolor='color'><td>'oldrev'</td><td>'newrev'</td><td>'fn'</td></tr>' 18562 If _sa_flag Then 18563 Do 18564 Call Lineout detail, row 18565 End 18566 Call Lineout summary, row 18567 End 18568 If oldrev \= newrev & oldrev \= '-' & newrev \= '-' Then 18569 Do 18570 /* 18571 * When changes exist, display a star 18572 */ 18573 If noprogress \= '' Then Call Charout ,'*' 18574 /* 18575 * Write differences lines... 18576 */ 18577 Call Lineout differences, '' 18578 If Right( newrev, 1 ) = '+' Then nrev = '' 18579 Else nrev = '-r'newrev 18580 /* 18581 * We need to get each rev of each file from the 18582 * appropriate repository to a temp file and do a diff 18583 * on these files. This is the only way to compare between 18584 * files in different repositories 18585 */ 18586 /* 18587 * For working file, get the full path 18588 */ 18589 If oldlab = 'Working' Then earlier_tmpfile = !global.!!repository.!!working_dir.earlier_repno || _earlier_fn 18590 Else 18591 Do 18592 earlier_tmpfile = GenerateTempFile() /* we manage this ourselves */ 18593 Select 18594 When !global.!!repository.!!type.repno = 'cvs' Then 18595 Do 18596 /* 18597 * We need to be in the working_dir for earlier_repno 18598 */ 18599 here = Directory() 18600 Call Directory !global.!!repository.!!working_dir.earlier_repno 18601 cmd = 'cvs' !global.!!repository.!!cvs_compression.earlier_repno '-d'!global.!!repository.!!path.earlier_repno '-q get -r'oldrev '-p' quote( _earlier_fn ) 18602 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 18603 Address Command cmd With Output Stream earlier_tmpfile 18604 Call Directory here 18605 End 18606 Otherwise Nop 18607 End 18608 End 18609 /* 18610 * We are already in the working_dir for repno 18611 */ 18612 If newlab = 'Working' Then tmpfile = !global.!!repository.!!working_dir.repno || _latest_fn 18613 Else 18614 Do 18615 tmpfile = GenerateTempFile() /* we manage this ourselves */ 18616 Select 18617 When !global.!!repository.!!type.repno = 'cvs' Then 18618 Do 18619 /* 18620 * We need to be in the working_dir for repno 18621 */ 18622 here = Directory() 18623 Call Directory !global.!!repository.!!working_dir.repno 18624 cmd = 'cvs' !global.!!repository.!!cvs_compression.repno '-d'!global.!!repository.!!path.repno '-q get' nrev '-p' quote( _latest_fn ) 18625 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 18626 Address Command cmd With Output Stream tmpfile 18627 Call Directory here 18628 End 18629 Otherwise Nop 18630 End 18631 End 18632 /* 18633 * Write out a heading for the file being diff'ed, similar to the 18634 * header that cvs diff produces 18635 */ 18636 differences_item = differences_item + 1 18637 Call Lineout differences, '<hr>' 18638 Call Lineout differences, '<a name="item'differences_item'"></a><a href="'rbasefile'.html">[INDEX]</a><a href="#item0">[TOP]</a><a href="#item'differences_item - 1'">[PREV]</a><a href="#item'differences_item + 1'">[NEXT]</a><a href="'rcomments'#item'differences_item'">[COMMENTS]</a><br>' 18639 Call Lineout differences, '<b>'fn '(' '-r'oldrev '-r'newrev ')</b><br>' 18640 /* 18641 * Win32 .doc differences... 18642 */ 18643 If !global.!os = 'WIN32' & Translate( Right( fn, 4 ) ) = '.DOC' & _wc_flag Then 18644 Do 18645 -- deal with earlier file... 18646 If oldlab = 'Working' Then 18647 Do 18648 -- copy the working file to the temporary file 18649 earlier_tmpfile1 = GenerateTempFile() -- we delete this ourselves 18650 Address System !global.!cmdcopy quote( earlier_tmpfile ) quote( earlier_tmpfile1 ) !global.!devnull 18651 End 18652 Else earlier_tmpfile1 = earlier_tmpfile 18653 file1 = ConvertWordDocumentToText( earlier_tmpfile1, 1 ) 18654 If file1 = '' Then Queue 'Unable to convert Word document:' fn 'Revision:' oldrev 'to text' 18655 Else Call AddTempFileForCleanup file1 18656 -- deal with later file... 18657 If newlab = 'Working' Then 18658 Do 18659 -- copy the working file to the temporary file 18660 tmpfile2 = GenerateTempFile() -- we delete this ourselves 18661 Address System !global.!cmdcopy quote( tmpfile ) quote( tmpfile2 ) !global.!devnull 18662 End 18663 Else tmpfile2 = tmpfile 18664 file2 = ConvertWordDocumentToText( tmpfile2, 1 ) 18665 If file2 = '' Then Queue 'Unable to convert Word document:' fn 'Revision:' newrev 'to text' 18666 Else Call AddTempFileForCleanup file2 18667 /* 18668 * Run the diff with output to stack if both files converted OK 18669 */ 18670 If file1 \= '' & file2 \= '' Then Address Command !global.!cmddiff diffflags quote( file1 ) quote( file2 ) With Output FIFO '' 18671 -- cleanup the copies of the Word documents 18672 If oldlab = 'Working' Then Call SysFileDelete earler_tmpfile1 18673 If newlab = 'Working' Then Call SysFileDelete tmpfile2 18674 End 18675 Else 18676 Do 18677 /* 18678 * Run the diff with output to stack 18679 */ 18680 Address Command !global.!cmddiff diffflags quote( earlier_tmpfile ) quote( tmpfile ) With Output FIFO '' 18681 End 18682 -- cleanup our temporary files 18683 If newlab \= 'Working' Then Call SysFileDelete tmpfile 18684 If oldlab \= 'Working' Then Call SysFileDelete earlier_tmpfile 18685 Call Lineout differences, '<pre>' 18686 Do Queued() 18687 Parse Pull line 18688 Call Lineout differences, ConvertToHTMLMnemonics( line ) 18689 End 18690 Call Lineout differences, '</pre>' 18691 /* 18692 * Write comments lines... 18693 */ 18694 Call Lineout comments, '<a name="item'differences_item'"></a>' 18695 Call Lineout comments, '<table width="100%" border=1>' 18696 Call Lineout comments, '<tr>' 18697 Call Lineout comments, ' <td width="70%" colspan=2>' 18698 Call Lineout comments, ' <b>' fn '(' '-r'oldrev '-r'newrev ')</b>' 18699 Call Lineout comments, ' </td>' 18700 Call Lineout comments, ' <td width="30%">' 18701 Call Lineout comments, ' <a href="'rbasefile'.html">[INDEX]</a><a href="#item0">[TOP]</a><a href="#item'differences_item - 1'">[PREV]</a><a href="#item'differences_item + 1'">[NEXT]<a href="'rdifferences'#item'differences_item'">[DIFFS]</a></a>' 18702 Call Lineout comments, ' </td>' 18703 Call Lineout comments, '</tr>' 18704 /* 18705 * Don't try and generate comments if we are comparing Latest and Working 18706 */ 18707 If newlab = 'Working' & oldlab = 'Latest' Then Nop 18708 Else 18709 Do 18710 raw_oldrev = Strip( oldrev, 'T', '+' ) 18711 raw_newrev = Strip( newrev, 'T', '+' ) 18712 If Datatype( raw_oldrev ) \= 'NUM' Then 18713 Do 18714 comp_revold = 0 18715 End 18716 Else comp_revold = raw_oldrev 18717 If Datatype( raw_newrev ) \= 'NUM' Then comp_revnew = 0 18718 Else comp_revnew = raw_newrev 18719 Select 18720 When !global.!!repository.!!type.repno = 'cvs' Then 18721 Do 18722 /* 18723 * We need to convert a CVS version number into a "real" number: 18724 * 1.10 is less than 1.9 otherwise 18725 * We assume that we never have more than 10000 releases per version 18726 */ 18727 Parse Var comp_revold maj '.' min 18728 num_comp_revold = (maj*10000)+min 18729 Parse Var comp_revnew maj '.' min 18730 num_comp_revnew = (maj*10000)+min 18731 End 18732 Otherwise Nop 18733 End 18734 /* 18735 * Determine which repository has the latest revision so we can use that one 18736 * to get the version history 18737 */ 18738 If num_comp_revnew > num_comp_revold Then 18739 Do 18740 rlog_repno = repno 18741 rlog_fn = _latest_fn 18742 later_rev = raw_newrev 18743 earlier_rev = raw_oldrev 18744 End 18745 Else 18746 Do 18747 rlog_repno = earlier_repno 18748 rlog_fn = _earlier_fn 18749 later_rev = raw_oldrev 18750 earlier_rev = raw_newrev 18751 End 18752 /* 18753 * If the revision numbers are the same, there will be no comments 18754 */ 18755 If num_comp_revnew \= num_comp_revold Then 18756 Do 18757 Select 18758 When !global.!!repository.!!type.repno = 'cvs' Then 18759 Do 18760 /* 18761 * Do rlog for whichever repository has the later revision 18762 * taking into account trailing + 18763 */ 18764 cmd = 'cvs' !global.!!repository.!!cvs_compression.rlog_repno '-d'!global.!!repository.!!path.rlog_repno '-q' logcmd quote( rlog_fn ) 18765 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 18766 Address System cmd With Output FIFO '' 18767 state = 'start' 18768 Do Queued() 18769 Parse Pull line 18770 Select 18771 When state = 'done' Then Nop -- don't leave; keep pulling all lines off stack 18772 When state = 'start' & Word( line, 1 ) = 'revision' & Word( line, 2 ) >= raw_oldrev & Word( line, 2 ) <= raw_newrev Then 18773 Do 18774 state = 'dateline' 18775 rev = Word( line, 2 ) 18776 End 18777 When state = 'more' & Word( line, 1 ) = 'revision' & Word( line, 2 ) <= raw_oldrev Then state = 'done' 18778 When state = 'more' & Word( line, 1 ) = 'revision' Then 18779 Do 18780 state = 'dateline' 18781 rev = Word( line, 2 ) 18782 End 18783 When state = 'dateline' Then 18784 Do 18785 Parse Var line 'date: ' yyyy '/' mm '/' dd filetime ';' . 'author:' user ';' . 18786 filedate_t = DateTimeToTime_T( yyyy||mm||dd, filetime, 'S', 1 ) 18787 Call Lineout comments, '<tr><td width="10%">' rev '</td><td width="90%" colspan=2><b>Date:</b>' Time_tDateToDisplayDate( filedate_t ) '<b>Author:</b>' user '</td></tr>' 18788 state = 'in' 18789 comment = '' 18790 End 18791 When state = 'in' & Left( line, 20 ) = Copies( '-', 20 ) Then 18792 Do 18793 Call Lineout comments, '<tr><td width="10%"></td><td width="90%" colspan=2>' comment '</td></tr>' 18794 state = 'more' 18795 End 18796 When state = 'in' Then 18797 Do 18798 If comment = '' Then comment = ConvertToHTMLMnemonics( line ) 18799 Else comment = comment'<br>'ConvertToHTMLMnemonics( line ) 18800 End 18801 Otherwise Nop 18802 End 18803 End 18804 End 18805 Otherwise Nop 18806 End 18807 End 18808 End 18809 Call Lineout comments, '</table>' 18810 End 18811 Else 18812 Do 18813 /* 18814 * When no changes, just display a dot 18815 */ 18816 If noprogress \= '' Then Call Charout ,'.' 18817 End 18818End 18819If _sa_flag Then 18820 Do 18821 Call Lineout detail, '</table></center><hr><center><b>End of report</b></center></body></html>' 18822 Call Stream detail, 'C', 'CLOSE' 18823 Call Lineout currents, '</table></center><hr><center><b>End of report</b></center></body></html>' 18824 Call Stream currents, 'C', 'CLOSE' 18825 End 18826 18827Call Lineout summary, '</table></center><hr><center><b>End of report</b></center></body></html>' 18828Call Stream summary, 'C', 'CLOSE' 18829 18830 18831Call Lineout differences, '<hr><center><b>End of report</b></center></body></html>' 18832Call Stream differences, 'C', 'CLOSE' 18833 18834Call Lineout comments, '<hr><center><b>End of report</b></center></body></html>' 18835Call Stream comments, 'C', 'CLOSE' 18836Call Runner batch, outputfile, !global.!cmdecho '.' 18837Call Runner batch, outputfile, !global.!cmdecho '">>>>Completed successfully at' Date() Time()'"' 18838Return 0 18839 18840RunBuild: Procedure Expose !REXXDW. !global. !!last_repository 18841Parse Arg repository, lab, buildtype, overwritebuild, testbuild, _basefile, batch, dontcheckout, continuecheckout 18842outputfile = _basefile'.out' 18843retcode = 0 18844Call Time 'R' 18845/* 18846 * Check that testbuild is for "Latest" version only 18847 */ 18848If testbuild \= 'TESTBUILD' & lab \= 'Latest' Then 18849 Do 18850 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: TestBuild can only be done with Latest version."' 18851 Return 1 18852End 18853/* 18854 * If this is a TestBuild, then we need to do the following: 18855 * - check if there is an existing "__testbuild__" label and if so, do a "Report Module History" between "__testbuild__" and "Latest" 18856 * - do a build of ourselves without the -t flag 18857 * - if the build worked, re-label "__testbuild__" and send simple "success" to admin 18858 * - if build failed, send output and report module details to admin 18859 */ 18860If testbuild \= 'TESTBUILD' Then 18861 Do 18862 /* 18863 * If called from batch, create our description file so we can see 18864 * the job in the GUI QOCCA and use "tee" so the output goes to the ".out" file 18865 * for later viewing 18866 */ 18867 If batch Then 18868 Do 18869 desc = 'Test Build of' quote( !global.!current_dirname.!!last_repository ) 18870 type = 'testbuild' 18871 compiler_type = FindCompilerType( !global.!current_dirname.!!last_repository ) 18872 Call CreateDescriptionFile _basefile, desc, type, compiler_type 18873 End 18874 If IsFileInRepository( !global.!current_dirname.!!last_repository'/.label-__testbuild__'!global.!os'__' ) Then 18875 Do 18876 Call Runner batch, outputfile, !global.!cmdecho '">>>>Running Report Modules History between Latest and __testbuild__'!global.!os'__..."' 18877 /* 18878 * Following command MUST be run without Runner so that output goes to current outputfile 18879 */ 18880 Address System !global.!qocca_command 'mods -n'repository '-m'!global.!current_dirname.!!last_repository '-vLatest -V'!global.!current_dirname.!!last_repository',__testbuild__'!global.!os'__' '-B'_basefile '-p -w' 18881 first_testbuild = 0 18882 End 18883 Else first_testbuild = 1 18884 Select 18885 When buildtype = 'debug' Then buildtype = '-bdebug' 18886 When buildtype = 'custom' Then buildtype = '-bcustom' 18887 Otherwise buildtype = '' 18888 End 18889 Call Runner batch, outputfile, !global.!cmdecho '">>>>Building Latest of' !global.!current_dirname.!!last_repository'..."' 18890 /* 18891 * Following command MUST be run without Runner so that output goes to current outputfile 18892 */ 18893 Address System !global.!qocca_command 'build -n'repository '-m'!global.!current_dirname.!!last_repository '-v'lab '-B'_basefile buildtype 18894 retcode = rc 18895 emailcommand = FindEmailCommand( !global.!current_dirname.!!last_repository ) 18896 If retcode = 0 Then 18897 Do 18898 Call Runner batch, outputfile, !global.!cmdecho '">>>>Build Successful; Creating new __testbuild__'!global.!os'__ label..."' 18899 /* 18900 * Following command MUST be run without Runner so that output goes to current outputfile 18901 */ 18902 Address System !global.!qocca_command 'label -n'repository '-m'!global.!current_dirname.!!last_repository '-v__testbuild__'!global.!os'__' '-o' '-B'_basefile 18903 If rc = 0 Then 18904 Do 18905 Call Runner batch, outputfile, !global.!cmdecho '">>>>Label Successful!; Sending results to Administrators..."' 18906 Call SendEmail emailcommand, outputfile, !global.!admin_email, 'Test Build of' !global.!current_dirname.!!last_repository '- Successful!!' 18907 End 18908 Else 18909 Do 18910 Call Runner batch, outputfile, !global.!cmdecho '">>>>Label Failed!; Sending results to Administrators..."' 18911 Call SendEmail emailcommand, outputfile, !global.!admin_email, 'Test Build of' !global.!current_dirname.!!last_repository '- Failed!!' 18912 End 18913 End 18914 Else 18915 Do 18916 Call Runner batch, outputfile, !global.!cmdecho '">>>>Build Failed!; Sending results to Administrators..."' 18917 Call SendEmail emailcommand, outputfile, !global.!admin_email, 'Test Build of' !global.!current_dirname.!!last_repository '- Failed!!' 18918/* 18919 If first_testbuild = 0 Then 18920 Do 18921 Call SendEmail emailcommand, _basefile'.summary.html', !global.!admin_email, 'Test Build of' !global.!current_dirname.!!last_repository '- Summary' 18922 Call SendEmail emailcommand, _basefile'.detail.html', !global.!admin_email, 'Test Build of' !global.!current_dirname.!!last_repository '- Detail' 18923 Call SendEmail emailcommand, _basefile'.differences.html', !global.!admin_email, 'Test Build of' !global.!current_dirname.!!last_repository '- Differences' 18924 Call SendEmail emailcommand, _basefile'.comments.html', !global.!admin_email, 'Test Build of' !global.!current_dirname.!!last_repository '- Comments' 18925 End 18926*/ 18927 End 18928/* 18929 Call SysFileDelete _basefile'.summary.html' 18930 Call SysFileDelete _basefile'.detail' 18931 Call SysFileDelete _basefile'.differences' 18932 Call SysFileDelete _basefile'.comments' 18933*/ 18934 End 18935Else 18936 Do 18937 /* 18938 * Check that the supplied module is valid and "buildable" 18939 */ 18940 Select 18941 When buildtype = 'debug' Then buildcommand = FindDebugBuildCommand( !global.!current_dirname.!!last_repository ) 18942 When buildtype = 'custom' Then buildcommand = FindCustomBuildCommand( !global.!current_dirname.!!last_repository ) 18943 Otherwise buildcommand = FindBuildCommand( !global.!current_dirname.!!last_repository ) 18944 End 18945 If buildcommand = '' Then 18946 Do 18947 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The supplied module:' !global.!current_dirname.!!last_repository 'is not buildable."' 18948 Return 1 18949 End 18950 If Left( buildcommand, 1 ) = '!' Then 18951 Do 18952 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The supplied module:' !global.!current_dirname.!!last_repository 'is not valid."' 18953 Return 1 18954 End 18955 /* 18956 * If not building Latest, check if it has been labeled 18957 */ 18958 If lab \= 'Latest' Then 18959 Do 18960 If IsFileInRepository( !global.!current_dirname.!!last_repository'/.label-'lab ) = 0 Then 18961 Do 18962 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: Module:' quote( !global.!current_dirname.!!last_repository ) 'does not have a label of:' lab'"' 18963 Return 1 18964 End 18965 End 18966 /* 18967 * Check if the build directory exists... 18968 */ 18969 build_dir = FindNativeBuildDirectory( !global.!current_dirname.!!last_repository, lab ) 18970 Select 18971 When continuecheckout \= 'CONTINUECHECKOUT' Then 18972 Do 18973 If DirectoryExists( build_dir ) = 0 Then 18974 Do 18975 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The supplied version:' lab 'for module:' !global.!current_dirname.!!last_repository 'has not been checked out."' 18976 Return 1 18977 End 18978 End 18979 When DirectoryExists( build_dir ) = 0 & dontcheckout \= 'DONTCHECKOUT' & lab \= 'Latest' Then 18980 Do 18981 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The supplied version:' lab 'for module:' !global.!current_dirname.!!last_repository 'has not been checked out and requested it not be checked out."' 18982 Return 1 18983 End 18984 When DirectoryExists( build_dir ) = 1 & dontcheckout = 'DONTCHECKOUT' & overwritebuild = 'OVERWRITEBUILD' & lab \= 'Latest' Then 18985 Do 18986 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The supplied version:' lab 'for module:' !global.!current_dirname.!!last_repository 'has already been built and you did not request it be overwritten."' 18987 Return 1 18988 End 18989 Otherwise Nop 18990 End 18991 /* 18992 * Check if another build for the same version is already running 18993 */ 18994 lock_file = build_dir || !global.!ossep || '.build.lck' 18995 If Stream( lock_file, 'C', 'QUERY EXISTS' ) \= '' Then 18996 Do 18997 line = Linein( lock_file ) 18998 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: Another build is likely in progress since' line 'for module:' !global.!current_dirname.!!last_repository'."' 18999 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: If not, delete' lock_file'"' 19000 Return 1 19001 End 19002 If dontcheckout = 'DONTCHECKOUT' Then 19003 Do 19004 /* 19005 * Export the directory tree 19006 * Due to an annoying feature of CVS, we can't export to a local 19007 * directory pointed to by the -d switch, so we have to check out 19008 * each file seperately to the correct directory 19009 */ 19010 If lab = 'Latest' Then 19011 Do 19012 /* 19013 * Get a list of all files in the module with their revision 19014 * numbers 19015 */ 19016 Select 19017 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 19018 Do 19019 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q list' quote( !global.!current_dirname.!!last_repository ) 19020 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 19021 Address System cmd With Output Stem out. Error Stem err. 19022 /* TODO don't use cvs list!!! */ 19023 Do i = 1 To out.0 19024 Parse Var out.i . rev . . . . flen . 19025 Parse Var out.i 92 fn +(flen) +1 . 19026 out.i = rev fn 19027 End 19028 End 19029 Otherwise Nop 19030 End 19031 End 19032 Else 19033 Do 19034 /* 19035 * Read the label file from the repository into a stem 19036 */ 19037 Select 19038 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 19039 Do 19040 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository '-q checkout -p' quote( !global.!current_dirname.!!last_repository'/.label-'lab ) 19041 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 19042 Address System cmd With Output Stem out. Error Stem junk. 19043 End 19044 Otherwise Nop 19045 End 19046 End 19047 /* 19048 * Get rid any existing files and re-make the directory tree 19049 */ 19050 If continuecheckout = 'CONTINUECHECKOUT' Then 19051 Do 19052 If overwritebuild \= 'OVERWRITEBUILD' Then Call Runner batch, outputfile, !global.!cmdecho '">>>>Cleaning up previous build"' 19053 Call Runner batch, outputfile, !global.!cmddelr quote( build_dir ) 19054 Call Runner batch, outputfile, !global.!cmdmkdir quote( build_dir ) 19055 Call Runner batch, outputfile, !global.!cmdecho '">>>>Checking out all files for version' lab 'of' !global.!current_dirname.!!last_repository 'to' build_dir'"' 19056 End 19057 Else 19058 Do 19059 Call Runner batch, outputfile, !global.!cmdecho '">>>>Continuing checking out all files for version' lab 'of' !global.!current_dirname.!!last_repository 'to' build_dir'"' 19060 End 19061 /* 19062 * Write the lock file 19063 */ 19064 Call Stream lock_file, 'C', 'OPEN WRITE REPLACE' 19065 Call Lineout lock_file, 'Build started at:' Date() Time() 19066 Call Stream lock_file, 'C', 'CLOSE' 19067 !global.!build_lock_file = lock_file 19068 dirlen = Length( !global.!current_dirname.!!last_repository ) 19069 /* 19070 * If the OS can handle symlinks, then check if the common dirs are in the out. stem 19071 * and check these out first. Then we can create local symlinks and not have to checkout 19072 * all the linked files. 19073 * We then ignore the files we checked out previously 19074 */ 19075 ignore. = 0 19076 If !global.!symlink \= '' Then 19077 Do 19078 Do j = 1 To !global.!common_dir.0 19079 dir = Substr( !global.!common_dir.j, 2 ) || '/' 19080 len = Length( dir ) 19081 Do i = 1 To out.0 19082 If Strip( out.i) = '' | Left( out.i, 1 ) = ';' Then Iterate i 19083 Parse Var out.i rev fn 19084 If Left( fn, len ) = dir Then 19085 Do 19086 have_common_dir.j = 1 19087 ignore.i = 1 19088 Call CheckoutAFile rev, fn, build_dir, dirlen, batch, outputfile, continuecheckout 19089 End 19090 End 19091 End 19092 /* 19093 * Now for all files check if they are in the linked directories 19094 * that we have checked out above and set their ignore flag 19095 */ 19096 Do i = 1 To out.0 19097 If Strip( out.i) = '' | Left( out.i, 1 ) = ';' Then Iterate i 19098 Parse Var out.i rev fn 19099 Do j = 1 To !global.!linked_dir.0 19100 ld = Substr( !global.!linked_dir.j, 2 ) || '/' 19101 len = Length( ld ) 19102 If ld = Left( fn, len ) Then 19103 Do 19104 idx = !global.!linked_idx.j 19105 If have_common_dir.idx = 1 Then ignore.i = 1 19106 End 19107 End 19108 End 19109 End 19110 /* 19111 * We now have a stem; out. with all files and their revision numbers 19112 */ 19113 Do i = 1 To out.0 19114 If Strip( out.i) = '' | Left( out.i, 1 ) = ';' Then Iterate i 19115 /* 19116 * If we have our ignore flag set, ignore the entry 19117 */ 19118 If ignore.i = 1 Then Iterate i 19119 Parse Var out.i rev fn 19120 rc = CheckoutAFile( rev, fn, build_dir, dirlen, batch, outputfile, continuecheckout ) 19121 If rc \= 0 Then 19122 Do 19123 /* 19124 * Delete the lock file 19125 */ 19126 Call Runner batch, outputfile, !global.!cmddelr quote( lock_file ) 19127 Drop !global.!build_lock_file 19128 Return rc 19129 End 19130 End 19131 If !global.!symlink \= '' Then 19132 Do 19133 tmpdir = Directory() 19134 /* 19135 * We now need to go through the linked directories and setup all of the 19136 * symbolic links to the common dirs 19137 */ 19138 Do j = 1 To !global.!linked_dir.0 19139 common_idx = !global.!linked_idx.j 19140 If have_common_dir.idx = 1 Then 19141 Do 19142 Call Directory tmpdir 19143 /* 19144 * Work out how to get the correct relative path for linking 19145 */ 19146 pos = Lastpos( '/', !global.!linked_dir.j ) 19147 linked_dirname = Substr( !global.!linked_dir.j, 1, pos - 1 ) /* eg /test/dir1/dir2 */ 19148 common_dirname = !global.!common_dir.common_idx /* /common */ 19149 mycomm = common_dirname 19150 newdir = linked_dirname 19151 Do i = 1 To Min( Length( mycomm ), Length( newdir ) ) 19152 If Substr( mycomm, i, 1 ) = '/' Then last_dir_pos = i 19153 If Substr( mycomm, i, 1 ) \= Substr( newdir, i, 1 ) Then Leave 19154 End 19155 rel_linked = Substr( newdir, last_dir_pos + 1 ) 19156 rel_common = Substr( mycomm, last_dir_pos + 1 ) 19157 /* 19158 * Now symlink the common dir to the linked dirname 19159 * eg. Linking /tmfps/common to /tmfps/app/common 19160 * cd /tmfps/app 19161 * ln -sf ../common . 19162 */ 19163 Call Runner batch, outputfile, !global.!cmdecho '"Linking directory' quote( build_dir'/'rel_common ) 'to current directory:' quote( build_dir'/'rel_linked )'"' 19164 /* 19165 * Change directory to linked dir 19166 */ 19167 Call Directory build_dir'/'rel_linked 19168 Address Command !global.!symlink quote( '../'rel_common ) . 19169 End 19170 End 19171 Call Directory tmpdir 19172 End 19173 End 19174 /* 19175 * Change to the working directory to update build number ... 19176 */ 19177 Call Directory !global.!!repository.!!working_dir.!!last_repository 19178 /* 19179 * Increment the build number 19180 */ 19181 Call Runner batch, outputfile, !global.!cmdecho '">>>>Getting current build number."' 19182 bnf = 'admin/build.no' 19183 Select 19184 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 19185 Do 19186 End 19187 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 19188 Do 19189 retcode = Runner( batch, outputfile, 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout' bnf ) 19190 End 19191 Otherwise Nop 19192 End 19193 If retcode \= 0 Then build_no = 1 19194 Else 19195 Do 19196 Call Stream bnf, 'C', 'OPEN READ' 19197 build_no = Linein( bnf ) 19198 build_no = build_no + 1 19199 Call Stream bnf, 'C', 'CLOSE' 19200 End 19201 Call Runner batch, outputfile, !global.!cmdecho '">>>>Incrementing build number to:' build_no'"' 19202 /* 19203 * Check build number back in with history 19204 */ 19205 Call Stream bnf, 'C', 'OPEN WRITE REPLACE' 19206 Call Lineout bnf, build_no 19207 Call Stream bnf, 'C', 'CLOSE' 19208 msg = 'Build' build_no 'for version' lab 'of' !global.!current_dirname.!!last_repository 19209 Select 19210 When !global.!!repository.!!type.!!last_repository = 'rcs' Then 19211 Do 19212 End 19213 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 19214 Do 19215 If build_no = 1 Then 19216 Do 19217 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'add' bnf 19218 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 19219 Address System cmd 19220 End 19221 Call Runner batch, outputfile, 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'commit -m"'msg'"' bnf 19222 End 19223 Otherwise Nop 19224 End 19225 /* 19226 * If called from batch, create our description file so we can see 19227 * the job in the GUI QOCCA and use "tee" so the output goes to the ".out" file 19228 * for later viewing 19229 */ 19230 If batch Then 19231 Do 19232 desc = 'Build ('build_no') of version' quote( lab ) 'of' quote( !global.!current_dirname.!!last_repository ) 19233 type = 'build' 19234 compiler_type = FindCompilerType( !global.!current_dirname.!!last_repository ) 19235 Call CreateDescriptionFile _basefile, desc, type, compiler_type 19236 End 19237 /* 19238 * Change to the build directory (top level for the module)... 19239 * and then to the "make" directory 19240 */ 19241 Call Directory build_dir 19242 make_dir = FindMakeDirectory( !global.!current_dirname.!!last_repository ) 19243 If make_dir \= '' Then Call Directory make_dir 19244 /* 19245 * Should be able to build now! 19246 */ 19247 /* 19248 * Set the BUILD and VERSION environment variables here 19249 */ 19250 Call Value !global.!buildenvvar, build_no, 'ENVIRONMENT' 19251 Call Value !global.!versionenvvar, lab, 'ENVIRONMENT' 19252 /* 19253 * Split the "build" command into multiple, and run them... 19254 */ 19255 Do Forever 19256 Parse Var buildcommand mc ';' buildcommand 19257 mc = Strip( mc ) 19258 If mc = '' Then Leave 19259 Call Runner batch, outputfile, !global.!cmdecho '">>>>Executing command:' mc'"' 19260 retcode = Runner( batch, outputfile, mc ) 19261 If retcode \= 0 Then 19262 Do 19263 Call Runner batch, outputfile, !global.!cmdecho '"Failed!"' 19264 /* 19265 * Delete the lock file 19266 */ 19267 Call Runner batch, outputfile, !global.!cmddelr quote( lock_file ) 19268 Drop !global.!build_lock_file 19269 Return retcode 19270 End 19271 End 19272 et = Time( 'E' ) 19273 Parse Var et et '.' . 19274 hr = et % 3600 19275 et = et // 3600 19276 mi = et % 60 19277 se = et // 60 19278 Call Runner batch, outputfile, !global.!cmdecho '">>>>Completed successfully at' Date() Time() 'Elapsed:' Right( hr, 2, 0 )':'Right( mi, 2, 0 )':'Right( se, 2, 0)'"' 19279 Call Value !global.!buildenvvar, '', 'ENVIRONMENT' 19280 Call Value !global.!versionenvvar, '', 'ENVIRONMENT' 19281 End 19282/* 19283 * Delete the lock file 19284 */ 19285Call Runner batch, outputfile, !global.!cmddelr quote( lock_file ) 19286Drop !global.!build_lock_file 19287Return retcode 19288 19289CheckoutAFile: Procedure Expose !REXXDW. !global. !!last_repository 19290Parse Arg rev, fn, build_dir, dirlen, batch, outputfile, continuecheckout 19291outfile = build_dir||Substr( fn, dirlen+1 ) 19292/* 19293 * If we are continuing our checkout then return here if the file already exists 19294 */ 19295If continuecheckout \= 'CONTINUECHECKOUT' & Stream( outfile, 'C', 'QUERY EXISTS' ) \= '' Then Return 0 19296/* 19297 * Need to determine if the directory of the file exists; 19298 * if not make it before checking the file out 19299 */ 19300outpos = Lastpos( '/', outfile ) 19301outdir = Substr( outfile, 1, outpos-1 ) 19302If DirectoryExists( outdir ) = 0 Then Call Runner batch, outputfile, !global.!cmdecho '"Checking out files for directory:' outdir'"' 19303Call CreateDirectory( outdir ) 19304/* 19305 * We don't need to checkout label files 19306 */ 19307If Left( Substr( outfile, outpos ), 8 ) = '/.label-' Then Return 0 19308/* 19309 * Get our file 19310 */ 19311Select 19312 When !global.!!repository.!!type.!!last_repository = 'cvs' Then 19313 Do 19314 /* 19315 * Need to run cvs checkout with -p flag to avoid cvs stickiness 19316 * Problem is though that file permissions are lost 19317 */ 19318 cmd = 'cvs' !global.!!repository.!!cvs_compression.!!last_repository '-d'!global.!!repository.!!path.!!last_repository 'checkout -p -r'rev quote( fn ) 19319 If !global.!!user.!!preference.!!debug_commands = 1 Then Call DebugCommands cmd 19320 Address Command cmd With Output Stream outfile Error Stem err. 19321 If rc \= 0 Then 19322 Do 19323 Call Runner batch, outputfile, !global.!cmdecho '"Error getting revision' rev 'of' fn 'to' outfile'"' 19324 Do i = 1 To err.0 19325 Call Runner batch, outputfile, !global.!cmdecho err.i 19326 End 19327-- Return rc 19328 End 19329 Call Stream outfile, 'C', 'CLOSE' 19330 If !global.!cmdrename = 'mv' Then 19331 Do 19332 -- fix permissions for some files on Unixy platforms 19333 files = 'config.guess config.sub configure install-sh' 19334 Do i = 1 To Words( files ) 19335 file = Word( files, i ) 19336 len = Length( file ) 19337 If Right( outfile, len ) = file Then Address System 'chmod u+x' outfile 19338 End 19339 End 19340 End 19341 Otherwise Nop 19342End 19343Return 0 19344 19345RunPromote: Procedure Expose !REXXDW. !global. !!last_repository 19346Parse Arg repository, lab, _basefile, batch 19347outputfile = _basefile'.out' 19348retcode = 0 19349/* 19350 * Check that the supplied module is valid and "promotable" 19351 */ 19352promotecommand = FindPromoteCommand( !global.!current_dirname.!!last_repository ) 19353If promotecommand = '' | Left( promotecommand, 1 ) = '!' Then 19354 Do 19355 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The supplied module:' !global.!current_dirname.!!last_repository 'is not valid or promotable."' 19356 End 19357/* 19358 * If env supplied it must be in !global.!runtime_envs 19359If !global.!runtime_envs = '' | Left( !global.!runtime_envs, 1 ) = '!' Then Nop 19360Else 19361 Do 19362 If Wordpos( env, !global.!runtime_envs ) = 0 Then 19363 Do 19364 Call AbortText 'The supplied environment:' env 'is not a valid. Must be one of:' !global.!runtime_envs 19365 End 19366 End 19367 */ 19368/* 19369 * Check if the build directory exists... 19370 */ 19371build_dir = FindNativeBuildDirectory( !global.!current_dirname.!!last_repository, lab ) 19372If DirectoryExists( build_dir ) = 0 Then 19373 Do 19374 Call Runner batch, outputfile, !global.!cmdecho '"ERROR: The supplied version:' lab 'for module' !global.!current_dirname.!!last_repository 'has not been built."' 19375 End 19376/* 19377 * Change to promote directory 19378 */ 19379build_dir = FindNativeBuildDirectory( !global.!current_dirname.!!last_repository, lab ) 19380Call Directory build_dir 19381promote_dir = FindPromoteDirectory( !global.!current_dirname.!!last_repository ) 19382If promote_dir \= '' Then Call Directory promote_dir 19383/* 19384 * Should be able to promote now! 19385 */ 19386Call Runner batch, outputfile, !global.!cmdecho '">>>>Changing to promote directory:' promote_dir'"' 19387/* 19388 * Get the !install_script, copy to build_dir - TODO 19389 */ 19390this_dir = DirToVariable( !global.!current_dirname.!!last_repository ) 19391pos = Wordpos( !global.!os, !global.!platforms ) 19392/* 19393 * Make our substitutions now... 19394 */ 19395promotecommand = Changestr( '%D%', promotecommand, !global.!dir.!installdirs.this_dir.pos ) 19396promotecommand = Changestr( '%V%', promotecommand, lab ) 19397/* 19398 * Set the BUILD and VERSION environment variables here 19399 */ 19400Call Value !global.!buildenvvar, build_no, 'ENVIRONMENT' 19401Call Value !global.!versionenvvar, lab, 'ENVIRONMENT' 19402/* 19403 * Split the "promote" command into multiple, and run them... 19404 */ 19405Do Forever 19406 Parse Var promotecommand mc ';' promotecommand 19407 mc = Strip( mc ) 19408 If mc = '' Then Leave 19409 Call Runner batch, outputfile, !global.!cmdecho '">>>>Executing command:' mc'"' 19410 retcode = Runner( batch, outputfile, mc ) 19411 If retcode \= 0 Then 19412 Do 19413 Call Runner batch, outputfile, !global.!cmdecho '"Failed!"' 19414 Return retcode 19415 End 19416End 19417Call Runner batch, outputfile, !global.!cmdecho '">>>>Completed successfully at' Date() Time()'"' 19418Call Value !global.!buildenvvar, '', 'ENVIRONMENT' 19419Call Value !global.!versionenvvar, '', 'ENVIRONMENT' 19420Return retcode 19421 19422/* 19423 * Turn mouse cursor to hourglass 19424 */ 19425SetCursorWait: Procedure Expose !REXXDW. !global. !!last_repository 19426Call dw_window_set_pointer !global.!mainwindow, !REXXDW.!DW_POINTER_CLOCK 19427 Call dw_main_sleep 10 19428Return 19429 19430/* 19431 * Turn mouse cursor to arrow 19432 */ 19433SetCursorNoWait: Procedure Expose !REXXDW. !global. !!last_repository 19434Call dw_window_set_pointer !global.!mainwindow, !REXXDW.!DW_POINTER_ARROW 19435 Call dw_main_sleep 10 19436Return 19437 19438Usage: Procedure Expose !REXXDW. !global. !!last_repository 19439Parse Arg cmd 19440Say 'Usage:' 19441Say 'qocca ['Translate( !global.!validcmds, '|', ' ' ) '[options] ]' 19442If cmd = '' Then validcmds = !global.!validcmds 19443Else validcmds = cmd 19444Do i = 1 To Words( validcmds ) 19445 Say '-- options for' Word( validcmds, i )':' 19446 cmd = Translate( Word( validcmds, i ) ) 19447 Do j = 1 To Words( !global.!validargs.cmd ) 19448 Select 19449 When Word( !global.!mandatory.cmd, j ) = 0 & Word( !global.!valuereq.cmd, j ) = 1 Then str = ' ' Left( '['Word( !global.!validargs.cmd, j )||Word( !global.!opt.cmd, j )']', 20 ) '->' !global.!desc.cmd.j 19450 When Word( !global.!mandatory.cmd, j ) = 0 & Word( !global.!valuereq.cmd, j ) = 0 Then str = ' ' Left( '['Word( !global.!validargs.cmd, j )']', 20 ) '->' !global.!desc.cmd.j 19451 When Word( !global.!mandatory.cmd, j ) = 1 & Word( !global.!valuereq.cmd, j ) = 1 Then str = ' ' Left( Word( !global.!validargs.cmd, j )||Word( !global.!opt.cmd, j ), 20 ) '->' !global.!desc.cmd.j 19452 When Word( !global.!mandatory.cmd, j ) = 1 & Word( !global.!valuereq.cmd, j ) = 0 Then str = ' ' Left( Word( !global.!validargs.cmd, j ), 20 ) '->' !global.!desc.cmd.j 19453 Otherwise Nop 19454 End 19455 Say str 19456 End 19457End 19458Exit 1 19459 19460Halt: 19461If Left( !global.!build_lock_file, 1 ) \= '!' Then Address System !global.!cmddelr quote( !global.!build_lock_file ) 19462Say 19463Say 'User cancelled process!' 19464Exit 1 19465