16 "{ NameSpace: Smalltalk }" |
14 "{ NameSpace: Smalltalk }" |
17 |
15 |
18 ApplicationModel subclass:#SettingsDialog |
16 ApplicationModel subclass:#SettingsDialog |
19 instanceVariableNames:'requestor subCanvasApplicationHolder help doReload doSave |
17 instanceVariableNames:'requestor subCanvasApplicationHolder help doReload doSave |
20 enableReload enableHelp enableOK selectedItem applicationList |
18 enableReload enableHelp enableOK selectedItem applicationList |
21 categoryIcons lastSelection whyDisabledInfoHolder' |
19 categoryIcons lastSelection whyDisabledInfoHolder |
|
20 quickSearchStringHolder quickSearchFieldShownHolder |
|
21 highlightedWidgetsOriginalAttributes' |
22 classVariableNames:'ApplicationList IconList' |
22 classVariableNames:'ApplicationList IconList' |
23 poolDictionaries:'' |
23 poolDictionaries:'' |
24 category:'Interface-Smalltalk' |
24 category:'Interface-Smalltalk' |
25 ! |
25 ! |
26 |
26 |
388 (ViewSpec |
388 (ViewSpec |
389 name: 'Box1' |
389 name: 'Box1' |
390 component: |
390 component: |
391 (SpecCollection |
391 (SpecCollection |
392 collection: ( |
392 collection: ( |
393 (HierarchicalListViewSpec |
393 (VerticalPanelViewSpec |
394 name: 'HierarchicalListView1' |
394 name: 'VerticalPanel1' |
395 layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -34 1) |
395 layout: (LayoutFrame 0 0 0 0 0 1 -34 1) |
396 model: selectedItem |
396 horizontalLayout: fit |
397 hasHorizontalScrollBar: true |
397 verticalLayout: topFit |
398 hasVerticalScrollBar: true |
398 horizontalSpace: 3 |
399 listModel: applicationList |
399 verticalSpace: 3 |
400 useIndex: false |
400 component: |
401 highlightMode: label |
401 (SpecCollection |
402 showLeftIndicators: false |
402 collection: ( |
403 indicatorSelector: doIndicatorClick: |
403 (ViewSpec |
|
404 name: 'QuickSearchBox' |
|
405 visibilityChannel: quickSearchFieldShownHolder |
|
406 component: |
|
407 (SpecCollection |
|
408 collection: ( |
|
409 (LabelSpec |
|
410 label: 'Quick Search:' |
|
411 name: 'Label1' |
|
412 layout: (LayoutFrame 0 0 0 0 150 0 0 1) |
|
413 translateLabel: true |
|
414 adjust: left |
|
415 ) |
|
416 (InputFieldSpec |
|
417 name: 'QuickSeachEntryField' |
|
418 layout: (LayoutFrame 150 0 0 0 0 1 0 1) |
|
419 model: quickSearchStringHolder |
|
420 immediateAccept: true |
|
421 acceptOnReturn: true |
|
422 acceptOnTab: true |
|
423 acceptOnPointerLeave: true |
|
424 ) |
|
425 ) |
|
426 |
|
427 ) |
|
428 extent: (Point 260 30) |
|
429 ) |
|
430 (HierarchicalListViewSpec |
|
431 name: 'HierarchicalListView1' |
|
432 model: selectedItem |
|
433 hasHorizontalScrollBar: true |
|
434 hasVerticalScrollBar: true |
|
435 listModel: applicationList |
|
436 useIndex: false |
|
437 highlightMode: label |
|
438 showLeftIndicators: false |
|
439 indicatorSelector: doIndicatorClick: |
|
440 extent: (Point 260 575) |
|
441 ) |
|
442 ) |
|
443 |
|
444 ) |
404 ) |
445 ) |
405 (HorizontalPanelViewSpec |
446 (HorizontalPanelViewSpec |
406 name: 'HorizontalPanel2' |
447 name: 'HorizontalPanel2' |
407 layout: (LayoutFrame 0 0.0 -34 1 0 1.0 0 1) |
448 layout: (LayoutFrame 0 0.0 -34 1 0 1.0 0 1) |
408 visibilityChannel: loadAndSaveSettingsItemVisible |
449 visibilityChannel: loadAndSaveSettingsItemVisible |
491 activeHelpKey: helpOnSettings |
532 activeHelpKey: helpOnSettings |
492 translateLabel: true |
533 translateLabel: true |
493 tabable: true |
534 tabable: true |
494 model: help |
535 model: help |
495 enableChannel: enableHelp |
536 enableChannel: enableHelp |
496 extent: (Point 163 22) |
537 extent: (Point 161 22) |
497 ) |
538 ) |
498 (ActionButtonSpec |
539 (ActionButtonSpec |
499 label: 'Discard' |
540 label: 'Discard' |
500 name: 'Reload' |
541 name: 'Reload' |
501 activeHelpKey: discardChangedSettings |
542 activeHelpKey: discardChangedSettings |
502 translateLabel: true |
543 translateLabel: true |
503 tabable: true |
544 tabable: true |
504 model: doReload |
545 model: doReload |
505 enableChannel: enableReload |
546 enableChannel: enableReload |
506 extent: (Point 163 22) |
547 extent: (Point 162 22) |
507 ) |
548 ) |
508 (ActionButtonSpec |
549 (ActionButtonSpec |
509 label: 'Apply' |
550 label: 'Apply' |
510 name: 'Apply' |
551 name: 'Apply' |
511 activeHelpKey: acceptChangedSettings |
552 activeHelpKey: acceptChangedSettings |
512 translateLabel: true |
553 translateLabel: true |
513 tabable: true |
554 tabable: true |
514 model: doSave |
555 model: doSave |
515 enableChannel: enableOK |
556 enableChannel: enableOK |
516 extent: (Point 164 22) |
557 extent: (Point 162 22) |
517 ) |
558 ) |
518 ) |
559 ) |
519 |
560 |
520 ) |
561 ) |
521 keepSpaceForOSXResizeHandleH: true |
562 keepSpaceForOSXResizeHandleH: true |
1437 settingsDialog. I think this has to be reworked..." |
1485 settingsDialog. I think this has to be reworked..." |
1438 |
1486 |
1439 ^ requestor notNil "/ loadAndSaveSettingsItemVisible |
1487 ^ requestor notNil "/ loadAndSaveSettingsItemVisible |
1440 ! |
1488 ! |
1441 |
1489 |
|
1490 quickSearchFieldShownHolder |
|
1491 quickSearchFieldShownHolder isNil ifTrue:[ |
|
1492 quickSearchFieldShownHolder := false asValue |
|
1493 ]. |
|
1494 ^ quickSearchFieldShownHolder. |
|
1495 ! |
|
1496 |
|
1497 quickSearchStringHolder |
|
1498 <resource: #uiAspect> |
|
1499 |
|
1500 quickSearchStringHolder isNil ifTrue:[ |
|
1501 quickSearchStringHolder := ValueHolder new. |
|
1502 quickSearchStringHolder onChangeSend:#quickSearchStringHolderChanged to:self. |
|
1503 ]. |
|
1504 ^ quickSearchStringHolder. |
|
1505 ! |
|
1506 |
1442 selectedItem |
1507 selectedItem |
1443 selectedItem isNil ifTrue:[ |
1508 selectedItem isNil ifTrue:[ |
1444 selectedItem := ValueHolder new. |
1509 selectedItem := ValueHolder new. |
1445 selectedItem addDependent:self. |
1510 selectedItem addDependent:self. |
1446 ]. |
1511 ]. |
1717 saveSettingsWithoutAskingForFile |
1785 saveSettingsWithoutAskingForFile |
1718 self class saveSettingsWithoutAskingForFile. |
1786 self class saveSettingsWithoutAskingForFile. |
1719 self realApplicationsDo:[:app | app clearDidModifySettings]. |
1787 self realApplicationsDo:[:app | app clearDidModifySettings]. |
1720 ! ! |
1788 ! ! |
1721 |
1789 |
|
1790 !SettingsDialog methodsFor:'quick search support'! |
|
1791 |
|
1792 highlightWidgets:aSetOfWidget |
|
1793 "highlight a matching widget" |
|
1794 |
|
1795 highlightedWidgetsOriginalAttributes := Dictionary new. |
|
1796 aSetOfWidget do:[:w | |
|
1797 |perWidget| |
|
1798 |
|
1799 highlightedWidgetsOriginalAttributes at:w put:(perWidget := Dictionary new). |
|
1800 perWidget at:#borderWidth: put:w borderWidth. |
|
1801 perWidget at:#borderColor: put:w borderColor. |
|
1802 |
|
1803 w borderWidth:2. |
|
1804 w borderColor:Color red. |
|
1805 ]. |
|
1806 ! |
|
1807 |
|
1808 highlightWidgetsWithMatchingSearchString |
|
1809 "whenever an app is selected AND a quick search string is present, |
|
1810 go through the widgets and highlight those which match. |
|
1811 This is done by looking at the helpkey and model aspects for a match" |
|
1812 |
|
1813 |app searchString pattern words widgetsToHighlight| |
|
1814 |
|
1815 highlightedWidgetsOriginalAttributes notNil ifTrue:[ |
|
1816 self unhighlightWidgets. |
|
1817 ]. |
|
1818 |
|
1819 searchString := self quickSearchStringHolder value. |
|
1820 searchString isEmptyOrNil ifTrue:[^ self]. |
|
1821 |
|
1822 pattern := '*',searchString,'*'. |
|
1823 |
|
1824 (app := subCanvasApplicationHolder value) isNil ifTrue:[^ self]. |
|
1825 |
|
1826 widgetsToHighlight := Set new. |
|
1827 words := app quickSearchStrings. |
|
1828 |
|
1829 (words contains:[:word | pattern match:word]) ifTrue:[ |
|
1830 "/ ok - there is a match |
|
1831 app window withAllSubViewsDo:[:v | |
|
1832 v helpKey notNil ifTrue:[ |
|
1833 (pattern match:v helpKey caseSensitive:false) ifTrue:[ |
|
1834 |alreadyIn| |
|
1835 |
|
1836 alreadyIn := false. |
|
1837 v allSuperViewsDo:[:sv | (widgetsToHighlight includes:sv) ifTrue:[ alreadyIn := true]]. |
|
1838 alreadyIn ifFalse:[ widgetsToHighlight add:v ]. |
|
1839 ]. |
|
1840 ]. |
|
1841 ]. |
|
1842 ]. |
|
1843 self highlightWidgets:widgetsToHighlight. |
|
1844 ! |
|
1845 |
|
1846 quickSearchStringHolderChanged |
|
1847 |oldSelection searchString pattern matches| |
|
1848 |
|
1849 oldSelection := self selectedItem value. |
|
1850 |
|
1851 "/ make all labels normal |
|
1852 applicationList root recursiveDo:[:eachSettingsAppItem | |
|
1853 eachSettingsAppItem label:(eachSettingsAppItem label string). |
|
1854 ]. |
|
1855 |
|
1856 searchString := self quickSearchStringHolder value. |
|
1857 searchString isEmptyOrNil ifTrue:[^ self]. |
|
1858 pattern := '*',searchString,'*'. |
|
1859 |
|
1860 applicationList root recursiveExpand. |
|
1861 "/ applicationList root recursiveDo:[:eachSettingsAppItem | |
|
1862 "/ eachSettingsAppItem expand. |
|
1863 "/ ]. |
|
1864 matches := OrderedCollection new. |
|
1865 "/ now search all specs for this word |
|
1866 applicationList root recursiveDo:[:eachSettingsAppItem | |
|
1867 |app words| |
|
1868 |
|
1869 eachSettingsAppItem applicationClass notNil ifTrue:[ |
|
1870 (app := eachSettingsAppItem application) isNil ifTrue:[ |
|
1871 eachSettingsAppItem application:(app := eachSettingsAppItem applicationClass new). |
|
1872 ]. |
|
1873 words := app quickSearchStrings. |
|
1874 (words contains:[:word | pattern match:word caseSensitive:false ]) ifTrue:[ |
|
1875 matches add:eachSettingsAppItem. |
|
1876 ]. |
|
1877 ]. |
|
1878 ]. |
|
1879 applicationList root children do:[:c | c recursiveCollapse]. |
|
1880 "/ now expand all matches |
|
1881 matches do:[:eachMatchingItem | |
|
1882 eachMatchingItem label:(eachMatchingItem label string allBold). |
|
1883 eachMatchingItem makeVisible |
|
1884 ]. |
|
1885 |
|
1886 oldSelection notNil ifTrue:[ |
|
1887 oldSelection makeVisible. |
|
1888 self selectedItem value:oldSelection. |
|
1889 ]. |
|
1890 ! |
|
1891 |
|
1892 unhighlightWidget:aWidget |
|
1893 "unhighlight a matching widget" |
|
1894 |
|
1895 highlightedWidgetsOriginalAttributes notNil ifTrue:[ |
|
1896 highlightedWidgetsOriginalAttributes keysAndValuesDo:[:widget :oldValues | |
|
1897 oldValues keysAndValuesDo:[:sel :oldValue | |
|
1898 widget perform:sel with:oldValue |
|
1899 ]. |
|
1900 ]. |
|
1901 highlightedWidgetsOriginalAttributes := nil. |
|
1902 ]. |
|
1903 ! |
|
1904 |
|
1905 unhighlightWidgets |
|
1906 "unhighlight a matching widget" |
|
1907 |
|
1908 highlightedWidgetsOriginalAttributes notNil ifTrue:[ |
|
1909 highlightedWidgetsOriginalAttributes keysAndValuesDo:[:widget :oldValues | |
|
1910 oldValues keysAndValuesDo:[:sel :oldValue | |
|
1911 widget perform:sel with:oldValue |
|
1912 ]. |
|
1913 ]. |
|
1914 highlightedWidgetsOriginalAttributes := nil. |
|
1915 ]. |
|
1916 ! ! |
|
1917 |
1722 !SettingsDialog methodsFor:'selection'! |
1918 !SettingsDialog methodsFor:'selection'! |
1723 |
1919 |
1724 selectItemWithClass:aClass |
1920 selectItemWithClass:aClass |
1725 "select an item based on the sub-settings application class" |
1921 "select an item based on the sub-settings application class" |
1726 |
1922 |