• R/O
  • SSH

pcbelegance: Commit

PCB Elegance source


Commit MetaInfo

Revisãoaaa16e3a4cf0aeccb8b8a7337d84022a85e2a0dc (tree)
Hora2021-05-04 19:42:17
AutorTim Worthington
CommiterTim Worthington

Mensagem de Log

Sch: Save component database window settings in sch.ini

Mudança Sumário

Diff

diff -r 87b6b7871092 -r aaa16e3a4cf0 sch/dialogs2.c
--- a/sch/dialogs2.c Sun May 02 23:45:27 2021 +1000
+++ b/sch/dialogs2.c Tue May 04 20:42:17 2021 +1000
@@ -88,6 +88,14 @@
8888 int32 RemoveTreeSelection;
8989 HWND ComponentDialog = NULL;
9090
91+int32 ComponentDialogWidth = 577;
92+int32 ComponentDialogHeight = 225;
93+int32 ComponentDialogTableViewMode = 0;
94+int32 ComponentDialogShowGeometry = 0;
95+int32 ComponentDialogCheckForErrors = 0;
96+int32 ComponentDialogUserName[MAX_LENGTH_STRING] = { 0 };
97+
98+
9199 extern RECT DialogWindowRect;
92100 //extern int32 NrCompSelects;
93101 extern int32 NrTryingSymbols;
@@ -259,7 +267,7 @@
259267 STARTUPINFO ExternalEditStartupInfo;
260268 PROCESS_INFORMATION ExternalEditProcessInfo;
261269
262-int32 ExternalEdit, ShowGeometry, OnlineCheck, PlaceComponents, ViewTablesAsList;
270+int32 ExternalEdit, PlaceComponents = 1;
263271
264272 extern char GeometrieName[MAX_LENGTH_STRING];
265273 extern int32 CurrentGeometryDialog;
@@ -351,35 +359,35 @@
351359
352360 PunctChar Punct[] =
353361 {
354- { L'.', 1e0, 6, 2 },
355- { L',', 1e0, 6, 2 },
356- { L'R', 1e0, 3, 1 },
362+ { L'.', (float)1e0, 6, 2 },
363+ { L',', (float)1e0, 6, 2 },
364+ { L'R', (float)1e0, 3, 1 },
357365 // Capacitors
358- { L'p', 1e-12, 2, 0 },
359- { L'P', 1e-12, 2, 0 },
360- { L'N', 1e-9, 2, 0 },
361- { L'n', 1e-9, 2, 0 },
362- { L'u', 1e-6, 2, 0 }, // 0u0047
363- { L'U', 1e-6, 2, 0 },
364- { L'\x03BC', 1e-6, 2, 0 }, // Greek lowercase mu
365- { L'\x00B5', 1e-6, 2, 0 }, // Ansi micro
366- { L'm', 1e-3, 2, 0 },
367- { L'f', 1e0, 2, 0 },
368- { L'F', 1e0, 2, 0 },
369- // Resistors
370- { L'\x03A9', 1e0, 2, 0 }, // Greek capital omega
371- { L'\x2126', 1e0, 2, 0 }, // Ohm sign
372- { L'L', 1e-3, 2, 0 },
373- { L'k', 1e3, 2, 0 },
374- { L'K', 1e3, 2, 0 },
375- { L'M', 1e6, 2, 0 },
376- { L'g', 1e9, 2, 0 },
377- { L'G', 1e9, 2, 0 },
366+ { L'p', (float)1e-12, 2, 0 },
367+ { L'P', (float)1e-12, 2, 0 },
368+ { L'N', (float)1e-9, 2, 0 },
369+ { L'n', (float)1e-9, 2, 0 },
370+ { L'u', (float)1e-6, 2, 0 }, // 0u0047
371+ { L'U', (float)1e-6, 2, 0 },
372+ { L'\x03BC', (float)1e-6, 2, 0 }, // Greek lowercase mu
373+ { L'\x00B5', (float)1e-6, 2, 0 }, // Ansi micro
374+ { L'm', (float)1e-3, 2, 0 },
375+ { L'f', (float)1e0, 2, 0 },
376+ { L'F', (float)1e0, 2, 0 },
377+ // Resistors
378+ { L'\x03A9', (float)1e0, 2, 0 }, // Greek capital omega
379+ { L'\x2126', (float)1e0, 2, 0 }, // Ohm sign
380+ { L'L', (float)1e-3, 2, 0 },
381+ { L'k', (float)1e3, 2, 0 },
382+ { L'K', (float)1e3, 2, 0 },
383+ { L'M', (float)1e6, 2, 0 },
384+ { L'g', (float)1e9, 2, 0 },
385+ { L'G', (float)1e9, 2, 0 },
378386 // Diodes
379- { L'v', 1e0, 2, 0 },
380- { L'V', 1e0, 2, 0 },
381-
382- { L'\0', 0e0, 0, 0 }, // Terminate
387+ { L'v', (float)1e0, 2, 0 },
388+ { L'V', (float)1e0, 2, 0 },
389+
390+ { L'\0', (float)0e0, 0, 0 }, // Terminate
383391
384392 };
385393
@@ -568,7 +576,6 @@
568576 {
569577 int32 cnt, res, NrItems;
570578 HDITEM HdItem;
571- LVCOLUMN LvCol;
572579 LVITEM LvItem;
573580
574581 switch (CsvColumn[ListColumn[Column].CsvCol].Index)
@@ -632,7 +639,6 @@
632639 WCHAR wstr1[MAX_LENGTH_STRING];
633640 WCHAR wstr2[MAX_LENGTH_STRING];
634641 LVITEM LvItem;
635- int32 res;
636642
637643 LvItem.mask = LVIF_TEXT;
638644 LvItem.iItem = LParam1;
@@ -3741,7 +3747,7 @@
37413747
37423748 if ((fp = TextFileOpenUTF8(str2)) < 0)
37433749 {
3744- MessageBoxUTF8(SCHWindow, SelectedItem, SC(197, "Error in opening file"), MB_APPLMODAL | MB_OK);
3750+ MessageBoxUTF8(SCHWindow, str2, SC(197, "Error in opening file"), MB_APPLMODAL | MB_OK);
37453751 break;
37463752 }
37473753
@@ -3809,7 +3815,11 @@
38093815 LoadTableIcon(str1, ListView_GetItemCount(hListTables) - 1);
38103816
38113817 }
3812- break;
3818+ break;
3819+
3820+ case ID_ADDCOMPONENT_ADD_EXISTING:
3821+ // to do, file selector adds tables from outside database directory
3822+ break;
38133823
38143824 case ID_ADDCOMPONENT_CLONE_TABLE:
38153825 {
@@ -3896,7 +3906,7 @@
38963906 case ID_ADDCOMPONENT_RENAME_TABLE:
38973907 SelectedItem = SendMessage(hListTables, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
38983908 ListView_EditLabel(hListTables, SelectedItem);
3899-
3909+ // to do, rename table file
39003910 break;
39013911
39023912 case ID_ADDCOMPONENT_REGENERATE:
@@ -3905,13 +3915,13 @@
39053915 case ID_ADDCOMPONENT_VIEW_MEDIUM:
39063916 Style = GetWindowLongPtrW(hListTables, GWL_STYLE);
39073917 SetWindowLongPtrW(hListTables, GWL_STYLE, (Style & ~LVS_TYPEMASK) | LVS_ICON);
3908- ViewTablesAsList = 0;
3918+ ComponentDialogTableViewMode = 0;
39093919 break;
39103920
39113921 case ID_ADDCOMPONENT_VIEW_LIST:
39123922 Style = GetWindowLongPtrW(hListTables, GWL_STYLE);
39133923 SetWindowLongPtrW(hListTables, GWL_STYLE, (Style & ~LVS_TYPEMASK) | LVS_LIST);
3914- ViewTablesAsList = 1;
3924+ ComponentDialogTableViewMode = 1;
39153925 break;
39163926
39173927 case ID_ADDCOMPONENT_CHANGE_ICON:
@@ -5719,7 +5729,7 @@
57195729 OrigListTablesWndProc = (WNDPROC)SetWindowLongPtr(hListTables, GWLP_WNDPROC, (LONG_PTR)ListTablesWndProc);
57205730
57215731 // ------------------------------------------------------------------------------
5722- if (ViewTablesAsList == 1)
5732+ if (ComponentDialogTableViewMode == 1)
57235733 {
57245734 Style = GetWindowLongPtrW(hListTables, GWL_STYLE);
57255735 SetWindowLongPtrW(hListTables, GWL_STYLE, (Style & ~LVS_TYPEMASK) | LVS_LIST);
@@ -5738,12 +5748,14 @@
57385748 CheckRadioButton(Dialog, IDC_RADIO4, IDC_RADIO5, IDC_RADIO4); //place position
57395749 }
57405750
5741- if (ShowGeometry)
5751+ if (ComponentDialogShowGeometry)
57425752 SendMessage(GetDlgItem(Dialog, IDC_CHECK2), BM_SETCHECK, BST_CHECKED, 0);
57435753
5744- if (OnlineCheck)
5754+ if (ComponentDialogCheckForErrors)
57455755 SendMessage(GetDlgItem(Dialog, IDC_CHECK3), BM_SETCHECK, BST_CHECKED, 0);
57465756
5757+ SendDlgItemMessageUTF8(Dialog, IDC_EDIT4, WM_SETTEXT, 0, (LPARAM) (LPSTR) ComponentDialogUserName);
5758+
57475759 // ------------------------------------------------------------------------------
57485760
57495761 // create tool tip window
@@ -5923,11 +5935,11 @@
59235935 KillTimer(Dialog, ADD_COMPS_TIMER);
59245936 NrSelections = ListView_GetSelectedCount(hListComps);
59255937
5926- if (OnlineCheck != 0)
5938+ if (ComponentDialogCheckForErrors != 0)
59275939 {
59285940 int32 QuickList;
59295941
5930- OnlineCheck = 2;
5942+ ComponentDialogCheckForErrors = 2;
59315943
59325944 if (NrSelections >= 20)
59335945 {
@@ -5937,13 +5949,13 @@
59375949
59385950 CheckValue(NrSelections, QuickList);
59395951 SetCursor(LoadCursor(NULL, IDC_ARROW));
5940- OnlineCheck = 1;
5952+ ComponentDialogCheckForErrors = 1;
59415953 }
59425954
59435955 if (NrSelections == 1)
59445956 {
59455957 SelectedItem = SendMessage(hListComps, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
5946- if (ShowGeometry != 0)
5958+ if (ComponentDialogShowGeometry != 0)
59475959 {
59485960 Name[0] = File[0] = '\0';
59495961 NameUtf8[0] = FileUtf8[0] = '\0';
@@ -6402,7 +6414,7 @@
64026414 case IDC_LIST2:
64036415 if (((LPNMHDR)LParam)->code == LVN_ITEMCHANGED)
64046416 {
6405- if (OnlineCheck != 2)
6417+ if (ComponentDialogCheckForErrors != 2)
64066418 {
64076419 if (SystemBusyMode == 13)
64086420 EscapeInsertSymbol = 1;
@@ -6499,8 +6511,8 @@
64996511
65006512
65016513 case IDC_CHECK2: // Show geometry
6502- ShowGeometry = SendMessage(GetDlgItem(Dialog, IDC_CHECK2), BM_GETCHECK, 0, 0);
6503- if (ShowGeometry)
6514+ ComponentDialogShowGeometry = SendMessage(GetDlgItem(Dialog, IDC_CHECK2), BM_GETCHECK, 0, 0);
6515+ if (ComponentDialogShowGeometry)
65046516 {
65056517 if (ListView_GetSelectedCount(hListComps) == 1)
65066518 {
@@ -6519,8 +6531,8 @@
65196531 return about;
65206532
65216533 case IDC_CHECK3: // Online check
6522- OnlineCheck = SendMessage(GetDlgItem(Dialog, IDC_CHECK3), BM_GETCHECK, 0, 0);
6523- if (OnlineCheck)
6534+ ComponentDialogCheckForErrors = SendMessage(GetDlgItem(Dialog, IDC_CHECK3), BM_GETCHECK, 0, 0);
6535+ if (ComponentDialogCheckForErrors)
65246536 {
65256537 if (ListView_GetSelectedCount(hListComps) == 1)
65266538 {
@@ -6546,6 +6558,9 @@
65466558 EmptyComponentListbox(Dialog, CurrentTableNr);
65476559 }
65486560
6561+ SendDlgItemMessageUTF8(Dialog, IDC_EDIT4, WM_GETTEXT, MAX_LENGTH_STRING - 1,
6562+ (LPARAM)(LPSTR)ComponentDialogUserName);
6563+
65496564 //ImageList_Destroy(hImageTableNormal);
65506565 //ImageList_Destroy(hImageTableLittle);
65516566 ImageList_Destroy(hImageCompsHeader);
diff -r 87b6b7871092 -r aaa16e3a4cf0 sch/sch.c
--- a/sch/sch.c Sun May 02 23:45:27 2021 +1000
+++ b/sch/sch.c Tue May 04 20:42:17 2021 +1000
@@ -169,6 +169,10 @@
169169 extern char UsedFiles[16][MAX_LENGTH_STRING], PrinterName[MAX_LENGTH_STRING];
170170 extern int32 NrUsedFiles, PrintOptions;
171171
172+extern int32 ComponentDialogWidth, ComponentDialogHeight, ComponentDialogTableViewMode,
173+ ComponentDialogShowGeometry, ComponentDialogCheckForErrors;
174+extern int32 ComponentDialogUserName[MAX_LENGTH_STRING];
175+
172176 extern COLORREF BackGroundColor;
173177 extern HGDIOBJ BackGroundBrush;
174178
@@ -2204,7 +2208,7 @@
22042208 le = strlen(str);
22052209
22062210 if (le > 6)
2207- { // bug?
2211+ {
22082212 strcpy(str2, (LPSTR) & str[le - 3]);
22092213
22102214 if (stricmp(str2, "sch") == 0)
@@ -2409,6 +2413,41 @@
24092413 ComponentDialogInitialY = Value;
24102414 }
24112415
2416+ if (stricmp(str1, "ComponentDialogWidth") == 0)
2417+ {
2418+ if (sscanf(str2, "%i", &Value) == 1)
2419+ ComponentDialogWidth = Value;
2420+ }
2421+
2422+ if (stricmp(str1, "ComponentDialogHeight") == 0)
2423+ {
2424+ if (sscanf(str2, "%i", &Value) == 1)
2425+ ComponentDialogHeight = Value;
2426+ }
2427+
2428+ if (stricmp(str1, "ComponentDialogTableViewMode") == 0)
2429+ {
2430+ if (sscanf(str2, "%i", &Value) == 1)
2431+ ComponentDialogTableViewMode = Value;
2432+ }
2433+
2434+ if (stricmp(str1, "ComponentDialogShowGeometry") == 0)
2435+ {
2436+ if (sscanf(str2, "%i", &Value) == 1)
2437+ ComponentDialogShowGeometry = Value;
2438+ }
2439+
2440+ if (stricmp(str1, "ComponentDialogCheckForErrors") == 0)
2441+ {
2442+ if (sscanf(str2, "%i", &Value) == 1)
2443+ ComponentDialogCheckForErrors = Value;
2444+ }
2445+
2446+ if (stricmp(str1, "ComponentDialogUserName") == 0)
2447+ {
2448+ strcpy_s(ComponentDialogUserName, sizeof(ComponentDialogUserName), str2);
2449+ }
2450+
24122451 if (stricmp(str1, "GeomScreenWidth") == 0)
24132452 {
24142453 if (sscanf(str2, "%i", &Value) == 1)
@@ -2799,8 +2838,18 @@
27992838 WriteLn(fp, str1);
28002839 sprintf(str1, "ComponentDialogInitialY=%i", ComponentDialogInitialY);
28012840 WriteLn(fp, str1);
2802-
2803-
2841+ sprintf(str1, "ComponentDialogWidth=%i", ComponentDialogWidth);
2842+ WriteLn(fp, str1);
2843+ sprintf(str1, "ComponentDialogHeight=%i", ComponentDialogHeight);
2844+ WriteLn(fp, str1);
2845+ sprintf(str1, "ComponentDialogTableViewMode=%i", ComponentDialogTableViewMode);
2846+ WriteLn(fp, str1);
2847+ sprintf(str1, "ComponentDialogShowGeometry=%i", ComponentDialogShowGeometry);
2848+ WriteLn(fp, str1);
2849+ sprintf(str1, "ComponentDialogCheckForErrors=%i", ComponentDialogCheckForErrors);
2850+ WriteLn(fp, str1);
2851+ sprintf(str1, "ComponentDialogUserName=\"%s\"", ComponentDialogUserName);
2852+ WriteLn(fp, str1);
28042853
28052854 sprintf(str1, "GeomScreenWidth=%i", GeomScreenWidth);
28062855 WriteLn(fp, str1);
Show on old repository browser