Changeset 1486
- Timestamp:
- Dec 17, 2009, 1:36:04 AM (16 years ago)
- Location:
- trunk/dll
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/collect.c
r1456 r1486 2293 2293 INT x; 2294 2294 2295 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;2295 x = SHORT1FROMMP(mp1);// - IDM_COMMANDSTART; 2296 2296 if (x >= 0) { 2297 x++;2297 //x++; 2298 2298 RunCommand(hwnd, x); 2299 2299 if (fUnHilite) -
trunk/dll/command.c
r1398 r1486 65 65 { 66 66 PSZ pszCmdLine; 67 INT flags;68 67 CHAR title[100]; 68 ULONG flags; 69 ULONG ID; 70 ULONG HotKeyID; 69 71 } 70 72 COMMAND; … … 75 77 static PSZ pszSrcFile = __FILE__; 76 78 static LINKCMDS *cmdtail; 79 static INT CommandDatVersion = 0; 77 80 78 81 #pragma data_seg(GLOBAL2) 79 82 LINKCMDS *cmdhead; 80 83 BOOL cmdloaded; 84 BOOL UsedCommandIDs[300]; 85 BOOL UsedHotKeyIDs[20]; 81 86 82 87 MRESULT EXPENTRY CommandTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) … … 344 349 LINKCMDS *info; 345 350 PSZ pszCmdLine; 351 CHAR *p; 346 352 CHAR title[100]; 347 353 CHAR flags[34]; 354 CHAR ID[34]; 355 CHAR HotKeyID[34]; 348 356 349 357 if (cmdhead) … … 355 363 fp = _fsopen(pszCmdLine, "r", SH_DENYWR); 356 364 if (fp) { 365 xfgets(title, sizeof(title), fp, pszSrcFile, __LINE__); 366 lstrip(title); 367 if (!strnicmp(title, "Version", 7) && !CommandDatVersion) { 368 p = title + 7; 369 while (*p == ' ') 370 p++; 371 bstripcr(p); 372 CommandDatVersion = atol(p); 373 } 357 374 while (!feof(fp)) { 358 375 if (!xfgets_bstripcr(title, sizeof(title), fp, pszSrcFile, __LINE__)) … … 365 382 if (!xfgets_bstripcr(flags, sizeof(flags), fp, pszSrcFile, __LINE__)) 366 383 break; /* error! */ 384 if (CommandDatVersion) { 385 if (!xfgets_bstripcr(ID, sizeof(ID), fp, pszSrcFile, __LINE__)) 386 break; /* error! */ 387 ID[34] = 0; 388 if (!xfgets_bstripcr(HotKeyID, sizeof(HotKeyID), fp, pszSrcFile, __LINE__)) 389 break; /* error! */ 390 ID[34] = 0; 391 } 367 392 pszCmdLine[strlen(pszCmdLine)] = 0; // fixme to know why chopped this way? 368 393 //bstripcr(pszCmdLine); … … 380 405 info->title = xstrdup(title, pszSrcFile, __LINE__); 381 406 info->flags = atol(flags); 407 if (CommandDatVersion) { 408 info->ID = atol(ID); 409 info->HotKeyID = atol(HotKeyID); 410 } 382 411 if (!info->pszCmdLine || !info->title) { 383 412 xfree(info->pszCmdLine, pszSrcFile, __LINE__); … … 412 441 FILE *fp; 413 442 CHAR s[CCHMAXPATH + 14]; 443 INT x = 0; 414 444 415 445 if (!cmdloaded || !cmdhead) … … 421 451 fp = xfopen(s, "w", pszSrcFile, __LINE__); 422 452 if (fp) { 453 //Adds line for version tracking 454 fprintf(fp,"Version 2\n"); 423 455 fputs(GetPString(IDS_COMMANDFILETEXT), fp); 424 456 info = cmdhead; 425 457 while (info) { 426 fprintf(fp, 427 ";\n%0.99s\n%0.*s\n%lu\n", 428 info->title, MaxComLineStrg, info->pszCmdLine, info->flags); 458 //This updates the old commands.dat file to the new format 459 //assigning the IDs based on file order 460 if (!info->ID) { 461 info->ID = IDM_COMMANDSTART + x; 462 UsedCommandIDs[x] = TRUE; 463 if (x < 20) { 464 info->HotKeyID = IDM_COMMANDNUM0 + x; 465 UsedHotKeyIDs[x] = TRUE; 466 } 467 } 468 fprintf(fp, ";\n%0.99s\n%0.*s\n%lu\n%lu\n%lu\n", 469 info->title, MaxComLineStrg, info->pszCmdLine, 470 info->flags, info->ID, info->HotKeyID); 471 //else 472 // fprintf(fp, 473 // ";\n%0.99s\n%0.*s\n%lu\n", 474 // info->title, MaxComLineStrg, info->pszCmdLine, info->flags); 475 x++; 429 476 info = info->next; 430 } 477 } // while 478 PrfWriteProfileData(fmprof, FM3Str, "UsedCommandIDs", &UsedCommandIDs, 479 sizeof(BOOL) * 300); 480 PrfWriteProfileData(fmprof, FM3Str, "UsedHotKeyIDs", &UsedHotKeyIDs, 481 sizeof(BOOL) * 20); 431 482 fclose(fp); 432 } 483 } // if (fp) 433 484 } 434 485 435 486 //== add_command() Add command to list == 436 487 437 LINKCMDS *add_command(COMMAND * 488 LINKCMDS *add_command(COMMAND *addme) 438 489 { 439 490 LINKCMDS *info; 491 ULONG size; 492 INT x; 440 493 441 494 if (!addme || !*addme->pszCmdLine || !*addme->title) … … 452 505 info->pszCmdLine = xstrdup(addme->pszCmdLine, pszSrcFile, __LINE__); 453 506 info->title = xstrdup(addme->title, pszSrcFile, __LINE__); 507 info->HotKeyID = addme->HotKeyID; 508 if (!info->ID) { 509 PrfQueryProfileData(fmprof, FM3Str, "UsedCommandIDs", &UsedCommandIDs, 510 &size); //profile updated by save_commands 511 for (x = 0; x < 300; x++) { 512 if (!UsedCommandIDs[x]) { 513 info->ID = IDM_COMMANDSTART + x; 514 break; 515 } 516 } 517 } 454 518 if (addme->flags) 455 519 info->flags = addme->flags; 456 if (!info->pszCmdLine || !info->title ) {520 if (!info->pszCmdLine || !info->title || !info->ID) { 457 521 xfree(info->pszCmdLine, pszSrcFile, __LINE__); 458 522 xfree(info->title, pszSrcFile, __LINE__); … … 479 543 while (info) { 480 544 if (!stricmp(info->title, killme)) { 545 UsedCommandIDs[info->ID - IDM_COMMANDSTART] = FALSE; 546 if (info->HotKeyID) 547 UsedHotKeyIDs[info->HotKeyID - IDM_COMMANDNUM0] = FALSE; 481 548 if (info == cmdhead) { 482 549 cmdhead = info->next; … … 818 885 bstripcr(env); 819 886 if (*env) { 820 PrfWriteProfileString(fmprof, FM3Str, temp. pszCmdLine, env);887 PrfWriteProfileString(fmprof, FM3Str, temp.title, env); 821 888 } 822 889 x = (SHORT) WinSendDlgItemMsg(hwnd, … … 846 913 847 914 WinQueryDlgItemText(hwnd, CMD_TITLE, 100, temp); 848 bstrip(temp); 915 bstrip(temp); 916 PrfWriteProfileString(fmprof, FM3Str, temp, NULL); 849 917 if (!kill_command(temp)) 850 918 Runtime_Error(pszSrcFile, __LINE__, "kill_command"); … … 908 976 WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp.title), temp.title); 909 977 bstrip(temp.title); 978 PrfWriteProfileString(fmprof, FM3Str, temp.title, NULL); 910 979 if (kill_command(temp.title)){ 911 980 x = (SHORT) WinSendDlgItemMsg(hwnd, … … 953 1022 bstripcr(env); 954 1023 if (*env) { 955 PrfWriteProfileString(fmprof, FM3Str, temp. pszCmdLine, env);1024 PrfWriteProfileString(fmprof, FM3Str, temp.title, env); 956 1025 } //put item back in original place 957 1026 x = (SHORT) WinSendDlgItemMsg(hwnd, … … 1019 1088 LINKCMDS *info; 1020 1089 1090 DbgMsg(pszSrcFile, __LINE__,"ID %i", cx); 1021 1091 list = BuildList(hwnd); 1022 1092 x = 0; 1023 1093 info = cmdhead; 1024 1094 while (info) { 1025 x++; 1026 if (x == cx) 1027 break; 1095 //x++; 1096 if (cx < 4300) { 1097 if (info->ID == cx) 1098 break; 1099 } 1100 else { 1101 if (info->HotKeyID == cx) 1102 break; 1103 } 1028 1104 info = info->next; 1029 1105 } … … 1031 1107 1032 1108 INT flags; 1109 CHAR env[1002]; 1033 1110 1034 1111 x--; … … 1041 1118 flags |= SEPARATE; 1042 1119 flags &= ~(KEEP | DIEAFTER); 1120 PrfQueryProfileString(fmprof, FM3Str, info->title, NullStr, env, sizeof(env)); 1043 1121 if (!strchr(info->pszCmdLine, '%')) { 1044 1122 CHAR *fakelist[2]; … … 1048 1126 ExecOnList(hwnd, 1049 1127 info->pszCmdLine, 1050 flags, NULL, fakelist, GetPString(IDS_EXECCMDTITLETEXT),1128 flags, env, fakelist, GetPString(IDS_EXECCMDTITLETEXT), 1051 1129 pszSrcFile, __LINE__); 1052 1130 } … … 1062 1140 ExecOnList(hwnd, 1063 1141 info->pszCmdLine, 1064 flags, NULL, fakelist, GetPString(IDS_EXECCMDTITLETEXT),1142 flags, env, fakelist, GetPString(IDS_EXECCMDTITLETEXT), 1065 1143 pszSrcFile, __LINE__); 1066 1144 } … … 1069 1147 ExecOnList(hwnd, 1070 1148 info->pszCmdLine, 1071 flags, NULL, list, GetPString(IDS_EXECCMDTITLETEXT),1149 flags, env, list, GetPString(IDS_EXECCMDTITLETEXT), 1072 1150 pszSrcFile, __LINE__); 1073 1151 else -
trunk/dll/command.h
r1205 r1486 32 32 CHAR *title; 33 33 ULONG flags; 34 ULONG ID; 35 ULONG HotKeyID; 34 36 struct LINKCMDS *next; 35 37 struct LINKCMDS *prev; -
trunk/dll/dircnrs.c
r1482 r1486 2734 2734 if (!cmdloaded) 2735 2735 load_commands(); 2736 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;2736 x = SHORT1FROMMP(mp1);// - IDM_COMMANDSTART; 2737 2737 if (x >= 0) { 2738 x++;2738 //x++; 2739 2739 RunCommand(hwnd, x); 2740 2740 if (fUnHilite) -
trunk/dll/fm3dll2.h
r1480 r1486 504 504 #define IDM_COMMANDSMENU 4000 505 505 #define IDM_COMMANDSTART 4001 506 #define IDM_COMMANDNUM0 4 001507 #define IDM_COMMANDNUM1 4 002508 #define IDM_COMMANDNUM2 4 003509 #define IDM_COMMANDNUM3 4 004510 #define IDM_COMMANDNUM4 4 005511 #define IDM_COMMANDNUM5 4 006512 #define IDM_COMMANDNUM6 4 007513 #define IDM_COMMANDNUM7 4 008514 #define IDM_COMMANDNUM8 4 009515 #define IDM_COMMANDNUM9 4 010516 #define IDM_COMMANDNUM10 4 011517 #define IDM_COMMANDNUM11 4 012518 #define IDM_COMMANDNUM12 4 013519 #define IDM_COMMANDNUM13 4 014520 #define IDM_COMMANDNUM14 4 015521 #define IDM_COMMANDNUM15 4 016522 #define IDM_COMMANDNUM16 4 017523 #define IDM_COMMANDNUM17 4 018524 #define IDM_COMMANDNUM18 4 019525 #define IDM_COMMANDNUM19 4 020506 #define IDM_COMMANDNUM0 4301 507 #define IDM_COMMANDNUM1 4302 508 #define IDM_COMMANDNUM2 4303 509 #define IDM_COMMANDNUM3 4304 510 #define IDM_COMMANDNUM4 4305 511 #define IDM_COMMANDNUM5 4306 512 #define IDM_COMMANDNUM6 4307 513 #define IDM_COMMANDNUM7 4308 514 #define IDM_COMMANDNUM8 4309 515 #define IDM_COMMANDNUM9 4310 516 #define IDM_COMMANDNUM10 4311 517 #define IDM_COMMANDNUM11 4312 518 #define IDM_COMMANDNUM12 4313 519 #define IDM_COMMANDNUM13 4314 520 #define IDM_COMMANDNUM14 4315 521 #define IDM_COMMANDNUM15 4316 522 #define IDM_COMMANDNUM16 4317 523 #define IDM_COMMANDNUM17 4318 524 #define IDM_COMMANDNUM18 4319 525 #define IDM_COMMANDNUM19 4320 526 526 527 527 #define IDM_QUICKTOOLSTART 4899 -
trunk/dll/ipf/fm3.ipf
r1471 r1486 593 593 whitespace after the button (separates it from the next button). 594 594 :p. 595 If you check the :hp1. Don't user FM2 defined bmp:ehp1. checkbox, FM/2 will allow595 If you check the :hp1.Don't use FM2 defined bmp:ehp1. checkbox, FM/2 will 596 596 no longer load the button's bitmap. This will change the button to a text button. 597 It will also allow you to use your own bitmap for this button Bitmaps are named 598 after the :hp1.ID:ehp1. of the button -- for example, the bitmap file for ID 1005 599 would be named "1005.bmp". Clicking the :hp1.Edit bmp:ehp1. button will cause ICONEDIT 600 to be loaded with the bitmap, ready to edit. (Note that bitmaps should 601 be 32 x 32.; if the bmp seems to big try resizing it to 28 x 28) 597 It will also allow you to use your own bitmap for this button Bitmaps can be named 598 after the :hp1.ID:ehp1. or the :hp1.Text:ehp1. of the button -- for example, 599 the bitmap file for ID 1026 (MakeDir) could be named "1026.bmp" or "MakeDir.bmp". 600 Clicking the :hp1.Edit bmp:ehp1. button will cause ICONEDIT to be loaded with 601 the bitmap, ready to edit. (Note that bitmaps should be 32 x 32.; if the bmp 602 seems to big try resizing it to 28 x 28) 602 603 :p. 603 604 The :hp1.ID:ehp1. field identifies the command that is associated with -
trunk/dll/loadbmp.c
r1438 r1486 40 40 static HBITMAP LoadBitmapFromFile(CHAR * pszFileName); 41 41 42 HBITMAP LoadBitmapFromFile Num(USHORT id)42 HBITMAP LoadBitmapFromFileIdentifier(USHORT id, CHAR *text) 43 43 { 44 44 char s[CCHMAXPATH]; 45 HBITMAP hBmp = (HBITMAP) 0; 45 46 46 47 strcpy(s, pFM2SaveDirectory); 47 48 sprintf(s + strlen(s), "%s%u.BMP", PCSZ_BACKSLASH, id); 48 return LoadBitmapFromFile(s); 49 hBmp = LoadBitmapFromFile(s); 50 if (!hBmp) { 51 strcpy(s, pFM2SaveDirectory); 52 sprintf(s + strlen(s), "%s%s.BMP", PCSZ_BACKSLASH, text); 53 hBmp = LoadBitmapFromFile(s); 54 } 55 return hBmp; 49 56 } 50 57 … … 362 369 } 363 370 364 #pragma alloc_text(LOADBITMAP,LoadBitmapFromFile,LoadBitmapFromFile Num)371 #pragma alloc_text(LOADBITMAP,LoadBitmapFromFile,LoadBitmapFromFileIdentifier) -
trunk/dll/loadbmp.h
r1198 r1486 16 16 #define LOADBMP_H 17 17 18 HBITMAP LoadBitmapFromFile Num(USHORT id);18 HBITMAP LoadBitmapFromFileIdentifier(USHORT id, CHAR *text); 19 19 20 20 -
trunk/dll/mainwnd.c
r1482 r1486 1582 1582 } 1583 1583 if (!hwndTool) { 1584 HBITMAP hbm = LoadBitmapFromFile Num(tool->id);1584 HBITMAP hbm = LoadBitmapFromFileIdentifier(tool->id, tool->text); 1585 1585 1586 1586 if (hbm) { … … 5360 5360 break; 5361 5361 } 5362 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;5362 x = SHORT1FROMMP(mp1);// - IDM_COMMANDSTART; 5363 5363 if (x >= 0) { 5364 x++;5364 //x++; 5365 5365 RunCommand(hwndCnr, x); 5366 5366 if (fUnHilite) { … … 6013 6013 6014 6014 case UM_ADDTOMENU: 6015 AddToMenu((CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 6015 AddToMenu(( 6016 CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 6016 6017 FID_MENU)); 6017 6018 return 0; … … 6351 6352 LM_QUERYSELECTION, 6352 6353 MPFROMSHORT(LIT_FIRST), MPVOID); 6353 if (sSelect >= 0) 6354 if (sSelect >= 0) { 6355 CHAR s[CCHMAXPATH]; 6356 CHAR *p; 6357 6358 WinSendMsg(hwndCmdlist, LM_QUERYITEMTEXT, 6359 MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s)); 6360 p = strrchr(s, '}'); 6361 p = 0; 6362 p = strrchr(s, '{'); 6363 p++; 6354 6364 WinPostMsg(hwnd, 6355 6365 WM_COMMAND, 6356 MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0), 6357 MPVOID); 6358 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 6366 MPFROM2SHORT(atol(p), 0), //IDM_COMMANDSTART + sSelect, 0), 6367 MPVOID); 6368 } 6369 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 6359 6370 } 6360 6371 } -
trunk/dll/mainwnd2.c
r1482 r1486 719 719 break; 720 720 } 721 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;721 x = SHORT1FROMMP(mp1);// - IDM_COMMANDSTART; 722 722 if (x >= 0) { 723 x++;723 //x++; 724 724 RunCommand(hwndCnr, x); 725 725 if (fUnHilite) { -
trunk/dll/misc.c
r1480 r1486 1320 1320 MPVOID, MPVOID); 1321 1321 WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, MPFROMSHORT(-1), MPVOID); 1322 for (x = 0; x < numitems; x++) 1322 //for (x = 0; x < numitems; x++) 1323 info = cmdhead; 1324 while (info) { 1323 1325 WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, 1324 MPFROMSHORT((SHORT) (x + IDM_COMMANDSTART)), MPVOID); 1326 MPFROMSHORT((SHORT) (info->ID)), MPVOID); 1327 info = info->next; 1328 } 1325 1329 if (hwndCnr && cmdhead) { 1326 1330 x = 0; … … 1331 1335 1332 1336 sprintf(s, 1333 "%s%s%s",1334 info->title, 1335 x < 20? "\tCtrl + " : NullStr,1336 x < 20 && x > 9? "Shift + " : NullStr);1337 if ( x < 20)1337 "%s {%i} %s%s", 1338 info->title, info->ID, 1339 info->HotKeyID ? "\tCtrl + " : NullStr, 1340 info->HotKeyID && info->HotKeyID > 4310 ? "Shift + " : NullStr); 1341 if (info->HotKeyID) 1338 1342 sprintf(&s[strlen(s)], "%d", 1339 ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1); 1340 mi.id = IDM_COMMANDSTART + x; 1343 (((info->HotKeyID - 4301) % 10) + 1) == 10 ? 0 : 1344 ((info->HotKeyID - 4301) % 10) + 1); 1345 mi.id = info->ID; //IDM_COMMANDSTART + x; 1341 1346 mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) | 1342 1347 (info->flags & PROMPT ? MIA_FRAMED : 0); -
trunk/dll/tools.c
r1435 r1486 669 669 CHAR idstr[7]; 670 670 USHORT id; 671 CHAR text[CCHMAXPATH]; 671 672 672 673 *idstr = 0; 673 674 WinQueryDlgItemText(hwnd, ADDBTN_ID, 6, idstr); 675 WinQueryDlgItemText(hwnd, ADDBTN_TEXT,CCHMAXPATH - 1, text); 674 676 id = atoi(idstr); 675 677 if (id) { … … 678 680 hbm = GpiLoadBitmap(hps, 0, id, 28, 28); 679 681 if (!hbm) 680 hbm = LoadBitmapFromFile Num(id);682 hbm = LoadBitmapFromFileIdentifier(id, text); 681 683 if (hbm) { 682 684 hbmd = (HBITMAP) WinSendDlgItemMsg(hwnd, ADDBTN_BMP, SM_QUERYHANDLE, -
trunk/dll/treecnr.c
r1480 r1486 3006 3006 if (!cmdloaded) 3007 3007 load_commands(); 3008 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;3008 x = SHORT1FROMMP(mp1);// - IDM_COMMANDSTART; 3009 3009 if (x >= 0) { 3010 x++;3010 //x++; 3011 3011 RunCommand(hwnd, x); 3012 3012 if (fUnHilite)
Note:
See TracChangeset
for help on using the changeset viewer.