530 #'value:' #doNew |
531 #'value:' #doNew |
531 ) |
532 ) |
532 #(#MenuItem |
533 #(#MenuItem |
533 #'label:' 'from class ...' |
534 #'label:' 'from class ...' |
534 #'value:' #doFromClass |
535 #'value:' #doFromClass |
535 #'enabled:' #isOwnerOfHelpTool |
536 #'enabled:' #isStandAlone |
536 ) |
537 ) |
537 #(#MenuItem |
538 #(#MenuItem |
538 #'label:' 'pick a menu' |
539 #'label:' 'pick a menu' |
539 #'value:' #doPickAMenu |
540 #'value:' #doPickAMenu |
540 #'enabled:' #isOwnerOfHelpTool |
541 #'enabled:' #isStandAlone |
541 ) |
542 ) |
542 #(#MenuItem |
543 #(#MenuItem |
543 #'label:' '=' |
544 #'label:' '=' |
544 ) |
545 ) |
545 #(#MenuItem |
546 #(#MenuItem |
675 #'tabable:' true |
676 #'tabable:' true |
676 #'menu:' #tabList |
677 #'menu:' #tabList |
677 #'model:' #tabModel |
678 #'model:' #tabModel |
678 #'tabWidget:' #Window |
679 #'tabWidget:' #Window |
679 #'useIndex:' true |
680 #'useIndex:' true |
680 #'canvas:' #tabCanvas |
681 #'canvas:' #noteBookView |
681 ) |
682 ) |
682 #(#HorizontalPanelViewSpec |
683 #(#HorizontalPanelViewSpec |
683 #'name:' 'confirmationPanel' |
684 #'name:' 'confirmationPanel' |
684 #'layout:' #(#LayoutFrame 0 0.5 -24 1.0 0 1.0 0 1.0) |
685 #'layout:' #(#LayoutFrame 0 0.5 -24 1.0 0 1.0 0 1.0) |
685 #'component:' |
686 #'component:' |
729 slicesItem |
730 slicesItem |
730 ^#( |
731 ^#( |
731 (Basics basicsItemSpec) |
732 (Basics basicsItemSpec) |
732 (Details detailsEditSpec) |
733 (Details detailsEditSpec) |
733 (Misc miscEditSpec) |
734 (Misc miscEditSpec) |
734 (Help help) |
|
735 ) |
735 ) |
736 |
736 |
737 ! |
737 ! |
738 |
738 |
739 slicesLink |
739 slicesLink |
740 ^#( |
740 ^#( |
741 (Basics basicsLinkSpec) |
741 (Basics basicsLinkSpec) |
742 (Details detailsEditSpec) |
742 (Details detailsEditSpec) |
743 (Misc miscEditSpec) |
743 (Misc miscEditSpec) |
744 (Help help) |
|
745 ) |
744 ) |
746 |
745 |
747 ! |
746 ! |
748 |
747 |
749 slicesMenu |
748 slicesMenu |
750 ^#( |
749 ^#( |
751 (Basics basicsMenuSpec) |
750 (Basics basicsMenuSpec) |
752 (Details detailsEditSpec) |
751 (Details detailsEditSpec) |
753 (Misc miscEditSpec) |
752 (Misc miscEditSpec) |
754 (Help help) |
|
755 ) |
753 ) |
756 |
754 |
757 ! |
755 ! |
758 |
756 |
759 slicesRootMenu |
757 slicesRootMenu |
1311 painter := self painter. |
1316 painter := self painter. |
1312 node := painter selectedNode. |
1317 node := painter selectedNode. |
1313 |
1318 |
1314 node notNil ifTrue:[ |
1319 node notNil ifTrue:[ |
1315 self isHelpToolSelected ifTrue:[ |
1320 self isHelpToolSelected ifTrue:[ |
1316 self activeHelpTool accept |
1321 self helpTool accept. |
1317 ]. |
1322 node contents activeHelpKey:(self helpTool helpKey) |
1318 cont := node contents buildFromAspects:aspects. |
1323 ] ifFalse:[ |
1319 painter selectedNodeChanged |
1324 cont := node contents buildFromAspects:aspects. |
|
1325 painter selectedNodeChanged |
|
1326 ] |
1320 ]. |
1327 ]. |
1321 self modifiedChannel value:false. |
1328 self modifiedChannel value:false. |
1322 didInstall := true |
1329 didInstall := true |
1323 |
|
1324 "Modified: 31.7.1997 / 14:25:34 / cg" |
|
1325 ! |
1330 ! |
1326 |
1331 |
1327 cancel |
1332 cancel |
1328 |node| |
1333 |node| |
1329 |
1334 |
1330 (node := self painter selectedNode) notNil ifTrue:[ |
1335 (node := self painter selectedNode) notNil ifTrue:[ |
|
1336 self helpTool helpKey:(self helpKey). |
1331 aspects do:[:anAspect| anAspect value:nil ]. |
1337 aspects do:[:anAspect| anAspect value:nil ]. |
1332 node contents toAspects:aspects. |
1338 node contents toAspects:aspects. |
1333 ]. |
1339 ]. |
1334 self modifiedChannel value:false. |
1340 self modifiedChannel value:false. |
1335 |
1341 |
1336 ! ! |
1342 ! ! |
1337 |
1343 |
1338 !MenuEditor methodsFor:'active help'! |
|
1339 |
|
1340 activeHelpTool |
|
1341 "access current active help editor |
|
1342 " |
|
1343 activeHelpTool isNil ifTrue:[ |
|
1344 self activeHelpTool:(UIHelpTool new) |
|
1345 ]. |
|
1346 ^ activeHelpTool |
|
1347 ! |
|
1348 |
|
1349 activeHelpTool:anApplication |
|
1350 "change current active help editor |
|
1351 " |
|
1352 activeHelpTool := anApplication. |
|
1353 |
|
1354 activeHelpTool masterApplication isNil ifTrue:[ |
|
1355 activeHelpTool masterApplication:self. |
|
1356 ]. |
|
1357 ! |
|
1358 |
|
1359 isOwnerOfHelpTool |
|
1360 "returns true in case of owner of the helptool |
|
1361 " |
|
1362 ^ self activeHelpTool masterApplication == self |
|
1363 ! ! |
|
1364 |
|
1365 !MenuEditor methodsFor:'aspects'! |
1344 !MenuEditor methodsFor:'aspects'! |
1366 |
1345 |
1367 aspectFor:aKey |
1346 aspectFor:aKey |
1368 "returns aspect for a key or nil |
1347 "returns aspect for a key or nil |
1369 " |
1348 " |
1406 ^ builder booleanValueAspectFor:#hasValidSingleSelection |
1385 ^ builder booleanValueAspectFor:#hasValidSingleSelection |
1407 |
1386 |
1408 "Modified: 28.7.1997 / 12:52:13 / cg" |
1387 "Modified: 28.7.1997 / 12:52:13 / cg" |
1409 ! |
1388 ! |
1410 |
1389 |
1411 menuPullDown |
|
1412 |menu| |
|
1413 |
|
1414 menu := Menu new. |
|
1415 menu fromLiteralArrayEncoding:(self class menuPullDown). |
|
1416 menu receiver:self. |
|
1417 ^ menu |
|
1418 |
|
1419 |
|
1420 ! |
|
1421 |
|
1422 modifiedChannel |
1390 modifiedChannel |
1423 "automatically generated by UIPainter ..." |
1391 "automatically generated by UIPainter ..." |
1424 |
1392 |
1425 ^ builder booleanValueAspectFor:#modifiedChannel |
1393 ^ builder booleanValueAspectFor:#modifiedChannel |
1426 |
1394 |
1427 "Modified: 28.7.1997 / 12:52:14 / cg" |
1395 "Modified: 28.7.1997 / 12:52:14 / cg" |
1428 ! |
1396 ! |
1429 |
1397 |
1430 tabCanvas |
1398 noteBookView |
1431 "automatically generated by UIPainter ..." |
1399 "automatically generated by UIPainter ..." |
1432 |
1400 |
1433 |holder| |
1401 |noteBook helpTool| |
1434 |
1402 |
1435 (holder := builder bindingAt:#tabCanvas) isNil ifTrue:[ |
1403 (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
1436 builder aspectAt:#tabCanvas put:(holder := SubCanvas new). |
1404 noteBook := View new. |
1437 ]. |
1405 helpTool := UIHelpTool new. |
1438 ^ holder |
1406 |
|
1407 helpTool masterApplication:self. |
|
1408 helpCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
|
1409 specCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
|
1410 |
|
1411 helpCanvas client:helpTool. |
|
1412 helpTool masterApplication:self. |
|
1413 helpTool modifiedHolder:(self modifiedChannel). |
|
1414 |
|
1415 builder aspectAt:#noteBookView put:noteBook. |
|
1416 ]. |
|
1417 ^ noteBook |
1439 ! |
1418 ! |
1440 |
1419 |
1441 tabList |
1420 tabList |
1442 "automatically generated by UIPainter ..." |
1421 "automatically generated by UIPainter ..." |
1443 |
1422 |
1515 super doesNotUnderstand:aMessage |
1494 super doesNotUnderstand:aMessage |
1516 |
1495 |
1517 |
1496 |
1518 ! ! |
1497 ! ! |
1519 |
1498 |
|
1499 !MenuEditor methodsFor:'interface specs'! |
|
1500 |
|
1501 menuPullDown |
|
1502 "this window spec was automatically generated by the ST/X MenuEditor" |
|
1503 |
|
1504 "do not manually edit this - the builder may not be able to |
|
1505 handle the specification if its corrupted." |
|
1506 |
|
1507 " |
|
1508 MenuEditor new openOnClass:MenuEditor andSelector:#menuPullDown |
|
1509 (Menu new fromLiteralArrayEncoding:(MenuEditor menuPullDown)) startUp |
|
1510 " |
|
1511 |
|
1512 <resource: #menu> |
|
1513 |
|
1514 ^ |
|
1515 |
|
1516 #(#Menu |
|
1517 |
|
1518 #( |
|
1519 #(#MenuItem |
|
1520 #'label:' 'file' |
|
1521 #'value:' #file |
|
1522 #'submenu:' |
|
1523 #(#Menu |
|
1524 |
|
1525 #( |
|
1526 #(#MenuItem |
|
1527 #'label:' 'new' |
|
1528 #'value:' #doNew |
|
1529 ) |
|
1530 #(#MenuItem |
|
1531 #'label:' 'from class ...' |
|
1532 #'value:' #doFromClass |
|
1533 #'enabled:' #isStandAlone |
|
1534 ) |
|
1535 #(#MenuItem |
|
1536 #'label:' 'pick a menu' |
|
1537 #'value:' #doPickAMenu |
|
1538 #'enabled:' #isStandAlone |
|
1539 ) |
|
1540 #(#MenuItem |
|
1541 #'label:' '=' |
|
1542 ) |
|
1543 #(#MenuItem |
|
1544 #'label:' 'quit' |
|
1545 #'value:' #closeRequest |
|
1546 ) |
|
1547 ) nil |
|
1548 nil |
|
1549 ) |
|
1550 ) |
|
1551 #(#MenuItem |
|
1552 #'label:' 'edit' |
|
1553 #'submenu:' |
|
1554 #(#Menu |
|
1555 |
|
1556 #( |
|
1557 #(#MenuItem |
|
1558 #'label:' 'cut' |
|
1559 #'value:' #doCut |
|
1560 ) |
|
1561 #(#MenuItem |
|
1562 #'label:' '=' |
|
1563 ) |
|
1564 #(#MenuItem |
|
1565 #'label:' 'create submenu static' |
|
1566 #'value:' #doCreateMenu |
|
1567 ) |
|
1568 #(#MenuItem |
|
1569 #'label:' 'create summenu dynamic' |
|
1570 #'value:' #doCreateLink |
|
1571 ) |
|
1572 #(#MenuItem |
|
1573 #'label:' '-' |
|
1574 ) |
|
1575 #(#MenuItem |
|
1576 #'label:' 'create item' |
|
1577 #'value:' #doCreateItem |
|
1578 ) |
|
1579 #(#MenuItem |
|
1580 #'label:' 'create separator' |
|
1581 #'value:' #doCreateSep |
|
1582 ) |
|
1583 ) nil |
|
1584 nil |
|
1585 ) |
|
1586 ) |
|
1587 #(#MenuItem |
|
1588 #'label:' 'code' |
|
1589 #'value:' #code |
|
1590 #'submenu:' |
|
1591 #(#Menu |
|
1592 |
|
1593 #( |
|
1594 #(#MenuItem |
|
1595 #'label:' 'class' |
|
1596 #'value:' #doDefineClass |
|
1597 #'enabled:' #isStandAlone |
|
1598 ) |
|
1599 #(#MenuItem |
|
1600 #'label:' '-' |
|
1601 ) |
|
1602 #(#MenuItem |
|
1603 #'label:' 'install menu spec.' |
|
1604 #'value:' #doInstallSpec |
|
1605 ) |
|
1606 #(#MenuItem |
|
1607 #'label:' 'install help spec.' |
|
1608 #'value:' #doInstallHelp |
|
1609 #'enabled:' #isStandAlone |
|
1610 ) |
|
1611 #(#MenuItem |
|
1612 #'label:' '=' |
|
1613 ) |
|
1614 #(#MenuItem |
|
1615 #'label:' 'browse application' |
|
1616 #'value:' #doBrowseAppClass |
|
1617 ) |
|
1618 ) nil |
|
1619 nil |
|
1620 ) |
|
1621 ) |
|
1622 #(#MenuItem |
|
1623 #'label:' 'test' |
|
1624 #'submenuChannel:' #submenuTest |
|
1625 ) |
|
1626 ) nil |
|
1627 nil |
|
1628 ) |
|
1629 |
|
1630 "Modified: 28.7.1997 / 18:12:10 / cg" |
|
1631 ! ! |
|
1632 |
|
1633 !MenuEditor methodsFor:'private'! |
|
1634 |
|
1635 helpKey |
|
1636 |node| |
|
1637 |
|
1638 (node := self painter selectedNode) notNil ifTrue:[ |
|
1639 ^ node contents activeHelpKey |
|
1640 ]. |
|
1641 ^ nil |
|
1642 ! |
|
1643 |
|
1644 helpTool |
|
1645 ^ helpCanvas application |
|
1646 ! ! |
|
1647 |
1520 !MenuEditor methodsFor:'queries'! |
1648 !MenuEditor methodsFor:'queries'! |
1521 |
1649 |
1522 didInstall |
1650 didInstall |
1523 "returns true if the menu was installed |
1651 "returns true if the menu was installed |
1524 " |
1652 " |
1529 ! |
1657 ! |
1530 |
1658 |
1531 isHelpToolSelected |
1659 isHelpToolSelected |
1532 "returns true if current selection is help tool |
1660 "returns true if current selection is help tool |
1533 " |
1661 " |
1534 (slices notNil and:[tabSelection notNil]) ifTrue:[ |
1662 slices notNil ifTrue:[ |
1535 ^ (slices at:tabSelection) last == #help |
1663 ^ (slices at:tabSelection) first = UIHelpTool label |
1536 ]. |
1664 ]. |
1537 ^ false |
1665 ^ false |
|
1666 ! |
|
1667 |
|
1668 isStandAlone |
|
1669 "returns true in case of owner of the helptool |
|
1670 " |
|
1671 ^ self masterApplication isNil |
1538 ! ! |
1672 ! ! |
1539 |
1673 |
1540 !MenuEditor methodsFor:'selection'! |
1674 !MenuEditor methodsFor:'selection'! |
1541 |
1675 |
1542 menuChanged |
1676 menuChanged |
1543 |node item slc sel| |
1677 |node item slc sel old| |
1544 |
1678 |
1545 (node := self painter selectedNode) notNil ifTrue:[ |
1679 (node := self painter selectedNode) notNil ifTrue:[ |
1546 aspects do:[:anAspect| anAspect value:nil ]. |
1680 aspects do:[:anAspect| anAspect value:nil ]. |
1547 item := node contents. |
1681 item := node contents. |
1548 item toAspects:aspects. |
1682 item toAspects:aspects. |
1553 slc := #slicesMenu |
1687 slc := #slicesMenu |
1554 ] ifFalse:[ |
1688 ] ifFalse:[ |
1555 item submenuChannel isNil ifTrue:[slc := #slicesItem] |
1689 item submenuChannel isNil ifTrue:[slc := #slicesItem] |
1556 ifFalse:[slc := #slicesLink] |
1690 ifFalse:[slc := #slicesLink] |
1557 ]. |
1691 ]. |
|
1692 slc := (self class perform:slc) copyWith:#( 'Help' #dummy ). |
1558 ] ifTrue:[ |
1693 ] ifTrue:[ |
1559 slc := #slicesRootMenu |
1694 slc := self class perform:#slicesRootMenu |
1560 ] |
1695 ]. |
1561 ] ifTrue:[ |
1696 ] ifTrue:[ |
1562 slc := #slicesSeparatorMenu |
1697 slc := self class perform:#slicesSeparatorMenu. |
|
1698 ] |
|
1699 ]. |
|
1700 self helpTool helpKey:(self helpKey). |
|
1701 self modifiedChannel value:false. |
|
1702 |
|
1703 slc ~= slices ifTrue:[ |
|
1704 tabSelection notNil ifTrue:[ |
|
1705 old := (slices at:tabSelection) first |
1563 ]. |
1706 ]. |
1564 slc := self class perform:slc. |
1707 |
1565 ]. |
|
1566 self modifiedChannel value:false. |
|
1567 |
|
1568 slc ~= slices ifTrue:[ |
|
1569 (slices := slc) notNil ifTrue:[ |
1708 (slices := slc) notNil ifTrue:[ |
1570 tabSelection notNil ifTrue:[sel := tabSelection min:(slices size)] |
1709 sel := slices collect:[:s| s first]. |
1571 ifFalse:[sel := 1]. |
1710 tabSelection := nil. |
1572 |
1711 self tabList value:sel. |
1573 self tabList value:(slices collect:[:s| s first]). |
1712 |
1574 self tabModel setValue:nil. |
1713 (old notNil and:[(sel := sel findFirst:[:n|n = old]) ~~ 0]) ifFalse:[ |
1575 self tabModel value:sel. |
1714 sel := 1 |
|
1715 ]. |
|
1716 self tabModel value:sel |
1576 ] ifFalse:[ |
1717 ] ifFalse:[ |
1577 self tabList value:nil. |
1718 self tabList value:nil. |
1578 self tabSelection:nil. |
1719 self tabSelection:nil. |
1579 ] |
1720 ] |
1580 ]. |
1721 ]. |
1586 ! |
1727 ! |
1587 |
1728 |
1588 tabSelection:aSelection |
1729 tabSelection:aSelection |
1589 |tool sel| |
1730 |tool sel| |
1590 |
1731 |
1591 tabSelection == aSelection ifTrue:[ |
1732 tabSelection = aSelection ifTrue:[ |
1592 ^ self |
1733 ^ self |
1593 ]. |
1734 ]. |
1594 |
1735 |
1595 (tabSelection := aSelection) isNil ifTrue:[ |
1736 (tabSelection := aSelection) isNil ifTrue:[ |
1596 ^ self tabCanvas client:nil |
1737 slices isNil ifTrue:[ |
1597 ]. |
1738 specCanvas client:nil. |
|
1739 ^ specCanvas raise. |
|
1740 ]. |
|
1741 tabSelection == 1 ifTrue:[^ self]. |
|
1742 tabSelection := 1 |
|
1743 ]. |
|
1744 |
1598 self isHelpToolSelected ifTrue:[ |
1745 self isHelpToolSelected ifTrue:[ |
1599 self tabCanvas client:(tool := self activeHelpTool). |
1746 self helpTool helpKey:(self helpKey). |
1600 tool model:(self aspectFor:#activeHelpKey) |
1747 helpCanvas raise. |
1601 ] ifFalse:[ |
1748 ] ifFalse:[ |
1602 sel := (slices at:tabSelection) last. |
1749 sel := (slices at:tabSelection) last. |
1603 self tabCanvas client:self spec:(self class perform:sel) builder:builder |
1750 specCanvas client:self spec:(self class perform:sel) builder:builder. |
|
1751 specCanvas raise. |
1604 ] |
1752 ] |
1605 ! ! |
1753 ! ! |
1606 |
1754 |
1607 !MenuEditor methodsFor:'startup / release'! |
1755 !MenuEditor methodsFor:'startup / release'! |
1608 |
1756 |
1611 |
1759 |
1612 oldClass := self specClass. |
1760 oldClass := self specClass. |
1613 self specClass:aClass. |
1761 self specClass:aClass. |
1614 newClass := self specClass. |
1762 newClass := self specClass. |
1615 |
1763 |
1616 (self isOwnerOfHelpTool and:[oldClass ~= newClass]) ifTrue:[ |
1764 (self isStandAlone and:[oldClass ~= newClass]) ifTrue:[ |
1617 self activeHelpTool helpSpecFrom:newClass |
1765 self helpTool helpSpecFrom:newClass |
1618 ]. |
1766 ]. |
1619 self painter buildFrom:newClass andSelector:aSelector. |
1767 self painter buildFrom:newClass andSelector:aSelector. |
1620 ! |
1768 ! |
1621 |
1769 |
1622 initialize |
1770 initialize |
1995 |
2152 |
1996 (label isNil or:[self isSeparator]) ifTrue:[ |
2153 (label isNil or:[self isSeparator]) ifTrue:[ |
1997 (aspects at:#label) value:(label := name) |
2154 (aspects at:#label) value:(label := name) |
1998 ]. |
2155 ]. |
1999 |
2156 |
2000 activeHelpKey := (aspects at:#activeHelpKey) value. |
|
2001 enabled := (aspects at:#enabled) value. |
2157 enabled := (aspects at:#enabled) value. |
2002 value := (aspects at:#value) value. |
2158 value := (aspects at:#value) value. |
2003 nameKey := (aspects at:#nameKey) value. |
2159 nameKey := (aspects at:#nameKey) value. |
2004 indication := (aspects at:#indication) value. |
2160 indication := (aspects at:#indication) value. |
2005 shortcutKey := (aspects at:#shortcutKey) value. |
2161 shortcutKey := (aspects at:#shortcutKey) value. |
2055 (type := self separatorType) notNil ifTrue:[ |
2211 (type := self separatorType) notNil ifTrue:[ |
2056 type := self class separatorSlices findFirst:[:el| el first == type ]. |
2212 type := self class separatorSlices findFirst:[:el| el first == type ]. |
2057 (aspects at:#seperatorSelection) selectionIndex:type. |
2213 (aspects at:#seperatorSelection) selectionIndex:type. |
2058 ] ifFalse:[ |
2214 ] ifFalse:[ |
2059 (aspects at:#label) value:label. |
2215 (aspects at:#label) value:label. |
2060 (aspects at:#activeHelpKey) value:activeHelpKey. |
|
2061 (aspects at:#enabled) value:enabled. |
2216 (aspects at:#enabled) value:enabled. |
2062 (aspects at:#value) value:value. |
2217 (aspects at:#value) value:value. |
2063 (aspects at:#nameKey) value:nameKey. |
2218 (aspects at:#nameKey) value:nameKey. |
2064 (aspects at:#indication) value:indication. |
2219 (aspects at:#indication) value:indication. |
2065 (aspects at:#shortcutKey) value:shortcutKey. |
2220 (aspects at:#shortcutKey) value:shortcutKey. |