Changeset 1490 for branches/branch-1-0/src/classes/xcenter.c
- Timestamp:
- Feb 3, 2025, 4:59:45 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/branch-1-0/src/classes/xcenter.c ¶
r1358 r1490 99 99 #include "shared\notebook.h" // generic XWorkplace notebook handling 100 100 101 #include "shared\wpsh.h" 101 102 #include "shared\center.h" // public XCenter interfaces 102 103 … … 1177 1178 1178 1179 /* 1180 *@@ xwpQueryIconSize: 1181 * Returns 0=mini, 1=full 1182 * 1183 * A future enhancement may return the actual size 1184 * of a variable-size icon 1185 */ 1186 1187 SOM_Scope ULONG SOMLINK xctr_xwpQueryIconSize(XCenter *somSelf) 1188 { 1189 XCenterData *somThis = XCenterGetData(somSelf); 1190 XCenterMethodDebug("XCenter","xctr_xwpQueryIconSize"); 1191 1192 return ((_flDisplayStyle & XCS_LARGEICONS) ? 1 : 0); 1193 } 1194 1195 /* 1196 *@@ xwpSetIconSize: 1197 * Sets icon size to: 0=mini, 1=full 1198 * If this XCenter is open, its display will be updated. 1199 * 1200 * A future enhancement may allow setting the actual size 1201 * of a variable-size icon 1202 */ 1203 1204 SOM_Scope BOOL SOMLINK xctr_xwpSetIconSize(XCenter *somSelf, ULONG ulSize) 1205 { 1206 ULONG style; 1207 XCenterData *somThis = XCenterGetData(somSelf); 1208 XCenterMethodDebug("XCenter","xctr_xwpSetIconSize"); 1209 1210 if (ulSize > 1) 1211 return FALSE; 1212 1213 // set possibly-new style 1214 style = _flDisplayStyle; 1215 if (ulSize) 1216 _flDisplayStyle |= XCS_LARGEICONS; 1217 else 1218 _flDisplayStyle &= ~XCS_LARGEICONS; 1219 1220 // no change so nothing to do 1221 if (_flDisplayStyle == style) 1222 return TRUE; 1223 1224 // force recalc 1225 _ulHeight = 0; 1226 1227 _wpSaveDeferred(somSelf); 1228 1229 // if view is currently open, post an update msg 1230 // to ensure it occurs on this instance's thread 1231 if (_pvOpenView) 1232 WinPostMsg(((PXCENTERWINDATA)_pvOpenView)->Globals.hwndClient, 1233 XCM_REFORMAT, (MPARAM)XFMF_DISPLAYSTYLECHANGED, 0); 1234 1235 return TRUE; 1236 } 1237 1238 /* 1179 1239 *@@ wpInitData: 1180 1240 * this WPObject instance method gets called when the … … 1205 1265 _pllAllWidgetSettings = NULL; 1206 1266 } 1207 1208 /*1209 * wpObjectReady: override; removed V0.9.9 (2001-03-13) [umoeller]1210 */1211 1267 1212 1268 /* … … 1479 1535 // store in instance data 1480 1536 &_pvOpenView); 1537 1538 // let the class know we're open 1539 if (hwndNewView) 1540 _xwpclsRegisterOpenView(_XCenter, somSelf, TRUE); 1541 1481 1542 // V1.0.1 (2003-02-02) [umoeller] 1482 1543 fl = cmnQuerySetting(sflIntroHelpShown); … … 1700 1761 M_XCenterMethodDebug("M_XCenter","xctrM_xwpclsAutoOpen"); 1701 1762 1702 for (ctr = 0; ctr < XCTR_MAX_ AUTO&& _aulAutoOpen[ctr]; ctr++)1763 for (ctr = 0; ctr < XCTR_MAX_OPEN && _aulAutoOpen[ctr]; ctr++) 1703 1764 { 1704 1765 XCenter *obj = _wpclsObjectFromHandle(somSelf, _aulAutoOpen[ctr]); … … 1755 1816 1756 1817 // loop until we reach the first empty slot 1757 found = XCTR_MAX_ AUTO;1758 for (ctr = 0; ctr < XCTR_MAX_ AUTO&& _aulAutoOpen[ctr]; ctr++)1818 found = XCTR_MAX_OPEN; 1819 for (ctr = 0; ctr < XCTR_MAX_OPEN && _aulAutoOpen[ctr]; ctr++) 1759 1820 { 1760 1821 if (_aulAutoOpen[ctr] == ulHandle) … … 1764 1825 if (fAutoOpen) { 1765 1826 // already present 1766 if (found < XCTR_MAX_ AUTO)1827 if (found < XCTR_MAX_OPEN) 1767 1828 return TRUE; 1768 1829 1769 1830 // no room at the inn... 1770 if (ctr >= XCTR_MAX_ AUTO)1831 if (ctr >= XCTR_MAX_OPEN) 1771 1832 return FALSE; 1772 1833 … … 1776 1837 else { 1777 1838 // not found 1778 if (found == XCTR_MAX_ AUTO)1839 if (found == XCTR_MAX_OPEN) 1779 1840 return FALSE; 1780 1841 1781 // move the last non-zero item into the slot 1782 // occupied by the item to be removed 1783 // (if this is the only item, the one moved is already zero) 1784 _aulAutoOpen[found] = _aulAutoOpen[--ctr]; 1842 // move the list down and zero the last non-zero entry 1843 memcpy(&_aulAutoOpen[found], &_aulAutoOpen[found + 1], --ctr - found); 1785 1844 _aulAutoOpen[ctr] = 0; 1786 1845 } … … 1806 1865 ULONG i, j; 1807 1866 char *ptr; 1808 char buf[XCTR_MAX_ AUTO* 8]; // somewhat larger than needed1867 char buf[XCTR_MAX_OPEN * 8]; // somewhat larger than needed 1809 1868 1810 1869 M_XCenterMethodDebug("M_XCenter","xctrM_xwpclsSaveAutoOpen"); 1811 1870 1812 1871 ptr = buf; 1813 for (i = 0; i < XCTR_MAX_ AUTO&& _aulAutoOpen[i]; i++)1872 for (i = 0; i < XCTR_MAX_OPEN && _aulAutoOpen[i]; i++) 1814 1873 { 1815 1874 // remove entries other methods marked as invalid 1816 1875 if (_aulAutoOpen[i] == (ULONG)-1) { 1817 for (j = i + 1; j < XCTR_MAX_ AUTO&& _aulAutoOpen[j]; j++);1876 for (j = i + 1; j < XCTR_MAX_OPEN && _aulAutoOpen[j]; j++); 1818 1877 1819 1878 _aulAutoOpen[i] = _aulAutoOpen[--j]; … … 1834 1893 1835 1894 /* 1895 *@@ xwpclsQueryIconSize: 1896 * Returns the class default: 0=mini, 1=full 1897 * 1898 * A future enhancement may return the actual size 1899 * of a variable-size icon 1900 */ 1901 1902 SOM_Scope ULONG SOMLINK xctrM_xwpclsQueryIconSize(M_XCenter *somSelf) 1903 { 1904 M_XCenterData *somThis = M_XCenterGetData(somSelf); 1905 M_XCenterMethodDebug("M_XCenter","xwpclsQueryIconSize"); 1906 1907 return _ulIconSize; 1908 } 1909 1910 /* 1911 *@@ xwpclsSetIconSize: 1912 * Sets the class default icon size to: 0=mini, 1=full 1913 * If any XCenters are open, their settings and displays will be updated 1914 * 1915 * A future enhancement may allow setting the actual size 1916 * of a variable-size icon 1917 */ 1918 1919 SOM_Scope BOOL SOMLINK xctrM_xwpclsSetIconSize(M_XCenter *somSelf, ULONG ulSize) 1920 { 1921 ULONG ctr; 1922 M_XCenterData *somThis = M_XCenterGetData(somSelf); 1923 M_XCenterMethodDebug("M_XCenter","xwpclsSetIconSize"); 1924 1925 if (ulSize > 1 || 1926 !PrfWriteProfileString(HINI_USERPROFILE, (PSZ)INIAPP_XWORKPLACE, 1927 (PSZ)INIKEY_XCENTERICONSIZE, 1928 ulSize ? "1" : NULL)) 1929 return FALSE; 1930 1931 _ulIconSize = ulSize; 1932 1933 for (ctr = 0; ctr < XCTR_MAX_OPEN && _aOpenViews[ctr]; ctr++) 1934 { 1935 if (wpshCheckObject(_aOpenViews[ctr])) 1936 _xwpSetIconSize(_aOpenViews[ctr], ulSize); 1937 else { 1938 _xwpclsRegisterOpenView(somSelf, _aOpenViews[ctr], FALSE); 1939 ctr--; 1940 } 1941 } 1942 1943 return TRUE; 1944 } 1945 1946 /* 1947 *@@ xwpclsRegisterOpenView: 1948 * Maintains a list of open XCenters. 1949 * Used by xwpclsSetIconSize(). 1950 */ 1951 1952 SOM_Scope void SOMLINK xctrM_xwpclsRegisterOpenView(M_XCenter *somSelf, 1953 XCenter *pObj, BOOL fAdd) 1954 { 1955 ULONG ctr; 1956 ULONG found; 1957 M_XCenterData *somThis = M_XCenterGetData(somSelf); 1958 M_XCenterMethodDebug("M_XCenter","xwpclsRegisterOpenView"); 1959 1960 // loop until we reach the first empty slot 1961 found = XCTR_MAX_OPEN; 1962 for (ctr = 0; ctr < XCTR_MAX_OPEN && _aOpenViews[ctr]; ctr++) 1963 { 1964 if (_aOpenViews[ctr] == pObj) 1965 found = ctr; 1966 } 1967 1968 if (fAdd) { 1969 // if not found & there's room, add to list 1970 if (found == XCTR_MAX_OPEN && ctr < XCTR_MAX_OPEN) 1971 _aOpenViews[ctr] = pObj; 1972 } 1973 else 1974 // move the list down and zero the last non-zero entry 1975 if (found < XCTR_MAX_OPEN) { 1976 memcpy(&_aOpenViews[found], &_aOpenViews[found + 1], --ctr - found); 1977 _aOpenViews[ctr] = 0; 1978 } 1979 1980 return; 1981 } 1982 1983 /* 1836 1984 *@@ wpclsInitData: 1837 1985 * this WPObject class method gets called when a class … … 1853 2001 ULONG handle; 1854 2002 char *ptr; 1855 char buf[XCTR_MAX_ AUTO* 8]; // larger than needed, just in case2003 char buf[XCTR_MAX_OPEN * 8]; // larger than needed, just in case 1856 2004 1857 2005 M_XCenterMethodDebug("M_XCenter","xctrM_wpclsInitData"); … … 1866 2014 // register XCenter plugins category (ctr_model.c) 1867 2015 arc = ctrpRegisterCategory(); 2016 2017 // clear list of open XCenters 2018 memset(_aOpenViews, 0, sizeof(_aOpenViews)); 2019 2020 // get default icon size (currently 0=mini 1=full) 2021 _ulIconSize = PrfQueryProfileInt(HINI_USERPROFILE, (PSZ)INIAPP_XWORKPLACE, 2022 (PSZ)INIKEY_XCENTERICONSIZE, 0); 1868 2023 1869 2024 // process the auto-open list of handles, if any … … 1878 2033 // the list is formatted as "[handle][space]...nul" 1879 2034 for (ctr = 0, ptr = strtok(buf, " "); 1880 ctr < XCTR_MAX_ AUTO&& ptr;2035 ctr < XCTR_MAX_OPEN && ptr; 1881 2036 ctr++, ptr = strtok(NULL, " ")) 1882 2037 {
Note:
See TracChangeset
for help on using the changeset viewer.