Changeset 1125
- Timestamp:
- Aug 27, 2008, 6:35:43 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cfgmgr.cmd
r1091 r1125 1 /* CFGMGR.CMD - manage installation and deinstallation 2 of FM/2 configuration files 1 /* 2 $Id: $ 3 4 CFGMGR.CMD - manage installation, maintenance and deinstallation 5 of FM/2 configuration files 3 6 4 7 Optional Parameters: 5 8 6 / RESETForces overwrite of existing configuration9 /DEFAULTS Forces overwrite of existing configuration 7 10 files, i.e. "reset to FM/2 defaults" 8 11 … … 24 27 25 28 n = setlocal() 26 29 t = time('e') 27 30 signal on novalue /* for debugging */ 28 31 … … 30 33 call SysLoadFuncs 31 34 32 globals = 'cfg. '35 globals = 'cfg. button.' 33 36 34 37 call Init 35 36 /*37 call DeleteObsoleteFiles38 */39 38 40 39 parse arg args … … 58 57 if file_exists \= '' then 59 58 do 60 if FilesAreDifferent(cfg.file.f.default, cfg.file.f.name)= 1 then61 if cfg.defaults= 1 then59 if cfg.defaults = 1 then 60 if FilesAreDifferent(cfg.file.f.default, cfg.file.f.name) = 1 then 62 61 do 63 call SysMkDir cfg.backupdir64 62 if cfg.unattended = 0 then 65 63 do … … 73 71 cfg.errorcode = CfgAction( 'RESETTODEFAULT', f ) 74 72 end 73 else 74 nop 75 else 76 if (cfg.file.f.toolbar = 1) & (cfg.unattended = 1) then 77 call Ticket267Fix cfg.file.f.name 75 78 end 76 79 else … … 122 125 say 123 126 say cfg.pgmname' has ended.' 127 say 'Time elapsed:' time('e') 124 128 n = endlocal() 125 129 exit cfg.errorcode … … 128 132 Init: procedure expose (globals) 129 133 134 button. = '' 135 136 button.CMDS.helptext = 'Commands toolbar' 137 button.CMDS.text = 'Cmds' 138 button.CMDS.id = 4900 139 140 button.UTILS.helptext = 'Utility toolbar' 141 button.UTILS.text = 'Utils' 142 button.UTILS.id = 4901 143 144 button.SORT.helptext = 'Sort toolbar' 145 button.SORT.text = 'Sort' 146 button.SORT.id = 4902 147 148 button.SELECT.helptext = 'Select toolbar' 149 button.SELECT.text = 'Select' 150 button.SELECT.id = 4903 151 152 button.CONFIG.helptext = 'Configuration toolbar' 153 button.CONFIG.text = 'Cmds' 154 button.CONFIG.id = 4904 155 156 button.FILES.helptext = 'Files toolbar' 157 button.FILES.text = 'Files' 158 button.FILES.id = 4905 159 160 button.VIEWS.helptext = 'Views toolbar' 161 button.VIEWS.text = 'Views' 162 button.VIEWS.id = 4906 163 130 164 cfg. = '' 131 165 cfg.errorcode = 0 132 166 cfg.defaults = 0 133 167 cfg.unattended = 0 168 cfg.actionmethod = 'COPY' /* The default method of backing up and restoring */ 134 169 cfg.backupdir = '.\User_Config_Backup' 135 cfg.actionmethod = 'COPY' /* The default method of backing up and restoring */ 170 171 call SysMkDir cfg.backupdir 136 172 137 173 f = 0 … … 144 180 cfg.file.f.desc.1 = 'FM/2 associations' 145 181 cfg.file.f.desc.0 = 1 182 cfg.file.f.toolbar = 0 146 183 147 184 f = f + 1 … … 150 187 cfg.file.f.desc.1 = 'FM/2 user-defined commands' 151 188 cfg.file.f.desc.0 = 1 189 cfg.file.f.toolbar = 0 152 190 153 191 f = f + 1 … … 156 194 cfg.file.f.desc.1 = 'FM/2 archiver definitions' 157 195 cfg.file.f.desc.0 = 1 196 cfg.file.f.toolbar = 0 158 197 159 198 f = f + 1 … … 162 201 cfg.file.f.desc.1 = 'FM/2 toolbar: commands' 163 202 cfg.file.f.desc.0 = 1 203 cfg.file.f.toolbar = 1 164 204 165 205 f = f + 1 … … 168 208 cfg.file.f.desc.1 = 'FM/2 toolbar: files' 169 209 cfg.file.f.desc.0 = 1 210 cfg.file.f.toolbar = 1 170 211 171 212 f = f + 1 … … 174 215 cfg.file.f.desc.1 = 'FM/2 toolbar: select' 175 216 cfg.file.f.desc.0 = 1 217 cfg.file.f.toolbar = 1 176 218 177 219 f = f + 1 … … 180 222 cfg.file.f.desc.1 = 'FM/2 toolbar: sort' 181 223 cfg.file.f.desc.0 = 1 224 cfg.file.f.toolbar = 1 182 225 183 226 f = f + 1 … … 186 229 cfg.file.f.desc.1 = 'FM/2 toolbar: utils' 187 230 cfg.file.f.desc.0 = 1 231 cfg.file.f.toolbar = 1 188 232 189 233 f = f + 1 … … 192 236 cfg.file.f.desc.1 = 'FM/2 toolbar: views' 193 237 cfg.file.f.desc.0 = 1 238 cfg.file.f.toolbar = 1 194 239 195 240 f = f + 1 … … 198 243 cfg.file.f.desc.1 = 'FM/2 toolbar: config' 199 244 cfg.file.f.desc.0 = 1 245 cfg.file.f.toolbar = 1 200 246 201 247 f = f + 1 … … 204 250 cfg.file.f.desc.1 = 'FM/2 toolbar: tools?' 205 251 cfg.file.f.desc.0 = 1 252 cfg.file.f.toolbar = 0 206 253 207 254 f = f + 1 … … 210 257 cfg.file.f.desc.1 = 'FM/2 filters' 211 258 cfg.file.f.desc.0 = 1 259 cfg.file.f.toolbar = 0 212 260 213 261 f = f + 1 … … 216 264 cfg.file.f.desc.1 = 'FM/2 toolbar list' 217 265 cfg.file.f.desc.0 = 1 266 cfg.file.f.toolbar = 0 218 267 219 268 f = f + 1 … … 222 271 cfg.file.f.desc.1 = 'FM/2 FAT optimizing command' 223 272 cfg.file.f.desc.0 = 1 273 cfg.file.f.toolbar = 0 224 274 225 275 f = f + 1 … … 228 278 cfg.file.f.desc.1 = 'FM/2 HPFS optimizing command' 229 279 cfg.file.f.desc.0 = 1 280 cfg.file.f.toolbar = 0 230 281 231 282 f = f + 1 … … 234 285 cfg.file.f.desc.1 = 'FM/2 JFS optimizing command' 235 286 cfg.file.f.desc.0 = 1 287 cfg.file.f.toolbar = 0 236 288 237 289 cfg.file.0 = f … … 343 395 return reply 344 396 345 /*346 DeleteObsoleteFiles: procedure expose (globals)347 i = 0348 349 i = i + 1350 Obsolete.i = 'readme.org'351 352 i = i + 1353 Obsolete.i = 'install.cmd'354 355 i = i + 1356 Obsolete.i = 'install.dat'357 358 i = i + 1359 Obsolete.i = 'uninstal.cmd'360 361 Obsolete.0 = i362 do i = 1 to Obsolete.0363 call SysFileTree Obsolete.i, 'list.', 'FOS'364 do j = 1 to list.0365 'del 'list.j366 end367 end368 return369 */370 371 397 FilesAreDifferent: procedure 372 398 parse arg file.1, file.2 … … 410 436 return GetResponse(msg '(Y/n)?') 411 437 412 novalue:413 say 'Unitialized variable: 'condition('D')' found on line: 'sigl414 say 'Line text: 'sourceline(sigl)415 say416 say 'Exiting...'417 signal NormalExit418 419 420 438 Usage: procedure expose (globals) 421 439 say 'Proper usage of 'cfg.pgmname':' … … 438 456 say 439 457 say 'The optional parameter /UNATTENDED means there will be NO user interaction' 440 say ' interaction duringor confirmation of the operation!!!'458 say ' or confirmation of the operation!!!' 441 459 say 'The order of the parameters is not important.' 442 460 return … … 542 560 if EnvVarList = '' | EnvVarList = 'ERROR:' then 543 561 call SysIni inifile, 'FM/3', 'TreeEnvVarList', 'PATH;DPATH;LIBPATH;HELP;BOOKSHELF;LIB;INCLUDE;LOCPATH;SMINCLUDE;LPATH;CODELPATH' 562 LastToolbox = SysIni(inifile, 'FM/3', 'LastToolBox') 563 LastToolbar = SysIni(inifile, 'FM/3', 'LastToolbar') 564 if LastToolbar = 'ERROR:' then 565 do 566 if LastToolBox = 'ERROR:' then 567 LastToolbar = 'CMDS.TLS' 568 else 569 LastToolbar = LastToolbox 570 call SysIni inifile, 'FM/3', 'LastToolbar', LastToolbar 571 end 572 if SysIni(inifile, 'FM/3', 'FM2Shudown.Toolbar') = 'ERROR:' then 573 call SysIni inifile, 'FM/3', 'FM2Shutdown.Toolbar', LastToolbar 544 574 return 545 575 576 Ticket267Fix: procedure expose (globals) 577 parse arg infile 578 fix_string = 'Fixed: Ticket 267' 579 abort_fix = 0 580 outfile = SysTempFilename('cfgmgr??.fix') 581 call lineout outfile, ';' fix_string 582 /* Read file, if comment has "already repaired" message then stop */ 583 do while lines(infile) > 0 584 line = linein(infile) 585 if left(line, 1) = ';' then 586 if pos(fix_string, line) > 0 then 587 do 588 abort_fix = 1 589 leave 590 end 591 else 592 call lineout outfile, line 593 else if word(line, 1) = ':spacer' then 594 call lineout outfile, ';' || substr(line, 2) 595 else 596 do 597 tool.1 = line 598 tool.2 = linein(infile) 599 tool.3 = linein(infile) 600 tool.4 = linein(infile) 601 button_name = translate(tool.2) 602 if (button.button_name.text \= '') & (tool.4 >= 4900) & (tool.4 < 4950) then 603 do 604 call lineout outfile, button.button_name.helptext 605 call lineout outfile, button.button_name.text 606 call lineout outfile, tool.3 607 call lineout outfile, button.button_name.id 608 end 609 else 610 do 611 call lineout outfile, tool.1 612 call lineout outfile, tool.2 613 call lineout outfile, tool.3 614 call lineout outfile, tool.4 615 end 616 end 617 end 618 call stream infile, 'c', 'close' 619 call stream outfile, 'c', 'close' 620 if abort_fix = 0 then 621 do 622 'copy' infile cfg.backupdir /* backup tls file */ 623 'copy' outfile infile /* "install" new tls file */ 624 cfg.action_taken = 1 625 end 626 call SysFileDelete outfile 627 return 628 -
trunk/dll/mainwnd.c
r1121 r1125 107 107 static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview); 108 108 static VOID DeletePresParams(PSZ pszKeyroot); 109 static VOID BuildTools(HWND hwndT, BOOL resize); 109 110 110 111 static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, … … 1291 1292 (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ? 1292 1293 "TRUE" : NULL)) 1293 BuildTools(hwndToolback, TRUE);1294 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 1294 1295 break; 1295 1296 } … … 1410 1411 } 1411 1412 1412 VOID BuildTools(HWND hwndT, BOOL resize)1413 static VOID BuildTools(HWND hwndT, BOOL resize) 1413 1414 { 1414 1415 TOOL *tool; … … 1420 1421 henum = WinBeginEnumWindows(hwndT); 1421 1422 while ((hwndTool = WinGetNextWindow(henum)) != NULLHANDLE) 1422 WinDestroyWindow(hwndTool); 1423 if (!WinDestroyWindow(hwndTool)) 1424 Runtime_Error(pszSrcFile, __LINE__, "Unable to destroy toolbar button"); 1423 1425 WinEndEnumWindows(henum); 1424 1426 if (!fToolbar) { … … 2565 2567 return 0; 2566 2568 2569 case UM_SETUP2: /* Used to load a new a toolbar */ 2570 BuildTools(hwnd, TRUE); 2571 return 0; 2572 2567 2573 case WM_CHORD: 2568 2574 { … … 2584 2590 if (WinDlgBox(HWND_DESKTOP, 2585 2591 hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID)) 2586 BuildTools(hwnd, TRUE);2592 PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); 2587 2593 return MRFROMSHORT(TRUE); 2588 2594 … … 2832 2838 fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0; 2833 2839 sprintf(szPrefix, "%s.", pszStateName); 2840 2841 sprintf(szKey, "%sToolbar", szPrefix); 2842 PrfWriteProfileString(fmprof, FM3Str, szKey, lasttoolbar); 2834 2843 2835 2844 henum = WinBeginEnumWindows(hwndClient); … … 3059 3068 fDeleteState = strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)) == 0; 3060 3069 3070 size = (ULONG)0; 3071 sprintf(szKey, "%sToolbar", szPrefix); 3072 if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size) 3073 { 3074 if (fToolsChanged) 3075 save_tools(NULL); 3076 PrfQueryProfileData(fmprof, FM3Str, szKey, lasttoolbar, &size); 3077 PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar); 3078 load_tools(NULL); 3079 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 3080 } 3061 3081 size = sizeof(SWP); 3062 3082 sprintf(szKey, "%sMySizeLastTime", szPrefix); … … 5107 5127 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5108 5128 &fTextTools, TRUE, "TextTools"); 5109 BuildTools(hwndToolback, TRUE);5129 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5110 5130 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5111 5131 MPFROMLONG(FCF_SIZEBORDER), MPVOID); … … 5115 5135 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5116 5136 &fToolTitles, TRUE, "ToolTitles"); 5117 BuildTools(hwndToolback, TRUE);5137 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5118 5138 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5119 5139 MPFROMLONG(FCF_SIZEBORDER), MPVOID); … … 5201 5221 5202 5222 case IDM_CREATETOOL: 5203 BuildTools(hwndToolback, TRUE);5223 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5204 5224 break; 5205 5225 … … 5207 5227 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5208 5228 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar"); 5209 BuildTools(hwndToolback, TRUE);5229 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5210 5230 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5211 5231 MAIN_TOOLS), fToolbar); … … 5398 5418 load_tools(NULL); 5399 5419 else { 5400 strcpy(lasttoolb ox,5420 strcpy(lasttoolbar, 5401 5421 quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]); 5402 PrfWriteProfileString(fmprof, FM3Str, "LastTool Box", lasttoolbox);5422 PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar); 5403 5423 } 5404 BuildTools(hwndToolback, TRUE);5424 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5405 5425 } 5406 5426 } … … 5716 5736 * start up some initial children 5717 5737 */ 5718 load_tools(NULL);5719 BuildTools(hwndToolback, TRUE);5720 5738 WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE); 5721 5739 PostMsg(MainObjectHwnd, UM_SETUP2, mp1, mp2); … … 5768 5786 SWP_ZORDER | SWP_ACTIVATE); 5769 5787 } 5770 ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),5771 MAIN_TOOLS));5788 // ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5789 // MAIN_TOOLS)); 5772 5790 } 5773 5791 PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2); … … 5780 5798 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID); 5781 5799 if (!add_setup(pszStatename)) 5782 save_setups(); 5800 save_setups(); 5801 } else { 5802 load_tools(NULL); 5803 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5783 5804 } 5784 5805 PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2); … … 6037 6058 if (!foundit) { 6038 6059 thisone = FALSE; 6039 p = strrchr(lasttoolb ox, '\\');6060 p = strrchr(lasttoolbar, '\\'); 6040 6061 if (!p) 6041 p = lasttoolb ox;6062 p = lasttoolbar; 6042 6063 else 6043 6064 p++; … … 6062 6083 priority_bumped(); 6063 6084 } 6064 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLB OXTEXT));6085 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT)); 6065 6086 } 6066 6087 return 0; … … 6270 6291 load_tools(path); 6271 6292 PrfWriteProfileString(fmprof, 6272 FM3Str, "LastTool Box", lasttoolbox);6273 BuildTools(hwndToolback, TRUE);6274 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLB OXTEXT));6293 FM3Str, "LastToolbar", lasttoolbar); 6294 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 6295 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT)); 6275 6296 } 6276 6297 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) { -
trunk/dll/mainwnd2.c
r1039 r1125 700 700 load_tools(NULL); 701 701 else { 702 strcpy(lasttoolb ox,702 strcpy(lasttoolbar, 703 703 quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]); 704 PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox); 705 } 706 BuildTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 707 MAIN_TOOLS), TRUE); 704 PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar); 705 } 706 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 708 707 } 709 708 } … … 942 941 PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID); 943 942 load_tools(NULL); 944 BuildTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 945 MAIN_TOOLS), TRUE); 943 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 946 944 fRunning = TRUE; 947 945 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.