From d5f7f40504e748e09ba11018bd09ef6468da2c59 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 27 Sep 2021 16:18:54 -0400 Subject: [PATCH] tests/interface/bshelf: Import Container and ShelfInspector. These come from the Haiku Newsletter, issue 56 article 2, which I managed to retrieve the source from the Wayback Machine. (They are based on applications from Be's Sample Code distributions.) Jamfiles not yet included; the source is in unmodified form, except the RSRCs have been decompiled to RDEFs. --- .../kits/interface/bshelf/Container/App.rdef | 550 ++++++++++++++ .../interface/bshelf/Container/Container.rdef | 209 ++++++ .../bshelf/Container/ContainerApplication.cpp | 150 ++++ .../bshelf/Container/ContainerApplication.h | 44 ++ .../bshelf/Container/ContainerWindow.cpp | 199 +++++ .../bshelf/Container/ContainerWindow.h | 48 ++ .../bshelf/Container/ContainerWindowDefs.h | 35 + .../kits/interface/bshelf/Container/LICENSE | 31 + .../bshelf/Container/TPreferences.cpp | 198 +++++ .../interface/bshelf/Container/TPreferences.h | 57 ++ .../interface/bshelf/ShelfInspector/App.rdef | 74 ++ .../bshelf/ShelfInspector/InfoApplication.cpp | 73 ++ .../bshelf/ShelfInspector/InfoApplication.h | 31 + .../bshelf/ShelfInspector/InfoWindow.cpp | 694 ++++++++++++++++++ .../bshelf/ShelfInspector/InfoWindow.h | 71 ++ .../bshelf/ShelfInspector/InfoWindowDefs.h | 48 ++ .../interface/bshelf/ShelfInspector/LICENSE | 31 + .../bshelf/ShelfInspector/PopUpMenuDefs.h | 22 + .../bshelf/ShelfInspector/TPreferences.cpp | 200 +++++ .../bshelf/ShelfInspector/TPreferences.h | 57 ++ .../ShelfInspector/XShelfInspector.rdef | 448 +++++++++++ .../bshelf/ShelfInspector/readme.txt | 87 +++ 22 files changed, 3357 insertions(+) create mode 100644 src/tests/kits/interface/bshelf/Container/App.rdef create mode 100644 src/tests/kits/interface/bshelf/Container/Container.rdef create mode 100644 src/tests/kits/interface/bshelf/Container/ContainerApplication.cpp create mode 100644 src/tests/kits/interface/bshelf/Container/ContainerApplication.h create mode 100644 src/tests/kits/interface/bshelf/Container/ContainerWindow.cpp create mode 100644 src/tests/kits/interface/bshelf/Container/ContainerWindow.h create mode 100644 src/tests/kits/interface/bshelf/Container/ContainerWindowDefs.h create mode 100644 src/tests/kits/interface/bshelf/Container/LICENSE create mode 100644 src/tests/kits/interface/bshelf/Container/TPreferences.cpp create mode 100644 src/tests/kits/interface/bshelf/Container/TPreferences.h create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/App.rdef create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/InfoApplication.cpp create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/InfoApplication.h create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/InfoWindow.cpp create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/InfoWindow.h create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/InfoWindowDefs.h create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/LICENSE create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/PopUpMenuDefs.h create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/TPreferences.cpp create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/TPreferences.h create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/XShelfInspector.rdef create mode 100644 src/tests/kits/interface/bshelf/ShelfInspector/readme.txt diff --git a/src/tests/kits/interface/bshelf/Container/App.rdef b/src/tests/kits/interface/bshelf/Container/App.rdef new file mode 100644 index 0000000000..8963febae1 --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/App.rdef @@ -0,0 +1,550 @@ + +resource app_flags B_MULTIPLE_LAUNCH; + +resource app_version { + major = 1, + middle = 0, + minor = 0, + + variety = B_APPV_BETA, + internal = 0, + + short_info = "A Container for Replicants", + long_info = #'CSTR' array { + + } +}; + +resource large_icon array { + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFF00830000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFF008383830000FFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFF0083838383830000FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFF00000000000000838383838383830000FFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFF00D9D9D9D9D1D1AAD983838383838383830100FFFFFFFFFFFFFF" + $"FFFFFFFFFF00D9D9D9D9D1D1D1AA83D9D98383838383838300FFFFFFFFFFFFFF" + $"FFFFFFFF00D9D9D9D9D1D1D1D1AA838383D9D9838383838300FFFFFFFFFFFFFF" + $"FFFFFF00D9D9D9D9D1D1D1D1D1AA8383838383D9D983838300FFFFFFFFFFFFFF" + $"FFFF00D9D9D9D9D1D1D1D1D1D1AA83838383838383D9D98300FFFFFFFFFFFFFF" + $"FF00D9D9D9D9D1D1D1D1D1D1D1AA838383838383838383AAD90000FFFFFFFFFF" + $"FF0000000000D1D1D1D1D1D1D1AA8383838383838383AAD9AAAAAA0000FFFFFF" + $"FFFFFFFF00D9D1D1D1D1D1D1D1AA83838383838383AAD9AAAAAAAAAAAA0000FF" + $"FFFFFF00D983D9D9D1D1D1D1D1AA838383838383AAD9AAAAAAAAAAAAAAAAAA01" + $"FFFF00D983838383D9D9D1D1D1AA8383838383AAD9AAAAAAAAAAAAAAAAAA01FF" + $"FF00D983838383838383D9D9D1D183838383AAD9AAAAAAAAAAAAAAAAAA01FFFF" + $"FFFF00008383838383838383D9D9D1D183AAD9AAAAAAAAAAAAAAAAAA01FFFFFF" + $"FFFFFFFF00008383838383838383D9D90000AAAAAAAAAAAAAAAAAA01FFFFFFFF" + $"FFFFFFFFFF000000838383838383838301D10000AAAAAAAAAAAA000EFFFFFFFF" + $"FFFFFFFFFF00AAAA0000838383838300D9D1D1D10000AAAAAA00000F0F0FFFFF" + $"FFFFFFFFFF00AAAAAAAA0000838300AAD9D1D1D1D1D1000000D1000F0E0F0F0F" + $"FFFFFFFFFF008383AAAAAAAA0000AAAAD9AAD1D1D1D1D1D1D183000F0F0E0FFF" + $"FFFFFFFFFF0083838383AAAAAAAAAAAAD9AAD1D1D1D1D1AAAA000F0F0F0EFFFF" + $"FFFFFFFFFF00838383838383AAAAAAAAD9AAD1D1D1D1AAAA000F0F0F0EFFFFFF" + $"FFFFFFFFFF008383838383838383AAAAD9AAD1D1D1AAAA000F0F0F0EFFFFFFFF" + $"FFFFFFFFFFFF000083838383838383AAD9AAD1D1AAAA000F0F0F0EFFFFFFFFFF" + $"FFFFFFFFFFFFFFFF0000838383838383D9AA83AAAA000F0F0F0FFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFF000083838383D983AAAA000F0F0F0EFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFF00008383D983AA000F0F0E0FFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF0000D9AA000F0E0F0FFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000E0F0F0FFFFFFFFFFFFFFFFFFFFF" +}; + +resource(1, "DropZone.jpeg") #'JPEG' array { + $"FFD8FFE000104A46494600010100000100010000FFDB00430001010101010101" + $"0101010101010101010101010101010101010101010101010101010101010101" + $"01010101010101010101010101010101010101010101010101FFDB0043010101" + $"0101010101010101010101010101010101010101010101010101010101010101" + $"010101010101010101010101010101010101010101010101010101010101FFC2" + $"0011080079008003011100021101031101FFC4001D0000020203010101000000" + $"00000000000004050106000308070902FFC4001A010002030101000000000000" + $"000000000000030102040507FFDA000C03010002100310000001FA29EB99D9F3" + $"8CE80673C0F6E1719A691AF634995751A40AEEB2E026CC560628870D79C161CD" + $"E4F424407B128350E10DDF59CA8648AD8B90C4B19D4AFEB13E82DBCB13ACE69C" + $"73D1FA8BB69813440EAC6CE34286B4700D6B7102EB336549BAEC19C4CF665459" + $"80E3CA4F4538F58E8407452C87BFCB5CE80B16BBFF00327CA3A7771622EB0D25" + $"816E0DE89433C1129679AFECFB1B9A72E89D0167973A80E8AAFC0ED53B34198D" + $"8480EC534D39E336CAFBF358294E69C1A995A9EE3D16913318C35EA0E4B22E68" + $"FA03177C89699009F0AF650D41BE6FE539A790B976EA3E947B4EB880114B0F49" + $"816080BA2C497C6599D817458994CD8C2D65114706712DD53D68F66DB05A5626" + $"82D7CD16748ADEDBD4A345E3021A2CC713606C81926B62FCBD13CE3CCB7A96C8" + $"F79E9D720DF9D88F4160AAE6C33A326454D264B5F28A3F44B2AD61C8A6A73DE3" + $"9F78A0C7AB1A10C2DC07459B637D58B24690BD9027B4338261B5E82D961658F9" + $"D9C08E8FD51D07D4B09063D7140C5B320916140D2F06545966E401D8320A0A57" + $"C9FC9BFA8EFB7526B858F59926AC6C739C0B7AF60010C1C318B67940ECCDAC22" + $"ABA422789F917EC1EB53D3F7DC380BA0420D0F585035960F062979A4228C8816" + $"3D61C8B321C6FC5BF51746D79EC559E3A1B22A8822B3B28E9D084F59BC622A7B" + $"EF9016899D105E75D7DDA08A2F27358E1E2409DB6B8D72D651A5CE9CC24BF573" + $"C49D7591037C5A1307E989ABE9D3EADCAA523A597FFFC4002B10000201040201" + $"0206010500000000000003040200050613121423073401152224334232313536" + $"4344FFDA0008010100010502EE2FB3CA337974C88C5487F5AA4D8B264608ACE0" + $"504C6468EC90EB8C2425CC10540C57DC70878207DBC1A7111DA800127054653D" + $"6339A7CCEFDD4DE69F6381D3D95E50255F335E0B223112138EB3121A2601B040" + $"34DA2780FC809A6BF35410ABF26F1ADB78C6B02C231142E771BBA634CA380082" + $"24F596327B50CC424E13D8C028032F0E8CC9F1D9AE0D0173C7C43A80C47487AB" + $"84C9D3A7AC16E75DB5D99FC6EE764CB3E399DB4EA0979814E651AC5ED340E8D6" + $"F540B797480E5EB1DC5DC77F1D4FAFC0E07749C65033E56D91FE7F50B153E636" + $"FC631B5B80C1E738EBC49CCEF15E39C1AE5F8E67B62279C3AF6F48712929A20B" + $"81FBDA4EFF00CC1AE05E289C40666713971F28217FBBDDAED76C46ECF5BEE509" + $"8AB5FD071DE0F354629D797840E2E9204D80D8D6999173D4C6C68E7731D116D9" + $"000171D4FB359261EB642BE5B74BF63AD62393AB724FA75BC433806566800D14" + $"7B7A27A9FD7344E48D1C7A0FB1D38766B8B9A86772E0892071EBA89FA86BA413" + $"BB86C78AB580CEC1963DF0735E8034757773621488D22539E031FB0B50CF73B8" + $"4C0E1770FC1018049C36574C49C7B25DF5965B6C57EB236C378E9B17CEE37787" + $"DB8C108949327CCC10000A47643EA4C7AB8007B0C7D4A343D5A0841546E08915" + $"9B90B834A8C473380100E54946889FA7789239464771B459FE1FA13C933F6074" + $"7BA2A768FCF80E053CC60F3C3F81C6C428E9A449CBAE8D6B607370973B80203D" + $"8970112AE0E7A8B70BF7A54BE77664F6086EB47779EC2926D5CC470C488F24D9" + $"E131ED3D1EE702424028E604C475604DF026D24FF489D2055DEC367C8D18E32B" + $"64393E11903373B401B127306DD15BD7233BCAE422329E81F827D81D106C6900" + $"F5A517849CC076225DE239A4E2ECBB92E2965BFAFEA3E3BF27F8D86FA7C8C30F" + $"3CF66B203C0B794F31F601002736E86414C1F71BDA00807FD37EB9F076611F8E" + $"A770138DDD2DE95ED5F532ED7AB95F711B6E4C1B40F570D7AC3E51D7D0383402" + $"C163F33C0FB79CC8F3877C622060429C04EC5100252884FADED4056E885A6EF6" + $"EEE3C30ABD7529DF720F6A7F7BFF0001E9BF77FEFC9FFC709ED09FCDDFEB75F7" + $"577FED8FFBBA1FBBFFC4002D1100010203060504020300000000000000010011" + $"0221311041516171F0121320308191A1B1C132D140C2E1FFDA0008010301013F" + $"01B4D0A227540668771AFB964B85327B37B3DA993B646D62E80EE3BE64EFD519" + $"58219F9404BA27D314414514D1A211709D4338A8CC6E6B8F379EF440C90A9429" + $"6F357377BD7A6228BBAB9141D43F8F11F031D701F299DE287C8C0FD82852DE52" + $"E57684BF4801779FD0CD11D6019CD423B067A575C137A746B600A10367B00B6E" + $"A8350091FC9F0C1F0F72886A53DC6BFC0E22CDEF7B60ABBC3B5CD5CDF9E96844" + $"DE2F0D22A26B9F3ECF2972BA4164EC0352F19E7F48F73DAD720C8EFCA84BCB10" + $"5F12510DDFA2864E6FD1DBC674C969D1C29DAFDE68C5251456B84E2C285E8511" + $"A228D4EA57FBF0A2FD2BFD11A43A23D02C8BE87C217A145745A7F60A25FFC400" + $"4011000102050203060208040309000000000102110003122131044122516113" + $"32718191B1A1F00510142333C1D1E1425273F12443B3345362728283A2B2B4FF" + $"DA0008010201013F015ADDDDBA7A7EA22607248E151B54C1FA1EACF0A032DC54" + $"8BB6DB078552EC967202BA35838DBD3C6360E005100A802F76032C1F0CEDB42E" + $"5DC16151E1059FAB5B09B7310C92CE01218DC0241D8F4DD8FA46CF12E69032E6" + $"F9B7B0B79089934D5D19BCDF963E47D56494DDB6009C9F3B936F789CA1604DD9" + $"F2D8DD9DDAFE112EE0FB722092FEBEDE31245CF89FCE26254FC80FFCADEC3DE2" + $"B261FF00889000C93B0897AA1356BD1EA02656AA484ACA113084CC43852264A5" + $"02174B015CB53293DD55482E5652C2686524807B4052DD9F781AB14005C17C5F" + $"AC21BF12A34D032404366ABE0B6EECD0258C9CED0522A0A7BA4293E20919F0A6" + $"29B9C24555269B3BA78AB0D9A893BBF09CC274EAAEA16B10AA96B2072694E10F" + $"FF0013A4F8C4F94B74141453571D5FCB7C1D8BB40B807A46C6ECD93CACFBDB17" + $"BC4D56D736F5F4B3FCB448E00109404A6E0048094A4372B6FC844817BB6FE97F" + $"9EA616073114C2C2D52CF633129591C0B22B407C299F89B203B12CF68D649D26" + $"974D54C27EED6271D415FF00899B3CF79758655733B94834D1C0C940B7D1C979" + $"1C63BD5932CD044B0AB895C290920248177705DC822246A8034B5201A46006D9" + $"BD9BA44C35870FE5FBDA14429214305208F0207CB449C10EA2536ACB5ECEFCAC" + $"FCA2A4AF1CDDDCFEB8E98850B31C1CDC8F88BC0025001364A4304EC00C0F28FB" + $"7A12AECDC56C4B6ECECEDC9ED1DF2E199B0DF9F4E51DD245B937923D9FE3045B" + $"942AA7CD9B1777F5C404AB76C96607BBFAF3DA0CB012520325B09E161D199BCA" + $"0225EA5495CC9751492A476A3B84863638C756DA24485E9A64E5AE72F4BF46E9" + $"94572E5A94915AA9351A812A1A4492F2E4BBAD7901294A0C9EC27A4CE92A58BD" + $"2B96BA90B94A17A572947814D716BA4820B18D3A9C176043821DDBCFCC6D1314" + $"9A6B05343541408A28670A0714D37716F28425202D92054E55602A2CCEAE6580" + $"0E760234530CDCD49AB636507DB70E3CEF1392CA0A62ED4F91BFB810BB8F9E91" + $"334C2BAA8150C109723FEA6B0F311A4B8BD8EF1A9B10DCE185C35382FC2CAB07" + $"EAFCDC03C8C29292AD8A878387F8878D36ACAD22BA6AA4574BD3537135576E4F" + $"76823859F0327F976F4167F384A42300077248B7173C5CF32635DA53AD949A69" + $"52A52BB412A63F613AC47673923A7715996B6500711A7D3CA4F63342664A9BD9" + $"1965332654B525DE99A42889B47F02892C0ECED006D826F67E9E1FAC0666E5C2" + $"435B18F06F2837108D3194E6D9E1005294A477400FB6E77E81804CF02C7E3133" + $"E7E108F9F8C07ADC2D8005D0C2EE6C5F23079830E00254400064EDE6604E7750" + $"554820141041490770C9DEC5EA20BDA2BB82FB11E38CDB6DBC4F38D3E968DF7F" + $"91F9C28849A5FF00B7F78D4A41452A405050E24915A4F305C5C788F28D1B905E" + $"F7C6187ED98290A2A17B1D894FA10418D42D73A7FD8A428226048993E796AA4C" + $"A5381D803DE9D338805074CA0EA5715298933A6CA9A9D26A9554CA54AD3CF161" + $"A996960AAC6133E53A6B185555A770215301B6EDF3ED14CA70B0A03B62900A94" + $"78C80580A8E581B0689AF660F7BF40D9F56847BFE87E7C600355939C9F081831" + $"D88E63D7F78EC2F90CD6E7D7F284D954B97A5C0BB36338F27F286DCBD9F9FB0C" + $"FA18925E4AB9B1670F7BB1F9E51A75F1E087C8B5ADBB122D8B13D208BA8A4F11" + $"1672A28DD8B62FBB5C88D56906A295A56A91A896FD8EA10015CB272083F892D5" + $"FC7295C2A1C94CA1AA9D3F4EB933754BD3AE74A0BFB3C9922604154C4F62BD5E" + $"A94A0A54AD3CA42CB8486751E32406D26AC6A2A4AF827A1BB492E0B72992D5FE" + $"6C999DE44C1621858BC5890A64BB32542E6937CF22C0B0B5845E9C005B03BA0F" + $"A0B79086131C1E2497707041CBF484F0E60AC0802A0026C300089DF47DD2B21D" + $"4872826E525418B7271631290539DBCE149482262828D0EC12852CF158B25095" + $"2DFC21B84F818904F645FAC69CA93354FDDE22E7ABFA011CFC770D0A01696642" + $"C1D96C527C4342E576B296858405CC42D16D90A701353025201BD99F6C469647" + $"D93ECF2A4ACCDD7CC94BD38ED66769A7D2225292AD4942450A2EAA5499454564" + $"94B7652EA891A85159D2EA92256A52924536973E58B76B2092FBF14BEFCB39B3" + $"28EC7C2344146CAB9162A20711FE661CCF87A46A3859B6C74B46A973693D9535" + $"ED5BD3E74DCFA88D171A4DD8B58F23CEF13678559A25201E4396CDE116506705" + $"AC48D94DE7490FE2212DC3D9814F082DFEEFB35143747506F380A25438084945" + $"55129B289FC329CBB5C9C6D16CB37ECFF3EF1367A96A01D2C02EA48EF3950ECD" + $"5D1929583CC9B6224E9EAC580C36DE0201600B10E01650A48F11CF9C4FD3A356" + $"0055495238A54D410152A60C2D0721437FE152785408B46BFED129227EB674B5" + $"4F9295CBD14BD32147B49A5052AD42A596266946658264C84D4A751506FA2B5A" + $"267DDCEA133A8AD342AA953E5B77E4ABF8A9C4C4F7907219A25AC556192DB5AC" + $"4BF9D87A7589E6C49C0B9F01784D2A650B867041B1077B58F43E908000E1B0CF" + $"0F52E71CFE6F0950500A4974A80503CC1B83E70E7A885834A8CBA42C8B1561F6" + $"A9AE408DB37C38D8C75DDB9F27FD72DF52A484CCED28751E12433D2E4DDF67FE" + $"D1A55148E2CF21816C0259FC4B7808D692804A454760E03F99B46978BD2174A9" + $"D54D665D6CCCA5BEE94BB312CD91C8C0D048953C6A13DA3A4CC5A24D5F7089B3" + $"1342E6A50CE16A4920F150E4AA9AF88499E99169AB290A9AC14BC55356B2943E" + $"07F287B77464C2FC6ECEDE9ED681BC4B525555241A54525B6527293C88E50C4D" + $"416134E00BA9D2D7AC11BF2BDB78FCA010129B953B242B2556C960D7C92C0433" + $"3D20072E6D9E66DBF53137877FEDEBF1F8449D58B80D62C7A16FDE03962A67BD" + $"877736370F8F73090F4A940A1452029353843DC8B70920DAAE8368D490B663B3" + $"8F0DCFC44690504DC9B0043E19EEDB3B9AB9B082596D4A8B8EFED6D8F27F0830" + $"676BE74D9BA2327E8EE34A8A133CCFA75327754B29494A8A6D50A82D06ED4B2A" + $"3472F5B253D96B7B15D1FECF310B52E6251BA095A52A5521935B9511DF7CC652" + $"E0316E1AB67C3B7C77F384D2AFBC497AD2962F6A721BC5DFEA0948529603294D" + $"51E6D87F082EDDEB8E5673E6156F230454865D054C1ED5202F9807202AE307AC" + $"4CB80E5CB00ED9387893A525C929DDACCC393D47D8402FCECE1886C7CD8C1B28" + $"710096609A77FF0099F6D83083C59DA3BB837C3F28FCB105DADFDFDFC7CA1722" + $"54F09134771626214094AD0B4970A42C3292762C6E0906C6152533F533D1AA52" + $"D1AEACAB493458274E83F76749B7083FE2505D4A24D6F2E96D16A4CF964CD522" + $"A4CE5E9C4C41693A9523FCC9155CD570402A014858492013050084002929EE94" + $"B7DDD9AD6666E1666638FAD8B5C52770EEDE6331490A3865283009208B07A8D4" + $"4176CB2764DCDCBB01E43D6D0ECDD4FA58DFF28649AAC2F6575B60F91F8C1A5C" + $"3B3DE9E78BB796625A81B6F9F78D422AA7165021C3DC1771C8F23B4529992952" + $"9442D2A4196B208E22414CC7A6C93976C124306800B5FAE3A92DE98850553705" + $"372C1DCB6CECE3D09F18FB349D64A48D44A2536580A2513105B654A50524B58D" + $"2BB8749704C7D2524C9ECF54B983B3D26AF4A74D291F77274FA71350950A433A" + $"94E2A51B2520252008D0EB93AB131484FDD059972D648798C2EAA332D2E78428" + $"D4A4B2E94821FECF48E807806FD0452442C24909A80EF3A0B1AD2CC6C6EC0917" + $"1E0730A4F36B171D0EDE70D66FCC8F888B2401B580E9CBF48B06161B01E0303C" + $"87C21C52E38852E1AEE1ACC7778D3A89C8A7983B1E4E2D6C3C2C03CA36B5A035" + $"4A4B1D9DC1A54F6B1EE9B58C4D02250F2F931A9D34B9A9521694CC4299D0A0E0" + $"B170FE0403E51AC4CD993E4E9AC8D32C256869AA95F6C56F2D13D1694B921A74" + $"B431ED8A6D60D1A5D4EA07DCEA0899D9964CEC2A625C506621984CC82525894D" + $"4C9A8089602E19CB901C1349C9166CEC4DDDB6B4100820E086F231C4EABD9852" + $"C2E32E5CB83B35BD62A0490410526C5433C199677B120EE3881B42401600009B" + $"2400C00E4390B6040DFE7684A5A5CC37B97BEDD07211A47ED4824A9C9CF87945" + $"203E0397C6FF00AB414022ED6F363D2126A0F763B2831BEC41C750613606E4F8" + $"FEC0469D2B7554AA9D44A6CD48E5BBF8DA351251313D9CC9695A2C695070E920" + $"A6DCC10E0ED0F706C05ED6E2F3E9D3D60A4A810090E08B58F883B74312BF0A57" + $"F4D1FF00A883DE3FF67FD457D476F9D8C4BEF4EFEA0FF4D109C1F3F7303F097F" + $"3CE349F8C7CFD87D4606F1A6FC35FF005B53FF00D33A2477BD7DE267E507BDA6" + $"FEAABFD09F09DA3FFFC400411000020103020404030308070900000000030402" + $"000513011406232434111244543343641522842131537494A4B5C50710162563" + $"759535424565727383A5B4FFDA0008010100063F02544B979DEA36F422E5DDA8" + $"067A6497A165F85B9EDE825605995074DF5DBEAFD3081D32FB85AB9A5E5772C7" + $"515960C19409F7D5885F2A8456170A8A83DBB3BDADBF90C036E7A6E9ABA11068" + $"B9441214ECEE58617F49462AE5DA753B6EDB7B41108584DEE36DDDFF0076562F" + $"C376D46E68731D6A558F899E8C2E703DBAF570E1CBB92DB6EE31B485AD4E8AFA" + $"7DA4A5CADC7F1D57BA5A25396790251D34DCA8C460E224D7C0B12026164D8C99" + $"0383E46E6E5DF7F95D6CA0B84C5031EE7AEA379186C223F70BAECD6C602E5F43" + $"F84AE694C631D7DB3197F95D629AE637B7DBAFFCD28A2639C6DBF4EC2F465FF4" + $"541E56EF3ADDBFBBA317161EA3B7DCF6946618630B205BA9DC77341288461876" + $"C8F70CD6598839A825E77E219ABAA36AD558DEB63A8D371C5E4D15524F5D23B8" + $"9AD020B53EA186B298C5A9230996308975C7ACA97B95ECAC43EC97617D3F104C" + $"FAE97966FF00F76533C1D06A160F71BAE2D96A982435E694B61118501E911237" + $"6B85B656361BB6DAD81845700DDE7E268F9F472675FC4059C23AE9A4A42D643F" + $"378F9273D3C25AE5DC6ECC5EA59AE6E1FC4562FD031B6EE6952E20F3FD3D185F" + $"3B6DB6EDAB2A38737B7629A61EC2469C67B8ADE897061EDB70BD62C4634CECF7" + $"1B9A0958866FA8FF0057AC45F9FE9EBE766F715D388D8B6FFBFD6E0AC1B2FB86" + $"3ADAB5EB725D579CB348F31352144DA6B364580F318C9E23F3CC375C7E7D63AC" + $"B48EB2D23AE9E6D7C6EAC5C2F171E13FE8DF85886B8DB2D4CB00D3727DB4B79A" + $"C590488C87839731664B558A73919A7A7E1A8C29AEAA05916D8E457104B25EEA" + $"13DB888F10DB988FE5C0FA26F032C490F58947E6D3CA50CE041CA51D7C682281" + $"4D8B6DD3D185CE197EA3BEDF508B374C6D9F4CBEE3D25728A130771F81A34182" + $"8421EE682528B0FD3D629B1F73D4EE18AC4894264C1DCB159717EED597701274" + $"FB6DBB0CF6958A0F1036F3FD3562876C5EC771DF51BA7E8CEB7EFD594A5318DD" + $"B2CBB1EC29480E4B998B53BA5C4567BA649582F9E51CC73B7DE423D359E398E7" + $"2D536E1A4C96F731370197C9AC35B65EB5B45E2D1755787FEC3B8FDA97293570" + $"98233D312D7B3899605789A18F58DB1A60A79816272B51F9F51C77B95D6C42E9" + $"B6EC7D9BD2565CA60E7EA770BB35CA57920F4EBD085B230EDE0EA58DC77CDBF4" + $"116209BDB51BC9FAB6E2B95CEF735B7FB30C40EE3A7617AC5F18DEDE965E02EA" + $"40C6D98DC2372E4534BC041C3B9EE1867B4A4C4B8BB3EE6BCF8838B715F758C7" + $"8FB7F454612FF0D35FB8F76FD08B943CFF00A7DED6BC09C317335A588DA8371E" + $"2CBDCBC226B359DA9C861859C24D3C5CBB5C75810416A319A7698C64C312935B" + $"65A7FD81E2ADBB371228C37C397F8ABA421C4B6E46438B7168518C60ADF6DB03" + $"2D2B8061E2068668BAB7974D4A11185FA2676DB8A097E49D9F4F58D8C186D9D4" + $"F4EBD14597D374F465710790B7ED759582F2C7416317C7F4EC2D46140BF1FDC2" + $"D5F08DDCF53EC6B2CC41C3B8EA58F5D5B75C4A0F2FA8629517248AEE3A9FAB42" + $"8C25E61C23F9ABFABA14181076C063D3F7D49B49B5F607125B8E46EC9C4A1100" + $"CE5B884D3EF08CBB11D4172B59F5F0DF5A9BF159A8E9F9C2788981D96EDC4F77" + $"B2337EB409B9F0D5A387437112BAB6F06568B8F17714B8781CF69E1FB520E174" + $"38D71C8319325D7570C48820195ACC886D5C456D5A0C5D509BBA13731276F73B" + $"633A7DCB9D8AE31E6DBEE6BF98648EBA84B8DA11451660229B1772CA5F5D5B8E" + $"71847FA6EBA8C5F3994EA7A6DBF44F5734A6FA9618F575967F1BDBEE6B9A5CD9" + $"7D46DA995E13E513B8FF001E8388BCA73A6A2A4B894EB3B861863655CDF83588" + $"450FB9EA295C53CCC9D9416DBAFE9283FE3FD4D18A5C8A041EDEAF63595D4A3B" + $"858DCB149FD53D323476C441EA3D4BE5C98BCD3F3EB0FCDE6FBDE5F1AE16B522" + $"378BC797DE1D8DA5495FDC93BC3962B65BD848FC50FDB811820D34A34F453652" + $"B74983B24995680096CB66EE8B60E20D9DBF8BA1391E21D225D2D3C548465E4D" + $"2EB64296539797F36F6D862C9DB6935F02655E4164A1115A09A83B2284993A9D" + $"BAECFC0428C2CA1267EE18ACAEFC2F6E0A1158F9EC76F462A384949898571E0E" + $"A5863DDD72846198FD4ACBB1EAD1AEA30E5EB99FC77DA7FDEB4510B0E5DC7C05" + $"D7FF00D9D0459426C1D4F4F5976E6CA7611EA3F8AD65FD2AC86E771F3E8A2DD0" + $"49E996DBF5B5B4B86405D13368E5A9BB6CB1DFAD370869AE8275237FBB38F8EB" + $"120A7A497645AC80C88A19CA1AA1C5BFD2532AF10B7C3E36D5E0BE16E168B7A1" + $"7892EA648E06AF2C2BA8A6C6B736919CC4550313DA2C0A6E9B891A3187202A85" + $"D828DB6FAD46170B68AD8CC9DB07105B09F96373E1BB8CF48EAE043AF22E0ACF" + $"48BB6E663AC591E839889368A5C23303A9DC7BBA0F93E7B3B6A644B1421C5EE0" + $"3D756E1E63ED1736DB6EA16D96D2B14C5CD174D58B7412753E9D9A10982E4581" + $"E9D7A1171724B4214396A019F6F5FE0F735B79DC54C43EA7B9A0ECBB00772EB1" + $"EAE83099423FC356E3107083D452BBB54702E9B4C246938EAB0B269E52629EBA" + $"79A1923A69A4FCBAE9E6D34F0978D078810232332C56DC52CB1B941BB12B737C" + $"1255DBA8128834241C657214658EE754B59966CE89E8E79588DB0D733A4886E2" + $"E2E80746258C32716B7E354122EBCB1C8E5F008B52CA1199A630C75D4A51C659" + $"7172C0CF70BD728BF1FA9EE68256046E66C59A404966CA267A9F45B4A37CE0B8" + $"B6E7B6A6445C2A185D4EDD767B4A0B0F3066FA7E9BE92B2E237ED3EBE82563E7" + $"AD4684041367D8B3D477D5B21E1C5B8DCAFD3F755957F71B6668227841415EE7" + $"A7F57FF2CACB0C21C4CEEB6F5B8E484DB6ABC706DCACBC053230BB02455E287F" + $"88B05F6CBA7C535B64BAC458A557CE2D1E5F7117502F81B55F45F50B5AB7C3DC" + $"6ADD99A543F96C6CA17169C6D9574D7F2DBD8D5C5173B70487A8E22789293338" + $"FDD6724BCA5D5C5FE48361B9DBD0522AE10840C753462E208C3FFD742B62C5C8" + $"6FA7F49462BCB876C7F71D6D6E1711B17A7F7ADA346E563EFF006CBEE684BAEB" + $"BA136E50DC6E2B6FD173FA9DC51B95999F70C33BDA08BF4FF53597137B50753B" + $"7F775CD60C1F72BAECD6260587A6F6DDA52E2B88643926D86F08EA0291675170" + $"12F34184DC04A07589E1E611351CE394332049E61CE51D6F28718B6E5BF8E776" + $"66F842F0A3311081C3CA4E52B6CF8427AF9833929126BFDA640D91B3B0626FE2" + $"5B74D39407A174B56E03C4CED9A77D4E7A8D6E256118467ABF62DC6BA4CC2273" + $"8051864C0C6F23700AEC3225B2D3E5618C8127B8F554117C3E9BA9E9AB2E2AB8" + $"2EB9793D0750BD421011BA3EE5863D5FF95D04502E3E9B734D0B2E3C0BD2A52B" + $"1C91752BD1B62F1821F53FDDBBDA0E22F2773B6A317137876FB6E9E84E9458FA" + $"8DCAEBEDBB443FE15466311821E83B85BBBAC494C2DF4DD47B1A8DB2FE842E51" + $"58B1D11381DBCAE601A3A6B1C8BB4A940D2F3D6129889A84D0CA121024F30893" + $"84AD9C5AF974593E0BE26E0DFB06DB6F535B5592CDC361BC5B926328E338C187" + $"9A89748B27279555D4185450428659165758D9DF5AC8D31E4B1DC1AD75112FB6" + $"38C34F35D808CC7032B6E397CDA5B48C4B2BEAE917B4089730352737366FD67B" + $"BA0E52D4F6E97FE75FD23D5D114CA74DD4D2BB7C3DB7ADA6E6C61214FD4EDE8A" + $"F179DD36E59A30A65C263B3FB256516127A65D8AC50C3596799B0D2C5E4E1F93" + $"EF94AFB82E483F1B41123CE08BB9E9A8E8DDED91B95A59C7B849C144EB1B0986" + $"C0B20A7A6B1963308658F8E9F92708CBF3E956CE0F9AC6B4583A43053D596ED0" + $"C715B91D6712DB17BD23E1AD958B0C70DE10424337DB265A31F1D04190E980F1" + $"01D77D8498D85BDF16BE462E88792327CF7153C9A4167C5E3B6675092616C82D" + $"5B18D7D0B8638B17D356DC4D37876DD47FB37ABADC4396607B8A58588C66C1DC" + $"30C7DA5B1ADC7C4C8BF53B76365FEA95F7DDF88C751F5741143E303B9FABA544" + $"51042107B7F575E7F20540816A0FC6C3B6FDC28C215CCC10FEFD5B71720C0F50" + $"BB141F821E9BB75D9ADC085B4C4BF51D47C7A6D7BB8177C52204BAAED0A251E5" + $"5CB03809E597E6208D081073D3EF4651D35D35A30974721BDC6E7A1529517486" + $"F52CFADA6FF58A57F1DFC32A1F8FA37EAD56CFD5FF009957E1EBF60A67FE947F" + $"89D07F0152AB7D2DFA8A3FC375AFC42149FF00DE42AEDFABFF0032D7FABFFFC4" + $"0027100100010303030305010000000000000001110021F01020303161714051" + $"B1418191A1D1E1FFDA0008010100013F21F44892888A7297FC73DCE231FB91EE" + $"0D9B2D8C8A420AA4565C0A60881567CB4C2C15448FE2C4EFEDDAFF00CADE1A46" + $"77EEA7BFE2A377658CAC47C63C25F86CE190D5C935C12BA10C31F722B0A09424" + $"93BD0479448896A95C5AEC86B80F57345F47219A86E8488D527F273C1CE24B96" + $"E171110BFEBCC27186E5A4D49C3B7A5BEB2EA4088F8BF111BB0DF0BFD4B0DD39" + $"C8BD9DF919AD2D4217251A736C3961E51A38D064DCAA71A943A9509C96E5E2E5" + $"1D2B0601A9CF54BDB953C1517770F1B69A7B66A2F5DE340A209FC56690D52483" + $"3A2747B54E6498A43D1EAC1500A050F545E744058A9C5C8AB1D2EA2147412A0E" + $"459A3CAC2B46D51D69D20E88C3A6835157817E14ED4D4A0221DD9A46918E1C4B" + $"9D1DD7CC30B90D4122F3BC77AF71BA5C3192F91D50047F1AB6262E88162FA174" + $"59FD5307615C0B712BAF463662A78A3795C725E04BDED1761ECFC8361FFA476D" + $"F51E07E00179B009E111E4A6A917C00B5F4093479A0CAA96EF9F0E093BB9EC45" + $"3F8D8B0DC619B2562D70D5CA87BDCCE384E8808BA9D4F6D57C10E885340292BD" + $"E2BC3DB06B8C34C289B0605B1443A4388E6C5F9AF81DFD54E441AD12710E3F33" + $"FF00F276FF008A1A0DC0F21777080072C4EF2AAB5452C52B5DA88FCDC53B50EB" + $"958CB4468F47FB482FD167D9231CB6D72F0CB87A8149ADD52A36D18E5109FE96" + $"29EF518AA541A550B4358EE1EDEFADB6DD6907B066F6198DF8155D89F0C7C1C8" + $"35EFCD682960AB94DBBAE5DEC9C7D2584CBEA971F1CD3A13FD062D0A44A09F22" + $"F5AD183F2E8D6DDFB32A0A28B5F6250E6810EE90B8C049AA47ACB52C1C342B41" + $"286DE16A20C4F3C3327C2061EDE99462073E5FC8F9D737EF6E1A512182B92D1A" + $"64C0F6150E89FD1868C520A91993526818CFD5FC680CEF35F02BAB3E9ACBE4E3" + $"8FE7A9702AFFDA000C03010002000300000010526B8A0970945B2A8E36246415" + $"E8DD4909B0989522F0643EB87772E82BAA467D0004048A1E0B441180A822319B" + $"030A868DABB2392DBB0A0B5AEF652AE80156DB9887D56DC04AF010CE64866AE4" + $"40387002510241EB6C100B1C278AB9C60F7F24FFC40027110100010303020603" + $"0100000000000000011100213141516110718191A1B1C1F020D1E1F1FFDA0008" + $"010301013F10FAD7A9B740C8F25F78F3ABAD02C5A2D2F3F2D2C9A24537BF2E7D" + $"6B03B1EDD3D3B7F5F9EB766D3AAC63F45FDBA7F7D6DF86714A005D4DD30EA222" + $"4ECEB921C23752648D47091BE9DF35730656C45EFA67E2BBFBDBFB5088934D4D" + $"27F7523866D7C3DBD03D74A9B43DEC13E89F0B9445E67168DF9E2B15B5BFBD1B" + $"DD6FCCABF797F0C371B3730F6E36E36A1B0D4880B0C62F6337C37E6B2F2BDE54" + $"D6EACAF68C40CF470F668172B22DA7399D69F3E3138BB66F7F82BFCC74CE6A18" + $"98B62749DBF17CBBFDDEA5596EF37F7A9490634616F7A440B594F8D88D742E23" + $"76503631BDA2FE3AD24885E462DC7C6BDAA285C6406A32911BADA346D146EE02" + $"C2E01717BEFC561D187C18F86A6D1E350ECFD9FD3E4D4422F1B4F7D35C3EBD7D" + $"6D1ADBEF8957F07D629030C92DD2109B4C175D79A05259527586C6DABE54A65D" + $"A0769EFED59C9845B9892313391C2492684A883244206C920861125A52846DA0" + $"1BA4CCCE89DFBD2649666466F32DF866FEB58BC7DDA59F9755D55FBE72AD85DA" + $"9449B498EFC3BB5276BFCCF1CAB464BAE6FE26CE7BF340B6097629DA21267FBF" + $"E1D1622FDC313D8BCF188A51D9C9A7671160A5408A204259D36C51C78FF94CA5" + $"A5662C316D484BD3440A3241997D3624B59911BD2601050BAAD310E6128E4847" + $"45C1E3EEF44511D0660C1871EF574BDD2F9BBCEC3B695236B7C4F3C39EB26E79" + $"9D224941D34E63E7D6A0C417E0F7D3A476631ED6B7BC5AA0D4337B13CD2D8239" + $"C07CB0ECE4ED2520608395A60B8040A4FD45EA0872330FC2689A9EAD5F1E6727" + $"EAFD25DDF3FBBBE752EEFD9FDBE6F4651DD9BF34CC90E49B40A924C38236A58B" + $"719719D57FCA25B117DD02D39543CFAE7BD8F83EFBCDA852E30EE54C244C08DF" + $"C2695CA448B08653AA42D22E339629B24BFA8767F787BC853C5B8DB8BF422728" + $"E227D7A1C97ECED9E75AB2C0932DD99E6F3D3799FEC93504649988BE379C47AD" + $"7DFBF7B55A35D21F0BFAA471D1B29B6D8A4D88D91D0E478B771B95232A414822" + $"430BA25AA602DADF32650C909B0D274709C887DEF8B566B16FF6D5F7EF6A4451" + $"B230EE254BBBE6D1A4CC4DE3D639E9C69F7F5D25889B4CC738F3AB696EFEFC76" + $"BF8D05E163759B795FA1B4C4C671DDFF00294C170185C309D8B6936898B54381" + $"83066002C7AF9EDD613246BE1BD5AC8B397487488FE74D5D38DB8BB3EEF4FBF7" + $"D2B17C6B3F34B2416D6BE75D88D7D0A9CC089C3390B262F89DAB49E9F63A000D" + $"96E896D32893787096CCD26CB138200A6B0317CC45B48C56B7F18F8AC59D3CFA" + $"4B01A131E39AF6FBDAB0DA7D98AF6DB6A636EF37F8FDD2F399BDB9977E31C9BD" + $"0F3171959704CEAED9BE4B5E8B01B7E092862486C223A23234C8458C36AB277C" + $"5FA05AE3421B4C20C3927463CFB25AA7D73CDE7F0CC66C6AF941F17DE8BFAFA1" + $"35BDE20F3E3AF346B9C68C79F1C54A325C2271A99F08DFA31A78E84F1F7D284A" + $"0DA4B89D85CDA4AB825E79BC052276CC17595D21D839494DAE913AB6BC586D91" + $"ACF3D098587BECF7EB7577CF7ED57F9FEF9D7A7E1CFCFD8EA2A1144C2676A004" + $"1428CE4EAACCA532789A6332274BDB707531E71A549B9E753A0B72FCFF00319A" + $"C531895966675F267BD07017C84DA1DC7CF8D13733375F1996D7556F2E575A0D" + $"2CE1730F9471C75E6F47F55CDE8D61EDB3F27B9583D9F6A84C08DEF32CB7E3B5" + $"460EB7D33933DADE3593C3DCFBF6CD22EEBAF6CD7DC6ED183EF0AC1EDEC29F7F" + $"C2BEC73599DBE5FC323B9EFD357DADACBBFE5AC5E3EED3E929D1E3F15FFFC400" + $"251101010100020300020203010101000000011121003141516171811091A1B1" + $"C1E1F0F1FFDA0008010201013F1098A42913A228F45A27789FAAD61A0856D9B3" + $"B40A96863BD40C0CAB4BE420D6585BE78CDE0580B74804966D0AA2B458AD9280" + $"7B8100085F0E0CA54D716D9868170607738B44F7809676A8441111AB79461A25" + $"3E929C605110CD3B05305C544362DAD28976D5EA44F0451717C124EC2834D3C7" + $"2D897580C903A11C8D8A47B131194013930D0EB10E3B2B286887624289AF4A2C" + $"C61D9EDDFA3EBF1F77F5C41C6B85EC8EFB897BEE1923CDC2A6FA5BDA9D7DFF00" + $"1F1E416205C000EAB0C81E3BBE23ACE25458CC4850C01CD68DDEAF1A626088A4" + $"5AF1E84F2022DD0688A2A73078B82005B94A2315C53C93BF3C45A010244AF4AD" + $"091257DF0462554BAC29056322161792E61435A51409EC94CCAF08100CD15832" + $"60E768E17DB0468847D899C762B4025714C211182445271844A7B1D082A828A5" + $"00C591D0008B4E99D2C5A9734A1DF0C542A8420545ABA105A1040B06C4C3E94F" + $"F3F9F3FACE47BFF1FF00BF5FEF8E8529E8610020C4061291C76314885A9318EB" + $"008E36A808759CB0C10F639C4C8606600021801107A123C5D8658CBFA115DE5F" + $"1FAE28AAED1151144A289A2F89DF12A76102A54214806CD3A7784A37111DCD69" + $"348EABB7587096EA2908F122035344FACE088100002003A0100201EBC7755534" + $"D7C06950F861DBC04907568AAD1A480108F2B7A3825C114483DD4EF316131643" + $"8E62D1E174FEFF00BF8BC0F74FC9D8EEE147605BDB3388B55F2024B5F1747648" + $"4E074260510EAB0FD38428E22A54C912556D2A8BC70D7D0856CA169BC772AE06" + $"69C10CB21936A5399E37DB42B305C408EC325E24AEFC4E4455E012C889A3A989" + $"CB16A06CC5140B00E584A86C633A885C188062F7C2053B07430D9E5804D98E69" + $"FB493EF5DBEF9E2014B068B691AB2D047CF2C830005B1C117CC68A4FD5E0C8B4" + $"7DF3BD7EBF37CF3C862E74BD814092800A16294098A63D4BD11674A2EF3AAFE8" + $"460E6EDBF02EAD288A37408195D6780D4AED38CA0ECC894DA0D0B742851AC337" + $"47EA68D00A623810A33D8A0888EAAA97A681046C4C08642D3B5425C48FAA2920" + $"A23A3A20343AA8CF670280C510658A419E7F1E7AE314A63C19151F122DC0B941" + $"03E4053679A7F4A6E77C54B258CF57A6533E2F088D3C3C0EB48B1A2611C43E8C" + $"12F1A3805401BAA40FABC4708F3D1450504108141C96D51012155755A1C39E6E" + $"01AA5B414210234ED1E9DBF30E4ACA9F4CBE73463DF1F0BA1827A1029F901F4E" + $"24B5AB8AF294D928D5542101C2923527CEB06C7C2E6CC3024A04D41A1050A852" + $"4990F03FC38439B2111E21E991C63E3E314FE9FDF288E81F3E541C2468EEE3F3" + $"9268282521D70802A22287109208361E9375009E459D7327975FAFF833EB5EBA" + $"02F631E8E97CAB737A3828D4A4A313BDBF3FFDCE2ED6C2FAF7DD30FEECEFBE09" + $"5A430F61696C9310236F8E2441F61C0D279050EC0D00AA3411CA22EE36A2C4C1" + $"4F45E765314C0C5062C504BA6235596A91556B692A6B4917B26F3473D3C53106" + $"293AC03E9E0418A2A04012A8CED12E06B673612AC0DC2844F24C872E0290607B" + $"6CB20210B11A909061222B114A56084F55CA280C06A9679261CC0C00009080B8" + $"A168D12DC7404ED6E4FCFABEF98393C286FF0067089000000180010021F9FBE4" + $"C36C154856EDAA1D90DCE5113456D420E9F9697CFAE4765EA4D4518267A5A23C" + $"913F07792FDDE1E38BA36117AC17D8A72248047DA975000A6F84901AA2E1221A" + $"7A38A0269A2972DE35600C3A046813CC9DFAE6A517766363C6509A9C29679249" + $"D90F6D000B58B4F6E254186A5A86BE55A86C5D6F8F9C228E632002180D2861A0" + $"10A024011013480861064D03AF1C25381570BE4743C07E4C897C84A9493230C6" + $"3E07AA6F262899318F919989BB3D4E67D080280181018E76F7D4339B121A894B" + $"49A8540A8255EDAD900E889ECFD4A82F5E878112C462210AC540B642BC00BBA4" + $"6C68A30536BF519D21ED2EC16BD4408A209C730F4A1800A25E818BD1E5A6B45D" + $"0B0AC763541607A4759C511C1819BC612046E44F199B9353AEB482607318B638" + $"9846F921C279F572614A2890953CB588BAE00480B4151B00A7F43FD1C8103052" + $"914029A4506768BC4C02DD40346008DAAC2AAA343C0F859F430176044BEF8404" + $"70EAC4F8C667E670389D1B911A1A187EB0785511228290B63EA8C7880A3B0014" + $"0E8134355098ED81C45182E3D7E38C4A105401690C2B056C9CBCCA952462361B" + $"1654B61010AC14D0F68407E5CEFBEB8E2B8D33299E628CD18CFBD73A280A608D" + $"285664EC8151EB0042211F23529171C1EA0C223FBF20E38D11142446828A8428" + $"7713484D2F7C33E2C3F5783C7D1C6C493B1DA899ECE0074ED95A20CEC89970AB" + $"011B1D512D8C18EF68897623E780A983050E27081EC1A008703E83705B294561" + $"3469A24E3720BDC0DF8DEDDF49D9C0264A100D031FB02ECDF9C251A4BAA1AF20" + $"010A0248E23114A36204B21225482638410564BAE20770D1C9765E026A666831" + $"B256C17C451589B15009A5144AA5242A1F8E8FE1FF005C95B8179985C1E98337" + $"0BC6F6C8001B4E4D3459758256812850741640E31E304141D2857C406C7747F8" + $"120001E263FA0A1F3859089350404470A6B2840ACBC8E4C60C8034C70058061D" + $"E1992C2421300855542056438A2E8A86FB04A8E0280BB0C380140DAA1553A7BB" + $"0414468F7C4DAFACA5C45480061D9AB0398AD7974BF702393A3779818108C2B4" + $"A51B7B18F7C414505AA414B8C7B2F9897855329B1601122823B021A83A5E3A55" + $"5BDD2CF90037241A4A5FEC2C6B591E9E9F0B711381AE4187ADDF3362184C3F69" + $"4EE2D20CA7B3FB3F854A880C49F7289D9D335E552A41A0D868A4920530E1087A" + $"F16EA07F94BE8DE29105C33E8AF99F5BE7A70288EB28E9E54E81B0C77C5A42D0" + $"5048B05ACA4161AF578BA431FD28BD7C9CAE85D1988D12274B56EF03419E1038" + $"025C50D41A042AAEFC0402DE883F16067371CD0021D35475900835797726AF77" + $"95339E881110000F4D041301B5DB45B0B1401721D42AC38202C2166610C2103D" + $"1D049C619FAFFE57FF00338E2A0555EE452504D9A646894C443F02AFEC7D8067" + $"10D2CCE919F413AD897A71E6084A8AA6205EE581F697BBC133839803440308B0" + $"303E39D97B023B4549088D8D1B3790D749503615494AE8C7664E6DD5F88FCFBF" + $"9F1E788D085106507C33067AE37B3DB8A1D8280046C824088028E1D3BBF8D3DE" + $"3476F0D1EB0F9BDC76CF97D3EF88D8A227E448C6FA42687064CC580AD9559C60" + $"9406A0F4F347749BCC740816875DA13DF9E402EA4A16888A0460569D5042A11E" + $"C2253747C722A1180D394502A8304D2B9D1E8E41B4D8E159A0010A3CE0100F03" + $"000000000130E5C768C4C90C4FBA2D776741C03148697A4FD2587957D02F30C2" + $"3053301090515655797228CA02B02B258057601D1C00948BD1836907F0C17B87" + $"5C06442344034715180F8F2C366EC0EDCC10C066CD5778079C4F7220DA251575" + $"A1D0728C15000AC21E8022823BC42670105290D160160158B02312B0292513C8" + $"43B074A092F307F8BFC0FF0073FC68FF00CFE5FF004B8FF3FF0081D1FC3FEB9D" + $"BF3FFAFF001B3FDDFE8E787E5FC22FFB7FDE7FFFC40026100002010303040301" + $"01010000000000000111210031415161718191C1F0A1B1D1F110E1FFDA000801" + $"0100013F10FF0081DAE996C1C55EFB31620CBCABC95F55D0E6B2412601661867" + $"1351A45B131E6203169D6113579A2588A0F46300A1AAA1373CA4C9D778873055" + $"3159344692E524B5717AD0AADC7833EBA61E857F1A8B3D44E53AC1280E89FDB5" + $"7E95BF0A83C6E286C0964940A969C5667E1D866F667EC6682378E04BB5C837D3" + $"4D7D5A3A770175A600405305C4DC85F7F00EDD1EE3F4CD3F08049CAEBAFD4185" + $"92F12CD252AB132C9F028A300409D92004CE40C845CD6AA7630BB5C672248534" + $"1E41BB7F1E9A4E180A79A2616C3F340337E6E626214127928DE28E25E2215CA1" + $"22454B606A20EB14BAD2208CBD41700AAE1527E8C6FC017AE458C3D2EB7DE7C1" + $"0F4CF1A9FAB0A1D0B600730794E05CD9335B978DD3F37B818A47EDA7C5B5B4D7" + $"80EBF16F77FF004D2232DA034E194DF58373D068D08871526FD0756173DA2208" + $"EB4410C625474B1AF80DE1047CEDC8762BEC3E2D1AEF4FCC06CC09B5FA62D734" + $"02E849D4D74D3E288F72CEAD3041BF6A1546210AC90B002DEC6D141650224705" + $"4779A64D783FB15E1DF41C25368B61D27AB039CDF0D81D4FBB56DDB05F2F4DAF" + $"A975B9BA88F27667168A08A3ED708631A63FCBE299A582354CDB18E24F512B1C" + $"82E05C1D65AA570EE88B509D5E3D26E41B35D6D3AE682D116CF0DDC84AC6C58A" + $"D137F08A04EA2B43914AB3879808C8165D51CD7AED9BEB74FE6A3E9FBD847F31" + $"5D745C22E044743DC57B53908D27CD723D478CB4F15CADC096FD138062229108" + $"BC80CD990D0D2D8205446505C8B0F1CCC8A0076844C903AC816CBBCEA282E989" + $"16B071624A2CCEF78FF233E5562C0039017AB4F5C01D410D73634588BD8CB009" + $"EA1C0E942BE3A387F3EAD53F88ED798DF2278A8F7818A084003689F0055C1FB8" + $"AFCFDADB35FEAEBC357A94F78FB9E86A1201C5120D8FDEDC5CCB0ABA47D2FDE6" + $"8D1C5DE840CA0323731BC50202C8CB4B0B05AB166D3481CFDCB1676E5B5B7ABF" + $"37F3AFD518818820061620BB8E422D4D580DDAA6986EDA376D117E172BBDC4F3" + $"BF008302DB695821AB9B071D1E9C8CE6FA05FCFF00C14BE25E9CFC6943A88C34" + $"1D18BF8A73E0817B20120064C99B7566917185F6BF669DCEB915BE678CD9CF3D" + $"ADC8F70F93B0E6E8202919F66F4E09E26AE96CE94E9DBAAA218C26EF3FCFAAD9" + $"DD34E63B104F1472BCBF65210BC5A322D7AD2D9F53D9700668107DD28EE4C1D2" + $"1ADC2A0B33D0E445381C69DCC0C399BFF212617558A16690D57255C1EC06557D" + $"FDC08534A13A33E1B0CE6F3162BCAA852E4353DDA74D41980300B022368BDFF8" + $"85EFA7EF7346152BBADF7F1C5259B644B68385FD866C5971228B98281B1C79A4" + $"0F9ECDB604DB5F9A2592B6DF16009B0F59AEC27EFED427DB9FF1F1F6A4631399" + $"B7F12FC0BB17485CB6FDDE862B8B0631712C19C13D5D0AD26507BD6018FE0868" + $"611716E87E14BF4E09D7543D16D006DEA68FD0DCA23429FCD75CF6953102FECD" + $"25B19885811DAD1B50289527AC36A4E94F7BDD581C11AADCF2ABC250D97C07BE" + $"B5D2AC6E3C47ED1278A219C616728FD0A8A407BE794D6E070DD950455455824A" + $"08D832DD9C32557D9EF8D55ECC69A4A141D836D871B205C49911587B84E60C87" + $"1AAA0589D002EB5A6469ABC51B83FC3952FDCB4254E056EE3CF98F4D82E15263" + $"2881949D255B2311E91A837E2336025960C00637852FF74A4B3037301CC4119B" + $"9C57931852B9CE74914313713420D93C1DEDF7DBD3697F60CF5A387406260DE5" + $"281A46D5B360DE18DED1DE2AC2F098F3389E6A4E8CFF0039E926A3AF86468333" + $"9FBD2AE466978841A26F9538146CDE80076701F3B6D5E939FBDC18274A006707" + $"72298870E6405422311FFCD51357250D33E80BB7794558FBC7C5FBFC1BC9FBD4" + $"1D7DD2F44F53DE688323904063EE68399292892284659D624B9A2FFBA2D74C5F" + $"7A34EA27B0D05F5210B1A5DCB619DFFEFD572F476771CDF662BD270EF7CC7FD3" + $"56DB1BB066C563F94218E6239EF01412CA4B903179574DDB436B703B14A50257" + $"9DAE091722E86E6A108442FBE977038350BCF37EF3D68E909AA92A6E6D1E8208" + $"961C223E762508ADA621491C9BBEBAEC6A7F2A4EF7208B059EB0EBE15CE63B6F" + $"0AF0E82248A5DDCA63E314A179964B82038A2588EFBF6A2042B13B1AD52501EC" + $"164604EF515FC60B6333B98C4575B0BD0FDB915002C86876648B682CCD7AADB2" + $"F6EE1D7C8F3FDC6F7DABEFE59C8D33FF005D45D508B39998CD9C68290BB30F33" + $"84C37F8DBF5E9EBA2A5DDD969CE0213A84E5CCCA9B38F1D13B76D9088DEBE523" + $"CD8E3BD3FDFE5F85D5628235B860483EF35718A1116CBE590DEA50432ECE0F09" + $"9D7A9117A3B8EE76272A6144C8CC57C873DD1674E9E244EB10B73CFB9AD41930" + $"A1ACA78631B3747AA968F3898D8FCCD21CCA303230EB2EEAD31402AEB0B6DBF3" + $"FE6F1D258F2B2F426CDE681297DC28ACBE50F471877D808B7D14D1060395587D" + $"814D1A22CB95B387474EC2DB5F35D638BDE74998DAEEF4A1CF2D661B224941CA" + $"BD883455CD895B23FEDA6457EBB7E2DD749AC0FA69767294A9D462FA12D0D260" + $"6DD30669E372F9DFD0CB7422378DBF8BF7A31EEF1A2F4BA97BDA22F3A9D7D150" + $"94581977C902EA52BB558423D1B673E0523AC461FF0073A4508B54EF61889DC8" + $"4157E69BEB594915D0E742E5C9186BA5822E658FF3816EB8F1576204626B1939" + $"2096B19A4D8EA2349573A7F6AD3163C659982F012866A13CB040BC9252289EE1" + $"4D00694BD23B34B5B1CD74682D0B5EB440EACF10086822D32CB9AC94C7C6856D" + $"BA9C1AB11D8EEC7A860D6E82C113D877DD0D93BC1C5BBB83D632B45562E32B33" + $"B66162DB97D796DAA1172CEA4C9068DE95259A1356D7BC600868A542BF5B508F" + $"5730673BE0816D307FCDBD1DB5F3E8F7361FE496EA0F6EB5EDF4D7A1B0AF775A" + $"F91E4FF962FF00BC0AF55B51B535FE0D7FFFD9" +}; + +resource mini_icon array { + $"FFFFFFFFFFFF000000FFFFFFFFFFFFFF" + $"FFFFFFFFFFFF0083830000FFFFFFFFFF" + $"FFFF0000000000838383830000FFFFFF" + $"FF00D9D9D9D1AAD98383838300FFFFFF" + $"00D9D9D9D1D1AA83D9D9838300FFFFFF" + $"000000D1D1D1AA838383D9D9000000FF" + $"FF00D9D1D1D1AA838383D9AAAAAAAA00" + $"008383D9D9D1D18383D9AAAAAAAAAA00" + $"0000838383D9D9D1D9AAAAAAAAAA01FF" + $"FFFF0000838383000000AAAAAA00FFFF" + $"FFFF00AA00008300D1D1000000000F0E" + $"FFFF00AAAAAA00D9AAD1D1D1D1000F0E" + $"FFFF008383AAAAD9AAD1D1D1000F0EFF" + $"FFFF0000008383D9AAD1D1000F0EFFFF" + $"FFFFFFFF00000083AAD1000F0EFFFFFF" + $"FFFFFFFFFFFF000000000E0FFFFFFFFF" +}; + +resource app_signature "application/x-vnd.reh-XContainer"; + +resource file_types message; diff --git a/src/tests/kits/interface/bshelf/Container/Container.rdef b/src/tests/kits/interface/bshelf/Container/Container.rdef new file mode 100644 index 0000000000..a1b6cf1fea --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/Container.rdef @@ -0,0 +1,209 @@ + +resource(0, "ContainerWindow") #'ARCV' archive BWindow { + "_prio" = 15, + "_port_cap" = 100, + "_title" = "XContainer", + "_wlook" = 11, + "_sizel" = 380.000, + "_sizel" = 280.000, + "_sizel" = 10000.0, + "_sizel" = 10000.0, + "ID" = 199, + "_flags" = 524288, + "_type" = 11, + "_wfeel" = 0, + "_name" = "XContainer", + "_frame" = rect { 457.000, 288.000, 837.000, 568.000 }, + "minWidth" = 380.000, + "maxWidth" = 10000.0, + "minHeight" = 280.000, + "maxHeight" = 10000.0, + "_views" = archive BMenuBar { + "_name" = "MainMenu", + "_frame" = rect { 0.00000, 0.00000, 381.000, 19.0000 }, + "_resize_mode" = 4628, + "_flags" = 603979776, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 12.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656876032, + "_color" = -656876032, + "_ploc" = point { 49.0000, 14.5547 }, + "_rsize_to_fit" = true, + "_items" = archive BMenuItem { + "_label" = "File", + "_submenu" = archive BMenu { + "_name" = "File", + "_frame" = rect { 0.00000, 0.00000, 0.00000, 0.00000 }, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 12.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656876032, + "_color" = -656876032, + "_layout" = 1, + "_rsize_to_fit" = true, + "_items" = archive BMenuItem { + "_label" = "New", + "_shortcut" = 78, + "_mods" = 2, + "_msg" = message(1) + }, + "_items" = archive BMenuItem { + "_label" = "Open…", + "_shortcut" = 79, + "_mods" = 2, + "_msg" = message(2) + }, + "_items" = archive BSeparatorItem { + "_label" = "", + "_disable" = true + }, + "_items" = archive BMenuItem { + "_label" = "Save", + "_shortcut" = 83, + "_mods" = 2, + "_msg" = message(3) + }, + "_items" = archive BMenuItem { + "_label" = "Save As…", + "_msg" = message(4) + }, + "_items" = archive BSeparatorItem { + "_label" = "", + "_disable" = true + }, + "_items" = archive BMenuItem { + "_label" = "About…", + "_shortcut" = 65, + "_mods" = 2, + "_msg" = message(5) + }, + "_items" = archive BSeparatorItem { + "_label" = "", + "_disable" = true + }, + "_items" = archive BMenuItem { + "_label" = "Quit", + "_shortcut" = 81, + "_mods" = 2, + "_msg" = message(6) + } + } + }, + "_items" = archive BMenuItem { + "_label" = "Edit", + "_submenu" = archive BMenu { + "_name" = "Edit", + "_frame" = rect { 0.00000, 0.00000, 0.00000, 0.00000 }, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 12.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656876032, + "_color" = -656876032, + "_layout" = 1, + "_rsize_to_fit" = true, + "_items" = archive BMenuItem { + "_label" = "Undo", + "_shortcut" = 90, + "_mods" = 2, + "_msg" = message(7) + }, + "_items" = archive BSeparatorItem { + "_label" = "", + "_disable" = true + }, + "_items" = archive BMenuItem { + "_label" = "Cut", + "_shortcut" = 88, + "_mods" = 2, + "_msg" = message(8) + }, + "_items" = archive BMenuItem { + "_label" = "Copy", + "_shortcut" = 67, + "_mods" = 2, + "_msg" = message(9) + }, + "_items" = archive BMenuItem { + "_label" = "Paste", + "_shortcut" = 86, + "_mods" = 2, + "_msg" = message(10) + } + } + } + }, + "_views" = archive BView { + "_name" = "MainView", + "_frame" = rect { 0.00000, 20.0000, 383.000, 289.000 }, + "_resize_mode" = 4660, + "_flags" = 536870912, + "_color" = 255, + "_color" = -1, + "_color" = -656877313, + "_views" = archive BBox { + "_name" = "MainBox", + "_frame" = rect { 9.00000, 11.0000, 373.000, 212.000 }, + "_resize_mode" = 4660, + "_flags" = 738197504, + "_fname" = "Swis721 BT", + "_fname" = "Bold", + "_fflt" = 12.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656877313, + "_color" = -656877313, + "_ploc" = point { 40.0000, 9.77734 }, + "_views" = archive BView { + "_name" = "ContainerView", + "_frame" = rect { 2.00000, 2.00000, 361.000, 198.000 }, + "_resize_mode" = 4660, + "_flags" = 536870912, + "_color" = 255, + "_color" = -1, + "_color" = -656877313 + }, + "_label" = "" + }, + "_views" = archive BButton { + "_name" = "TestButton", + "_frame" = rect { 260.000, 226.000, 360.000, 256.000 }, + "_resize_mode" = 12336, + "_flags" = 570425344, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_color" = 255, + "_color" = -656877313, + "_color" = -656877313, + "_msg" = message(73), + "_label" = "Test Replicants", + "_default" = true + }, + "_views" = archive BButton { + "_name" = "RemoveButton", + "_frame" = rect { 15.0000, 229.000, 247.000, 253.000 }, + "_resize_mode" = 12336, + "_flags" = 570425344, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_color" = 255, + "_color" = -656877313, + "_color" = -656877313, + "_msg" = message(12), + "_label" = "Remove all Replicants and Backing Store File" + } + }, + "designfsize" = 11.9873 +}; diff --git a/src/tests/kits/interface/bshelf/Container/ContainerApplication.cpp b/src/tests/kits/interface/bshelf/Container/ContainerApplication.cpp new file mode 100644 index 0000000000..55ddc76bee --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/ContainerApplication.cpp @@ -0,0 +1,150 @@ +// ContainerApplication.cpp + + +#include "ContainerApplication.h" + + +const char *XSHELF_INSPECTOR_APP = "application/x-vnd.reh-XShelfInspector"; // Mime XShelfInspector +const char *BACKSTORE_PATH = "XContainer/XContainer_data"; + + +ContainerApplication :: ContainerApplication() + : IEApplication("application/x-vnd.reh-XContainer") +{ + fTest = false; + fStream = NULL; + fRemove = false; + BEntry *entry; + fContainerWindow = NULL; + + if ((entry = archive_file())) + { + fStream = new BFile(entry, O_RDWR); + delete entry; + } + + fContainerWindow = new ContainerWindow(fStream); +} + + +ContainerApplication :: ~ ContainerApplication() +{ + be_roster -> StopWatching(fMsgnr); + if (fStream != NULL) delete fStream; + + if ( (fRemove == true) && (fTest == false) ) // delete backing store file + { + BPath path; + BPath parent; + if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK) return; // path: /boot/home/config/settings + path.Append (BACKSTORE_PATH); + + path.GetParent(&parent); // lock for parent + create_directory(parent.Path(), 0777); // create directory + parent.Unset(); // close + + BEntry entry(path.Path()); + entry_ref ref; + entry.GetRef(&ref); + + BFile file; + file.SetTo(&ref,B_ERASE_FILE); // erase file + file.Unset(); + } +} + + + +BEntry *ContainerApplication :: archive_file(bool create) +{ + BPath path; + BEntry *entry = NULL; + BPath parent; + + if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK) // path: /boot/home/config/settings + return NULL; + + path.Append (BACKSTORE_PATH); + + if (create) + { + path.GetParent(&parent); // lock for parent + create_directory(parent.Path(), 0777); // create directory + parent.Unset(); // close + + int fd; + fd = open(path.Path(), O_RDWR); + if (fd < 0) fd = creat(path.Path(), 0777); + if (fd > 0) close(fd); + } + + entry = new BEntry(path.Path()); + if (entry->InitCheck() != B_NO_ERROR) + { + delete entry; + entry = NULL; + } + return entry; +} + + +void ContainerApplication::MessageReceived(BMessage *message) +{ + + switch(message->what) + { + case CLEAR_FILE: + { + message -> FindBool("Remove",&fRemove); + } + break; + + case TEST_REPLICANT: + { + message -> FindBool("Test",&fTest); + } + break; + + case B_SOME_APP_ACTIVATED: + case B_SOME_APP_LAUNCHED: + { + fContainerWindow -> Lock(); + bool value = be_roster -> IsRunning(XSHELF_INSPECTOR_APP); + fContainerWindow->EnableRemoveButton(value); // Only when XShelf.. is running + fContainerWindow->EnableTestButton(value); // Buttons are enabled + fContainerWindow -> Unlock(); + } + break; + + case B_SOME_APP_QUIT: // Quit XContaier when XShelfInspector is quitting + { + fTest = false; + bool value = be_roster -> IsRunning(XSHELF_INSPECTOR_APP); + if ( !value && fContainerWindow->Lock() ) fContainerWindow -> QuitRequested(); + } + break; + + default: + BApplication::MessageReceived(message); + break; + } + +} + +void ContainerApplication::ReadyToRun() +{ + fMsgnr = BMessenger(this); + be_roster -> StartWatching(fMsgnr); + PostMessage(B_SOME_APP_LAUNCHED); +} + + + +int main() +{ + ContainerApplication theApplication; + + theApplication.Run(); + + return(0); +} diff --git a/src/tests/kits/interface/bshelf/Container/ContainerApplication.h b/src/tests/kits/interface/bshelf/Container/ContainerApplication.h new file mode 100644 index 0000000000..b445d53d82 --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/ContainerApplication.h @@ -0,0 +1,44 @@ +// ContainerApplication.h + + + +#if !defined(CONTAINER_APPLICATION_H) +#define CONTAINER_APPLICATION_H + +#include +#include +#include +#include +#include + + +#include +#include +#include +#include + +#include "ContainerWindow.h" +#include "IEApplication.h" + +IEResourceHandler *resourcehandler; + +class ContainerApplication : public IEApplication +{ + public: + ContainerApplication(); + ~ContainerApplication(); + + virtual void MessageReceived (BMessage *msg); + virtual void ReadyToRun(void); + BEntry *archive_file(bool create = TRUE); + + private: + BMessenger fMsgnr; + BFile *fStream; + bool fRemove; + bool fTest; + ContainerWindow *fContainerWindow; + +}; + +#endif diff --git a/src/tests/kits/interface/bshelf/Container/ContainerWindow.cpp b/src/tests/kits/interface/bshelf/Container/ContainerWindow.cpp new file mode 100644 index 0000000000..eb10658b2f --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/ContainerWindow.cpp @@ -0,0 +1,199 @@ +// ContainerWindow.cpp +// Generated by Interface Elements (Window v2.3) on Feb 14 2004 +// This is a user written class and will not be overwritten. + +#include "ContainerWindow.h" +#include +#include + +extern const char *PREFS_BACKSTORE_PATH; + +ContainerWindow :: ContainerWindow(BPositionIO *stream) + : IEWindow("ContainerWindow") +{ + Lock(); + CreateViewBitmap(); + + fArchiveStream = stream; + fShelf = new BShelf(fArchiveStream, fContainerView); // Attach fShelf to fContainerView + fShelf -> SetDisplaysZombies(true); + fArchiveStream -> Seek(0, SEEK_SET); + + fRemoveButton = (BButton *)FindView("RemoveButton" ); + fTestButton = (BButton *)FindView("TestButton" ); + + GetPrefs(); + Unlock(); + Show(); +} + + +ContainerWindow :: ~ContainerWindow(void) +{ + SetPrefs(); + if (fPrefs != NULL) delete fPrefs; // now prefs are saved +} + + +bool ContainerWindow :: QuitRequested() +{ +// long c = be_app->CountWindows(); +// if (c == 1) be_app->PostMessage(B_QUIT_REQUESTED); + be_app->PostMessage(B_QUIT_REQUESTED); + delete fShelf; // by deleting the Shelf we'll save the state + fShelf = NULL; + return true; +} + + +// Handling of user interface and other events +void ContainerWindow::MessageReceived(BMessage *message) +{ + switch(message->what) + { + case IE_CONTAINERWINDOW_MAINMENU_FILE_NEW: // "New" is selected from menu… + break; + + case IE_CONTAINERWINDOW_MAINMENU_FILE_OPEN___: // "Open…" is selected from menu… + break; + + case IE_CONTAINERWINDOW_MAINMENU_FILE_SAVE: // "Save" is selected from menu… + break; + + case IE_CONTAINERWINDOW_MAINMENU_FILE_SAVE_AS___: // "Save As…" is selected from menu… + break; + + case IE_CONTAINERWINDOW_MAINMENU_FILE_ABOUT___: // "About…" is selected from menu… + PostMessage(B_ABOUT_REQUESTED); + break; + + case IE_CONTAINERWINDOW_MAINMENU_FILE_QUIT: // "Quit" is selected from menu… + PostMessage(B_QUIT_REQUESTED); + break; + + case IE_CONTAINERWINDOW_MAINMENU_EDIT_UNDO: // "Undo" is selected from menu… + break; + + case IE_CONTAINERWINDOW_MAINMENU_EDIT_CUT: // "Cut" is selected from menu… + break; + + case IE_CONTAINERWINDOW_MAINMENU_EDIT_COPY: // "Copy" is selected from menu… + break; + + case IE_CONTAINERWINDOW_MAINMENU_EDIT_PASTE: // "Paste" is selected from menu… + break; + + case IE_CONTAINERWINDOW_TESTBUTTON: // 'TestButton' is pressed... + { + BMessage msg = BMessage(TEST_REPLICANT); + msg.AddBool("Test",true); + be_app ->PostMessage(&msg,be_app); // Send Info to App + + QuitRequested(); + } + break; + + case IE_CONTAINERWINDOW_REMOVEBUTTON: // 'RemoveButton' is pressed... + { + BMessage msg = BMessage(CLEAR_FILE); + msg.AddBool("Remove",true); + be_app ->PostMessage(&msg,be_app); // Send Info to App + + QuitRequested(); + } + break; + + + case B_ABOUT_REQUESTED: + { + BAlert *alert = new BAlert("", "XContainer (H.Reh, dr.hartmut.reh@gmx.de) " "\n" "\n" + "Based upon Container Demo from Be Inc." "\n" + "The GUI was created with InterfaceElements (Attila Mezei)" "\n" + "Please read the ***Be Sample Code License*** " "\n" + ,"OK"); + alert -> Go(NULL); + } + break; + + + + + default: + BWindow::MessageReceived(message); + break; + } + +} + + +// Update the menu items before they appear on screen +void ContainerWindow::MenusBeginning() +{ + // Complete the SetEnabled argument or do anything with the source below... + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_FILE_NEW) ->SetEnabled(false); // "New" + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_FILE_OPEN___) ->SetEnabled(false); // "Open…" + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_FILE_SAVE) ->SetEnabled(false); // "Save" + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_FILE_SAVE_AS___) ->SetEnabled(false); // "Save As…" + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_FILE_ABOUT___) ->SetEnabled(true); // "About…" + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_FILE_QUIT) ->SetEnabled(true); // "Quit" + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_EDIT_UNDO) ->SetEnabled(false); // "Undo" + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_EDIT_CUT) ->SetEnabled(false); // "Cut" + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_EDIT_COPY) ->SetEnabled(false); // "Copy" + KeyMenuBar()->FindItem(IE_CONTAINERWINDOW_MAINMENU_EDIT_PASTE) ->SetEnabled(false); // "Paste" +} + + +void ContainerWindow :: CreateViewBitmap() +{ + // create background bitmap + BBitmap *bitmap = NULL; + fContainerView = NULL; + bitmap = BTranslationUtils :: GetBitmap('JPEG',"DropZone.jpeg"); // load bitmap from resource + fContainerView = (BView *)FindView("ContainerView"); + if ( (bitmap != NULL) && (fContainerView != NULL) ) fContainerView -> SetViewBitmap(bitmap); + delete bitmap; +} + + +void ContainerWindow :: GetPrefs() +{ + status_t err; + BRect windFrame; + + + fPrefs = new TPreferences ("XContainer/preferences"); // name of prefs-file + if (fPrefs -> InitCheck() != B_OK) // if no prefs-> create new + { + windFrame = Frame(); // get window frame + fPrefs -> SetRect ("WindowFrame", windFrame ); + } + + err = (fPrefs -> FindRect ("WindowFrame", &windFrame) ); + if (err == B_OK) + { + ResizeTo(windFrame.Width(), windFrame.Height() ); // window position and size + MoveTo(windFrame.left, windFrame.top); + } + +} + + +void ContainerWindow :: SetPrefs() +{ + fPrefs -> SetRect ("WindowFrame", Frame() ); +} + + + +void ContainerWindow :: EnableRemoveButton(bool enable) +{ + fRemoveButton -> SetEnabled(enable); +} + + +void ContainerWindow :: EnableTestButton(bool enable) +{ + fTestButton -> SetEnabled(enable); +} + + diff --git a/src/tests/kits/interface/bshelf/Container/ContainerWindow.h b/src/tests/kits/interface/bshelf/Container/ContainerWindow.h new file mode 100644 index 0000000000..50a735a66b --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/ContainerWindow.h @@ -0,0 +1,48 @@ +// ContainerWindow.h +// Generated by Interface Elements (Window v2.3) on Feb 14 2004 +// This is a user written class and will not be overwritten. + +#ifndef _CONTAINERWINDOW_H_ +#define _CONTAINERWINDOW_H_ + +#include "IEWindow.h" +#include "ContainerWindowDefs.h" +#include "TPreferences.h" + +#include +#include +#include +#include + +#define CLEAR_FILE 'clfM' +#define TEST_REPLICANT 'terM' + + +class ContainerWindow : public IEWindow +{ + public: + ContainerWindow(BPositionIO *stream); + ~ContainerWindow(void); + + virtual void MessageReceived(BMessage *message); + virtual bool QuitRequested(); + virtual void MenusBeginning(); + void EnableRemoveButton(bool enable); + void EnableTestButton(bool enable); + + private: + BBox *fMainView; + BShelf *fShelf; + BPositionIO *fArchiveStream; + BView *fContainerView; + BButton *fRemoveButton; + BButton *fTestButton; + TPreferences *fPrefs; + + + void CreateViewBitmap(); + void GetPrefs(); + void SetPrefs(); +}; + +#endif diff --git a/src/tests/kits/interface/bshelf/Container/ContainerWindowDefs.h b/src/tests/kits/interface/bshelf/Container/ContainerWindowDefs.h new file mode 100644 index 0000000000..73fa41f487 --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/ContainerWindowDefs.h @@ -0,0 +1,35 @@ +// ContainerWindowDefs.h +// Generated by Interface Elements (Window v2.3) on Mar 14 2004 +// Do not modify this file! + + + +/* + +Views in ContainerWindow: + "MainMenu" (BMenuBar) + "MainView" (BView) + "MainBox" (BBox) + "ContainerView" (BView) + "TestButton" (BButton) + "RemoveButton" (BButton) + +*/ + + +// Message constants: +enum { + IE_CONTAINERWINDOW_MAINMENU_FILE_NEW = 0x1L, + IE_CONTAINERWINDOW_MAINMENU_FILE_OPEN___ = 0x2L, + IE_CONTAINERWINDOW_MAINMENU_FILE_SAVE = 0x3L, + IE_CONTAINERWINDOW_MAINMENU_FILE_SAVE_AS___ = 0x4L, + IE_CONTAINERWINDOW_MAINMENU_FILE_ABOUT___ = 0x5L, + IE_CONTAINERWINDOW_MAINMENU_FILE_QUIT = 0x6L, + IE_CONTAINERWINDOW_MAINMENU_EDIT_UNDO = 0x7L, + IE_CONTAINERWINDOW_MAINMENU_EDIT_CUT = 0x8L, + IE_CONTAINERWINDOW_MAINMENU_EDIT_COPY = 0x9L, + IE_CONTAINERWINDOW_MAINMENU_EDIT_PASTE = 0xAL, + IE_CONTAINERWINDOW_TESTBUTTON = 0x49L, + IE_CONTAINERWINDOW_REMOVEBUTTON = 0xCL +}; + diff --git a/src/tests/kits/interface/bshelf/Container/LICENSE b/src/tests/kits/interface/bshelf/Container/LICENSE new file mode 100644 index 0000000000..86a4268fa9 --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/LICENSE @@ -0,0 +1,31 @@ +---------------------- +Be Sample Code License +---------------------- + +Copyright 1991-1999, Be Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/tests/kits/interface/bshelf/Container/TPreferences.cpp b/src/tests/kits/interface/bshelf/Container/TPreferences.cpp new file mode 100644 index 0000000000..d50dd44c28 --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/TPreferences.cpp @@ -0,0 +1,198 @@ +// +// TPreferences +// +// Class for saving and loading preference information +// via BMessages. +// +// Eric Shepherd +// + +/* + Copyright 1999, Be Incorporated. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. + + Modified by H. Reh Dec. 2001 +*/ + +#include +#include +#include +#include + +#include "TPreferences.h" + + +// +// TPreferences::TPreferences +// +// Open the settings file and read the data in. +// +TPreferences::TPreferences(char *filename) : BMessage('pref') +// TPreferences inherited from BMessage , 'pref' = Message-constant +{ + BFile file; + + status = find_directory(B_COMMON_SETTINGS_DIRECTORY, &path); + if (status != B_OK) + { + return; + } + + path.Append(filename); + + path.GetParent(&parent); + create_directory(parent.Path(), 0777); + parent.Unset(); + + status = file.SetTo(path.Path(), B_READ_ONLY); + if (status == B_OK) + { + status = Unflatten(&file); + // Unflatten is calling Read() + } +} + + +// +// TPreferences::~TPreferences +// +// Write the preferences to disk. +// +TPreferences::~TPreferences() +{ + BFile file; + + if (file.SetTo(path.Path(), B_WRITE_ONLY | B_CREATE_FILE) == B_OK) + { + Flatten(&file); + // Flatten is calling Write() + } +} + + +status_t TPreferences::SetBool(const char *name, bool b) +{ + if (HasBool(name)) + { + return ReplaceBool(name, 0, b); + } + return AddBool(name, b); +} + +status_t TPreferences::SetInt8(const char *name, int8 i) +{ + if (HasInt8(name)) + { + return ReplaceInt8(name, 0, i); + } + return AddInt8(name, i); +} + +status_t TPreferences::SetInt16(const char *name, int16 i) +{ + if (HasInt16(name)) + { + return ReplaceInt16(name, 0, i); + } + return AddInt16(name, i); +} + +status_t TPreferences::SetInt32(const char *name, int32 i) +{ + if (HasInt32(name)) + { + return ReplaceInt32(name, 0, i); + } + return AddInt32(name, i); +} + +status_t TPreferences::SetInt64(const char *name, int64 i) +{ + if (HasInt64(name)) + { + return ReplaceInt64(name, 0, i); + } + return AddInt64(name, i); +} + +status_t TPreferences::SetFloat(const char *name, float f) +{ + if (HasFloat(name)) + { + return ReplaceFloat(name, 0, f); + } + return AddFloat(name, f); +} + +status_t TPreferences::SetDouble(const char *name, double f) +{ + if (HasDouble(name)) + { + return ReplaceDouble(name, 0, f); + } + return AddDouble(name, f); +} + +status_t TPreferences::SetString(const char *name, const char *s) +{ + if (HasString(name)) + { + return ReplaceString(name, 0, s); + } + return AddString(name, s); +} + +status_t TPreferences::SetPoint(const char *name, BPoint p) +{ + if (HasPoint(name)) + { + return ReplacePoint(name, 0, p); + } + return AddPoint(name, p); +} + +status_t TPreferences::SetRect(const char *name, BRect r) +{ + if (HasRect(name)) + { + return ReplaceRect(name, 0, r); + } + return AddRect(name, r); +} + +status_t TPreferences::SetMessage(const char *name, const BMessage *message) +{ + if (HasMessage(name)) + { + return ReplaceMessage(name, 0, message); + } + return AddMessage(name, message); +} + +status_t TPreferences::SetFlat(const char *name, const BFlattenable *obj) +{ + if (HasFlat(name, obj)) + { + return ReplaceFlat(name, 0, (BFlattenable *) obj); + } + return AddFlat(name, (BFlattenable *) obj); +} + +status_t TPreferences::SetData(const char *name, type_code type,const void *data, ssize_t numBytes) +{ + if (HasData(name, type)) + { + return ReplaceData(name, type, 0, data, numBytes); + } + return AddData(name, type, data, numBytes); +} + +status_t TPreferences::SetRef(const char *name, entry_ref *ref) +{ + if (HasRef(name)) + { + return ReplaceRef(name, 0, ref); + } + return AddRef(name, ref); +} + diff --git a/src/tests/kits/interface/bshelf/Container/TPreferences.h b/src/tests/kits/interface/bshelf/Container/TPreferences.h new file mode 100644 index 0000000000..533cf98352 --- /dev/null +++ b/src/tests/kits/interface/bshelf/Container/TPreferences.h @@ -0,0 +1,57 @@ +// +// TPreferences +// Using BMessages to save user settings. +// +// Eric Shepherd +// +/* + Copyright 1999, Be Incorporated. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. + + Modified by H. Reh "SetData" added - Dec. 2001 + "SetRef" added - Dec. 2003 +*/ + +#ifndef __TPREFS_H__ +#define __TPREFS_H__ + +#include +#include +#include + +class _EXPORT TPreferences : public BMessage +{ + public: + TPreferences(char *filename); + ~TPreferences(); + + + status_t InitCheck(void); + + status_t SetBool(const char *name, bool b); + status_t SetInt8(const char *name, int8 i); + status_t SetInt16(const char *name, int16 i); + status_t SetInt32(const char *name, int32 i); + status_t SetInt64(const char *name, int64 i); + status_t SetFloat(const char *name, float f); + status_t SetDouble(const char *name, double d); + status_t SetString(const char *name, const char *string); + status_t SetPoint(const char *name, BPoint p); + status_t SetRect(const char *name, BRect r); + status_t SetMessage(const char *name, const BMessage *message); + status_t SetFlat(const char *name, const BFlattenable *obj); + status_t SetData(const char *name, type_code type, const void *data, ssize_t numBytes); + status_t SetRef(const char *name, entry_ref *ref); + + private: + BPath path; + BPath parent; + status_t status; +}; + +inline status_t TPreferences::InitCheck(void) +{ + return status; +} + +#endif diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/App.rdef b/src/tests/kits/interface/bshelf/ShelfInspector/App.rdef new file mode 100644 index 0000000000..981ca33fd9 --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/App.rdef @@ -0,0 +1,74 @@ + +resource app_flags B_SINGLE_LAUNCH; + +resource app_version { + major = 0, + middle = 0, + minor = 0, + + variety = B_APPV_DEVELOPMENT, + internal = 0, + + short_info = "Shelf Inspector for Replicants", + long_info = #'CSTR' array { + + } +}; + +resource large_icon array { + $"FFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFF0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFF000000170E000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFF0000171D0A0E001D1D000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FF0000000E0A170E000A1D1D00000000000000000000000000000000000000FF" + $"00000000000E0E0002080A170400000000000000000000000000000000000000" + $"0000FE00000002040A020404040000FEFEFEFE62626262626262626262840000" + $"0000FE0000171D020202040A0A00008484848484848484848484848484D10000" + $"00006200000E0A0A040A11110A0000D1D1D1D1D1D1D1D1D1D1D1D16284D10000" + $"0000628400000E170A0E1711000000A5A5ABA55CA5AB84A5A5ABA56284D10000" + $"00006284000000170A0A0E00000089ABABA584A585A5A5ABAB5CD76284D10000" + $"00006284D100000000000000000000A5A55C835C845CAB84A5855C6284D10000" + $"00006284D1ABAB00000000ABA50000D7D1835CA5AB5CA5A5ABA5AB6284D10000" + $"00006284D1A585A583ABAB845C833333D1B1855DABAB855C5C5DA56284D10000" + $"00006284D1ABA5ABA583A55CABABD1D1D1D1B184ABA583A584A5846284D10000" + $"00006284D1AB5C83AB5C89A5A5ABB1D1D7CBABA5AB83ABABA5ABAB6284D10000" + $"00006284D15C84ABABA5858483ABA5B1B1A5A5A55C5C5CABA55C846284D10000" + $"00006284D184ABA55CAB5CABA5835CABAB5CAB855C84A583ABA5A56284D10000" + $"00006284D1A5AB8384A5AB85ABAB855C5CA5ABABA5A585ABA55CA56284D10000" + $"00006284D1A5A5A583AB855CA5ABA5A5A5AB5C8383AB84A583A5846284D10000" + $"00006284D183AB84A5D783A589845CABAB83A5855DA5A584A5A5856284D10000" + $"00006284D183A5835CABA584ABABA5838383ABA5A55CABABA5ABAB6284D10000" + $"00006284D1A5ABAB5CA5ABABA55D855C5CA584A55C5CAB89ABAB5C6284D10000" + $"00006284D15CA585835C85A5AB5CABA5A583A5A55CABA5A55CA5846284D10000" + $"00006284D1AB83AB83ABA5845CA5A5ABABA5AB84A5D785AB5D84A56284D10000" + $"00006284D1A58484ABAB84A5A55CAB5C5C84A5845CA5A584A55C856284D10000" + $"00006284D184A5ABA5845C84A5AB5DABAB5CA584AB845DAB84A5D76284D10000" + $"000062848462626262626262626262626262626262626262626262FE84D10000" + $"0000628484848484848484848484848484848484848484848484848484D10000" + $"000084D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D10000" + $"0000000000000000000000000000000000000000000000000000000000000000" + $"FF000000000000000000000000000000000000000000000000000000000000FF" +}; + +resource mini_icon array { + $"FFFF0000FFFFFFFFFFFFFFFFFFFFFFFF" + $"FF00000E000000FFFFFFFFFFFFFFFFFF" + $"FF000E17001D00000000000000000000" + $"00FE00020A040400FEFE626262626200" + $"0062000A04110A00D1D1D1D1D1D18400" + $"006200000A0E0089AB8485A5ABD78400" + $"0062D1AB0000A500D15CABA5ABAB8400" + $"0062D1A5A5A5ABD1D1B1AB8384848400" + $"0062D184AB8583A5B1A55C5CA5848400" + $"0062D1AB84ABAB855CABA585A5A58400" + $"0062D1ABA583895CABA55DA5A5858400" + $"0062D1AB5CABA5855C845CABAB5C8400" + $"0062D18383A55CA5ABABA5855DA58400" + $"0062D1A5A55CA55DABA5AB5D84D78400" + $"00628484848484848484848484848400" + $"00000000000000000000000000000000" +}; + +resource app_signature "application/x-vnd.reh-XShelfInspector"; + +resource file_types message; diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/InfoApplication.cpp b/src/tests/kits/interface/bshelf/ShelfInspector/InfoApplication.cpp new file mode 100644 index 0000000000..615d797eb5 --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/InfoApplication.cpp @@ -0,0 +1,73 @@ +// InfoApplication.cpp + + + +#include "InfoApplication.h" + +const char *XCONTAINER_APP = "application/x-vnd.reh-XContainer"; + + +#define CMD_UPDATE_CONTAINER_ITEM 'updC' + + +InfoApplication :: InfoApplication() + : IEApplication("application/x-vnd.reh-XShelfInspector") +{ + // instantiate a new window + fLaunched = true; + fInfoWindow = new InfoWindow(); +} + +InfoApplication :: ~InfoApplication() +{ + be_roster -> StopWatching(fMsgnr); +} + + +void InfoApplication :: MessageReceived(BMessage *msg) +{ + switch (msg->what) + { + case B_SOME_APP_QUIT: + case B_SOME_APP_ACTIVATED: + case B_SOME_APP_LAUNCHED: + { + if ( (be_roster -> IsRunning(XCONTAINER_APP)) == false ) + { + be_roster->Launch(XCONTAINER_APP); // Launch the XContainer + + if (fLaunched == true) + { + fInfoWindow -> GetPrefs(); + fInfoWindow -> Show(); + fLaunched = false; + break; + } + BMessenger messenger; + BMessage msg(CMD_UPDATE_CONTAINER_ITEM); // Update XContainer + messenger = BMessenger(fInfoWindow); + messenger.SendMessage(&msg); + } + } + break; + + default: + BApplication :: MessageReceived(msg); + break; + } +} + +void InfoApplication::ReadyToRun() +{ + fMsgnr = BMessenger(this); + be_roster -> StartWatching(fMsgnr); + PostMessage(B_SOME_APP_LAUNCHED); +} + + +int main() +{ + InfoApplication infoApplication; + infoApplication.Run(); + return(0); +} diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/InfoApplication.h b/src/tests/kits/interface/bshelf/ShelfInspector/InfoApplication.h new file mode 100644 index 0000000000..e34a3958f9 --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/InfoApplication.h @@ -0,0 +1,31 @@ +// TheApplication.h + + + +#if !defined(THE_APPLICATION_H) +#define THE_APPLICATION_H + + +#include "IEApplication.h" +#include "InfoWindow.h" +#include + + +IEResourceHandler *resourcehandler; + +class InfoApplication : public IEApplication +{ + public: + InfoApplication(); + ~InfoApplication(); + + virtual void MessageReceived(BMessage *msg); + virtual void ReadyToRun(void); + + private: + BMessenger fMsgnr; + InfoWindow *fInfoWindow; + bool fLaunched; +}; + +#endif diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/InfoWindow.cpp b/src/tests/kits/interface/bshelf/ShelfInspector/InfoWindow.cpp new file mode 100644 index 0000000000..2ebc5ce21d --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/InfoWindow.cpp @@ -0,0 +1,694 @@ +// InfoWindow.cpp +// Generated by Interface Elements (Window v2.3) on Feb 23 2004 +// This is a user written class and will not be overwritten. + +#include +#include +#include +#include +#include +#include +#include + +#include "InfoWindow.h" + +// A couple helpers classes and functions. + +struct IDItem : public BStringItem +{ + IDItem(const char *name, int32 i); + int32 id; +}; + +/*------------------------------------------------------------*/ +struct match_info +{ + match_info(image_id i) { id = i; found = false; }; + image_id id; + bool found; +}; + + +bool match_id(BListItem *item, void *data) +{ + match_info *mi = (match_info *) (data); + IDItem *my = dynamic_cast(item); + if (my->id == (mi)->id) + { + (mi)->found = true; + return true; + } + return false; +} + + +IDItem :: IDItem(const char *name, int32 i) + : BStringItem(name) +{ + id = i; +}; + + + +InfoWindow :: InfoWindow(void) + : IEWindow("InfoWindow"), + fTickToken( BMessenger(this), new BMessage(CMD_TICK), 500000 ), // send message periodically + fImportLoc(10,15) // position of imported replicant +{ + Lock(); + CreateViews(); + Unlock(); +} + + +InfoWindow::~InfoWindow(void) +{ + SetPrefs(); + if (fPrefs != NULL) delete fPrefs; // now prefs are saved +} + + +bool InfoWindow :: QuitRequested() +{ + long c = be_app->CountWindows(); + + if (c == 1) + { + be_app->PostMessage(B_QUIT_REQUESTED); + } + return true; +} + + +// Handling of user interface and other events +void InfoWindow::MessageReceived(BMessage *msg) +{ + + switch(msg->what) + { + case CMD_UPDATE_CONTAINER_ITEM: + { + BMenu *theMenu =(BMenu *)(fMenuField -> Menu()); + BMenuItem *theItem = theMenu -> FindItem(IE_POPUPMENU_TARGETPOPUP_XCONTAINER_WINDOW); + theItem -> SetMarked(true); + PostMessage(IE_POPUPMENU_TARGETPOPUP_XCONTAINER_WINDOW); + } + break; + + case CMD_TICK: + { + UpdateLists(false); + break; + } + + case IE_INFOWINDOW_DELETEBUTTON: // 'DeleteButton' is pressed... + { + int32 sel = fReplicantList->CurrentSelection(); + IDItem *item = dynamic_cast(fReplicantList->ItemAt(sel)); + ASSERT(sel >= 0); + ASSERT(item); + DeleteReplicant(item->id); + } + break; + + + + case IE_INFOWINDOW_COPYBUTTON: // 'CopyButton' is pressed... + { + BAlert *alert = new BAlert("", + "Warning, not all replicants are importable. Importing a " + "replicant can crash the Container Demo application. Are you " + "willing to give it a try?", "Cancel", "Import", NULL, + B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); + BInvoker *inv = new BInvoker(new BMessage(CMD_IMPORT_REPLICANT),this); + alert->Go(inv); + } + break; + + + case CMD_IMPORT_REPLICANT: + { + // This message was posted by the Alert above. If 'which' is 1 then + // the user pressed the Import button. Otherwise they pressed Cancel. + int32 r = msg->FindInt32("which"); + if (r == 1) + { + int32 sel = fReplicantList->CurrentSelection(); + IDItem *item = dynamic_cast(fReplicantList->ItemAt(sel)); + ASSERT(sel >= 0); + ASSERT(item); + ImportReplicant(item->id); + } + } + break; + + + case IE_INFOWINDOW_REPLICANTLIST_SELECTION: // list item is selected in 'ReplicantList' + { + bool enabled; + enabled = (fReplicantList->CurrentSelection() >= 0); + fDeleteRep->SetEnabled(enabled); + fCopyRep -> SetEnabled(enabled); + } + break; + + case IE_INFOWINDOW_REPLICANTLIST_INVOCATION: // list item is invoked in 'ReplicantList' + break; + + + + case IE_INFOWINDOW_LIBRARYLIST_SELECTION: // list item is selected in 'LibraryList' + { + bool enabled; + enabled = (fLibraryList->CurrentSelection() >= 0); + fUnloadLib->SetEnabled(enabled); + } + break; + + case IE_INFOWINDOW_LIBRARYLIST_INVOCATION: // list item is invoked in 'LibraryList' + break; + + case IE_INFOWINDOW_UNLOADBUTTON: // 'UnloadButton' is pressed... + { + BAlert *alert = new BAlert("", + "Warning, unloading a library that is still in use is pretty bad. " + "Are you sure you want to unload this library?", + "Cancel", "Unload", NULL, + B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); + BInvoker *inv = new BInvoker(new BMessage(CMD_UNLOAD_LIBRARY),this); + alert->Go(inv); + } + break; + + case CMD_UNLOAD_LIBRARY: + { + // This message was posted by the Alert above. If 'which' is 1 then + // the user pressed the Import button. Otherwise they pressed Cancel. + int32 r = msg->FindInt32("which"); + if (r == 1) + { + int32 sel = fLibraryList->CurrentSelection(); + IDItem *item = dynamic_cast(fLibraryList->ItemAt(sel)); + ASSERT(sel >= 0); + ASSERT(item); + unload_add_on(item->id); + } + break; + } + + case IE_POPUPMENU_TARGETPOPUP_XCONTAINER_WINDOW: + case IE_POPUPMENU_TARGETPOPUP_DESKBAR: + case IE_POPUPMENU_TARGETPOPUP_DESKTOP_WINDOW: + { + fTarget = MessengerForTarget(msg->what); + UpdateLists(true); + } + break; + + case IE_INFOWINDOW_MAINBAR_FILE_NEW: // "New" is selected from menu… + break; + + case IE_INFOWINDOW_MAINBAR_FILE_OPEN___: // "Open…" is selected from menu… + break; + + case IE_INFOWINDOW_MAINBAR_FILE_SAVE: // "Save" is selected from menu… + break; + + case IE_INFOWINDOW_MAINBAR_FILE_SAVE_AS___: // "Save As…" is selected from menu… + break; + + case IE_INFOWINDOW_MAINBAR_FILE_ABOUT___: // "About…" is selected from menu… + PostMessage(B_ABOUT_REQUESTED); + break; + + case IE_INFOWINDOW_MAINBAR_FILE_QUIT: // "Quit" is selected from menu… + PostMessage(B_QUIT_REQUESTED); + break; + + case IE_INFOWINDOW_MAINBAR_EDIT_UNDO: // "Undo" is selected from menu… + break; + + case IE_INFOWINDOW_MAINBAR_EDIT_CUT: // "Cut" is selected from menu… + break; + + case IE_INFOWINDOW_MAINBAR_EDIT_COPY: // "Copy" is selected from menu… + break; + + case IE_INFOWINDOW_MAINBAR_EDIT_PASTE: // "Paste" is selected from menu… + break; + + + case B_ABOUT_REQUESTED: + { + BAlert *alert = new BAlert("", "XShelfInspector (H.Reh, dr.hartmut.reh@gmx.de) " "\n" "\n" + "Based upon ShelfInspector from Be Inc." "\n" + "The GUI was created with InterfaceElements (Attila Mezei)" "\n" + "Please read the ***Be Sample Code License*** " "\n" + ,"OK"); + alert -> Go(NULL); + } + break; + + + default: + inherited::MessageReceived(msg); + break; + } + +} + + +void InfoWindow :: EmptyLists() +{ + fReplicantList -> MakeEmpty(); + fLibraryList -> MakeEmpty(); +} + + +void InfoWindow::UpdateLists(bool make_empty) +{ + bool deleted_something = false; + + if (!fTarget.IsValid()) + { + EmptyLists(); + PostMessage(IE_INFOWINDOW_REPLICANTLIST_SELECTION); + PostMessage(IE_INFOWINDOW_LIBRARYLIST_SELECTION); + return; + } + if (make_empty) + { + EmptyLists(); + deleted_something = true; + } + + /* + I'm not worried about the allgorithms used below to maintain the 2 lists. + That isn't the point of this sample app. + */ + + image_info info; + + if (!make_empty) + { + // walk through the current list of images and remove any that are + // no longer loaded + IDItem *item; + int32 i = fLibraryList->CountItems(); + while ((item = dynamic_cast(fLibraryList->ItemAt(--i))) != NULL) + { + image_id id = (image_id) item->id; + if (get_image_info(id, &info) != B_OK) + { + fLibraryList->RemoveItem(item); + delete item; + deleted_something = true; + } + } + } + + // get all the images for the 'team' of the target. If the image isn't in the + // list then add + team_id team = fTarget.Team(); + int32 cookie = 0; + + while (get_next_image_info(team, &cookie, &info) == B_OK) + { + match_info mi(info.id); + fLibraryList->DoForEach(match_id, &mi); + if (!mi.found) + { + fLibraryList->AddItem(new IDItem(info.name, info.id)); + } + } + + // Now it's time to deal with the replicant list + + if (!make_empty) + { + // walk through the current list of replicants and remove any that are + // no longer loaded + IDItem *item; + int32 i = fReplicantList->CountItems(); + while ((item = dynamic_cast(fReplicantList->ItemAt(--i))) != NULL) + { + int32 uid = item->id; + if (IsReplicantLoaded(uid) == false) + { + fReplicantList->RemoveItem(item); + delete item; + deleted_something = true; + } + } + } + + // Now get all the replicants from the shelf and make sure that they are in + // the list + int32 index = 0; + int32 uid; + while ((uid = GetReplicantAt(index++)) >= B_OK) + { + // if this uid is already in the list then skip it + match_info mi(uid); + fReplicantList->DoForEach(match_id, &mi); + if (mi.found) + { + continue; + } + + BMessage rep_info; + if (GetReplicantName(uid, &rep_info) != B_OK) + { + continue; + } + + const char *name; + if (rep_info.FindString("result", &name) == B_OK) + { + fReplicantList->AddItem(new IDItem(name, uid)); + } + } + + + if (deleted_something) + { + PostMessage(IE_INFOWINDOW_REPLICANTLIST_SELECTION); + PostMessage(IE_INFOWINDOW_LIBRARYLIST_SELECTION); + } +} + + + +status_t InfoWindow :: GetReplicantName(int32 uid, BMessage *reply) const +{ + /* + We send a message to the target shelf, asking it for the Name of the + replicant with the given unique id. + */ + + BMessage request(B_GET_PROPERTY); + BMessage uid_specifier(B_ID_SPECIFIER); // specifying via ID + status_t err; + status_t e; + + request.AddSpecifier("Name"); // ask for the Name of the replicant + + // IDs are specified using code like the following 3 lines: + uid_specifier.AddInt32("id", uid); + uid_specifier.AddString("property", "Replicant"); + request.AddSpecifier(&uid_specifier); + + if ((err = fTarget.SendMessage(&request, reply)) != B_OK) + return err; + + if (((err = reply->FindInt32("error", &e)) != B_OK) || (e != B_OK)) + return err ? err : e; + + return B_OK; +} + +bool InfoWindow :: IsReplicantLoaded(int32 uid) const +{ + /* + determine if the specified replicant (the unique ID of the replicant) + still exists in the target container/shelf. If we can get the name then the + replicant still exists. + */ + BMessage reply; + status_t err = GetReplicantName(uid, &reply); + return (err == B_OK); +} + + +int32 InfoWindow::GetReplicantAt(int32 index) const +{ + /* + So here we want to get the Unique ID of the replicant at the given index + in the target Shelf. + */ + + BMessage request(B_GET_PROPERTY); // We're getting the ID property + BMessage reply; + status_t err; + + request.AddSpecifier("ID"); // want the ID + request.AddSpecifier("Replicant", index); // of the index'th replicant + + if ((err = fTarget.SendMessage(&request, &reply)) != B_OK) + return err; + + int32 uid; + if ((err = reply.FindInt32("result", &uid)) != B_OK) + return err; + + return uid; +} + + +BMessenger InfoWindow :: MessengerForTarget(type_code w) const +{ + /* + This function determines the BMessenger to the various Shelf objects + that this app can talk with. + */ + BMessage request(B_GET_PROPERTY); + BMessenger to; + BMessenger result; + + request.AddSpecifier("Messenger"); + request.AddSpecifier("Shelf"); + + switch (w) + { + case IE_POPUPMENU_TARGETPOPUP_DESKBAR: + { + request.AddSpecifier("View", "Status"); + request.AddSpecifier("Window", "Deskbar"); + to = BMessenger("application/x-vnd.Be-TSKB", -1); + break; + } + + case IE_POPUPMENU_TARGETPOPUP_DESKTOP_WINDOW: + { + // The Desktop is owned by Tracker and the Shelf is in the + // View "PoseView" in Window "Desktop" + request.AddSpecifier("View", "PoseView"); + request.AddSpecifier("Window", "/boot/home/Desktop"); + to = BMessenger("application/x-vnd.Be-TRAK", -1); + break; + } + + case IE_POPUPMENU_TARGETPOPUP_XCONTAINER_WINDOW: + { + // In the COntainer Demo app the View "MainView" in the only window + // is the Shelf. + request.AddSpecifier("View", "ContainerView"); // Hier werden Replikanten abgelegt + request.AddSpecifier("Window", (int32) 0); + to = BMessenger(XCONTAINER_APP, -1); + // This demo app isn't worried about the Container app going away + // (quitting) unexpectedly. + break; + } + } + + BMessage reply; + + if (to.SendMessage(&request, &reply) == B_OK) + { + //reply.PrintToStream(); + reply.FindMessenger("result", &result); + } + return result; +} + + +status_t InfoWindow :: DeleteReplicant(int32 uid) +{ + // delete the given replicant from the current target shelf + + BMessage request(B_DELETE_PROPERTY); // Delete + BMessage uid_specifier(B_ID_SPECIFIER); // specifying via ID + BMessage reply; + status_t err; + status_t e; + + // IDs are specified using code like the following 3 lines: + uid_specifier.AddInt32("id", uid); + uid_specifier.AddString("property", "Replicant"); + request.AddSpecifier(&uid_specifier); + + if ((err = fTarget.SendMessage(&request, &reply)) != B_OK) + return err; + + if ((err = reply.FindInt32("error", &e)) != B_OK) + return err; + + return e; +} + + +status_t InfoWindow :: ImportReplicant(int32 uid) +{ + // Import the given replicant from the current target shelf + // That is get a copy and recreate it in the "Container" window of + // this app. + + BMessage request(B_GET_PROPERTY); // Get will return the archive msg + BMessage uid_specifier(B_ID_SPECIFIER); // specifying via ID + BMessage reply; + status_t err; + status_t e; + + // IDs are specified using code like the following 3 lines: + uid_specifier.AddInt32("id", uid); + uid_specifier.AddString("property", "Replicant"); + request.AddSpecifier(&uid_specifier); + + if ((err = fTarget.SendMessage(&request, &reply)) != B_OK) + return err; + + if (((err = reply.FindInt32("error", &e)) != B_OK) || (e != B_OK)) + return err; + + // OK, let's get the archive message + BMessage data; + reply.FindMessage("result", &data); + + // Now send this to the container window. If someone closed it then the + // Send will fail. Oh well. + BMessenger mess = MessengerForTarget(IE_POPUPMENU_TARGETPOPUP_XCONTAINER_WINDOW); + BMessage msg(B_CREATE_PROPERTY); + + msg.AddMessage("data", &data); + + // As this is a Demo I'm not going to worry about some fancy layout + // algorithm. Just keep placing new replicants going down the window + msg.AddPoint("location", fImportLoc); + fImportLoc.y += 40; + + return mess.SendMessage(&msg, &reply); +} + + + +// Update the menu items before they appear on screen +void InfoWindow::MenusBeginning() +{ + // Complete the SetEnabled argument or do anything with the source below... + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_FILE_NEW)->SetEnabled(false); // "New" + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_FILE_OPEN___)->SetEnabled(false); // "Open…" + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_FILE_SAVE)->SetEnabled(false); // "Save" + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_FILE_SAVE_AS___)->SetEnabled(false); // "Save As…" + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_FILE_ABOUT___)->SetEnabled(true); // "About…" + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_FILE_QUIT)->SetEnabled(true); // "Quit" + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_EDIT_UNDO)->SetEnabled(false); // "Undo" + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_EDIT_CUT)->SetEnabled(false); // "Cut" + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_EDIT_COPY)->SetEnabled(false); // "Copy" + KeyMenuBar()->FindItem(IE_INFOWINDOW_MAINBAR_EDIT_PASTE)->SetEnabled(false); // "Paste" +} + + + + +BMessage *InfoWindow :: ReadMessageFromResource(const char *resName) +{ + // Hier wird aus der Resource die Message gelesen + app_info ai; + BFile file; + BResources res; + size_t res_size; + const void* res_addr; + + BMessage* archive = new BMessage; + + if( (be_app->GetAppInfo(&ai) != B_OK) + ||(file.SetTo(&ai.ref,B_READ_ONLY) != B_OK) + ||(res.SetTo(&file) != B_OK) + ||((res_addr = res.LoadResource('ARCV',resName,&res_size)) == NULL) + ||(archive -> Unflatten((const char*)res_addr) != B_OK) ) + // Resource muss 'ARCV' - Typ sein -> in IE einstellen + // Resource of type 'ARCV' + { + delete archive; + return NULL; + } + return archive; +} + + +void InfoWindow:: CreateViews() +{ + BMessage *archive = ReadMessageFromResource("PopUpMenu"); // Menu Feld from Resource + if (archive) + { + fMenuField = new BMenuField(archive); + delete archive; + } + + fMainBox = (BBox *)FindView("MainBox"); // Pointer to MainBox + fMainBox->SetLabel(fMenuField); // Replace Label + + fReplicantList = (BListView *) FindView("ReplicantList"); + fLibraryList = (BListView *) FindView("LibraryList"); + + fDeleteRep = (BButton *) FindView("DeleteButton"); + fCopyRep = (BButton *) FindView("CopyButton"); + fUnloadLib = (BButton *) FindView("UnloadButton"); + + BScrollView *libScrollView = (BScrollView *)FindView("LibraryScroll"); + BScrollBar *horLibScrollBar = libScrollView -> ScrollBar(B_HORIZONTAL); + horLibScrollBar -> SetRange(0, 400); + horLibScrollBar -> SetProportion(0.4); + + BScrollView *repScrollView = (BScrollView *)FindView("ReplicantScroll"); + BScrollBar *horRepScrollBar = repScrollView -> ScrollBar(B_HORIZONTAL); + horRepScrollBar -> SetRange(0, 400); + horRepScrollBar -> SetProportion(0.4); +} + + +void InfoWindow :: GetPrefs() +{ + status_t err; + BRect windFrame; + int32 targetShelf; + + fPrefs = new TPreferences ("XShelfInspector/preferences"); // Name des Prefs-Files + if (fPrefs -> InitCheck() != B_OK) // falls keine Prefs -> erzeugen + { + windFrame = Frame(); // Window Frame aus Resource ermitteln + fPrefs -> SetRect ("WindowFrame", windFrame ); + + targetShelf = IE_POPUPMENU_TARGETPOPUP_XCONTAINER_WINDOW; // XContainerWindow + fPrefs -> SetInt32 ("TargetShelf", targetShelf ); + } + + err = (fPrefs -> FindRect ("WindowFrame", &windFrame) ); + if (err == B_OK) + { + ResizeTo(windFrame.Width(), windFrame.Height() ); // Fensterposition und Größe + MoveTo(windFrame.left, windFrame.top); // aus Preferences + } + + err = (fPrefs -> FindInt32 ("TargetShelf", &targetShelf ) ); + if (err == B_OK) + { + BMenu *theMenu =(BMenu *)(fMenuField -> Menu()); + BMenuItem *theItem = theMenu -> FindItem(targetShelf); + theItem -> SetMarked(true); + PostMessage(targetShelf); // TargetShelf + } +} + + +void InfoWindow :: SetPrefs() +{ + fPrefs -> SetRect ("WindowFrame", Frame() ); + + BMenu *theMenu =(BMenu *)(fMenuField -> Menu()); + BMenuItem *theItem = theMenu -> FindMarked(); + int32 targetShelf = theItem -> Command(); + fPrefs -> SetInt32("TargetShelf", targetShelf); +} + + diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/InfoWindow.h b/src/tests/kits/interface/bshelf/ShelfInspector/InfoWindow.h new file mode 100644 index 0000000000..7fd7606f2c --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/InfoWindow.h @@ -0,0 +1,71 @@ +// InfoWindow.h +// Generated by Interface Elements (Window v2.3) on Feb 23 2004 +// This is a user written class and will not be overwritten. + +#ifndef _INFOWINDOW_H_ +#define _INFOWINDOW_H_ + +#include "IEWindow.h" +#include "InfoWindowDefs.h" +#include "PopUpMenuDefs.h" +#include "TPreferences.h" + +extern const char *XCONTAINER_APP; + +enum +{ + CMD_UPDATE_CONTAINER_ITEM = 'updC', + CMD_UNLOAD_LIBRARY = 'unld', + CMD_IMPORT_REPLICANT = 'dupr', + CMD_TICK = 'tick', +}; + + +class InfoWindow : public IEWindow +{ + public: + InfoWindow(void); + ~InfoWindow(void); + + virtual void MessageReceived(BMessage *message); + virtual bool QuitRequested(); + virtual void MenusBeginning(); + + void GetPrefs(); + void SetPrefs(); + + private: + // These are the interesting functions showing how you can + // interact via BMessages with a Shelf/Container view + BMessenger MessengerForTarget(type_code w) const; + int32 GetReplicantAt(int32 index) const; + status_t GetReplicantName(int32 uid, BMessage *result) const; + status_t DeleteReplicant(int32 uid); + status_t ImportReplicant(int32 uid); + + bool IsReplicantLoaded(int32 uid) const; + + void UpdateLists(bool make_empty); + void EmptyLists(); + + BMessenger fTarget; + BMessageRunner fTickToken; + + BPoint fImportLoc; + + BMessage *ReadMessageFromResource(const char *resName); + void CreateViews(); + BMenuField *fMenuField; + BBox *fMainBox; + + BListView *fReplicantList; + BListView *fLibraryList; + + BButton *fDeleteRep; + BButton *fCopyRep; + BButton *fUnloadLib; + + TPreferences *fPrefs; +}; + +#endif diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/InfoWindowDefs.h b/src/tests/kits/interface/bshelf/ShelfInspector/InfoWindowDefs.h new file mode 100644 index 0000000000..92760e8b99 --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/InfoWindowDefs.h @@ -0,0 +1,48 @@ +// InfoWindowDefs.h +// Generated by Interface Elements (Window v2.3) on Feb 24 2004 +// Do not modify this file! + + + +/* + +Views in InfoWindow: + "InfoView" (BView) + "MainBox" (BBox) + (BStringView) + "LibraryScroll" (BScrollView) + "LibraryList" (BListView) + (BStringView) + "UnloadButton" (BButton) + "DeleteButton" (BButton) + "CopyButton" (BButton) + (BView) + "ReplicantScroll" (BScrollView) + "ReplicantList" (BListView) + (BView) + "MainBar" (BMenuBar) + +*/ + + +// Message constants: +enum { + IE_INFOWINDOW_LIBRARYLIST_SELECTION = 0x2BL, + IE_INFOWINDOW_LIBRARYLIST_INVOCATION = 0x2EL, + IE_INFOWINDOW_UNLOADBUTTON = 0x45L, + IE_INFOWINDOW_DELETEBUTTON = 0x9L, + IE_INFOWINDOW_COPYBUTTON = 0xDL, + IE_INFOWINDOW_REPLICANTLIST_SELECTION = 0x74L, + IE_INFOWINDOW_REPLICANTLIST_INVOCATION = 0x77L, + IE_INFOWINDOW_MAINBAR_FILE_NEW = 0x4EL, + IE_INFOWINDOW_MAINBAR_FILE_OPEN___ = 0x4FL, + IE_INFOWINDOW_MAINBAR_FILE_SAVE = 0x50L, + IE_INFOWINDOW_MAINBAR_FILE_SAVE_AS___ = 0x51L, + IE_INFOWINDOW_MAINBAR_FILE_ABOUT___ = 0x52L, + IE_INFOWINDOW_MAINBAR_FILE_QUIT = 0x53L, + IE_INFOWINDOW_MAINBAR_EDIT_UNDO = 0x54L, + IE_INFOWINDOW_MAINBAR_EDIT_CUT = 0x55L, + IE_INFOWINDOW_MAINBAR_EDIT_COPY = 0x56L, + IE_INFOWINDOW_MAINBAR_EDIT_PASTE = 0x57L +}; + diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/LICENSE b/src/tests/kits/interface/bshelf/ShelfInspector/LICENSE new file mode 100644 index 0000000000..86a4268fa9 --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/LICENSE @@ -0,0 +1,31 @@ +---------------------- +Be Sample Code License +---------------------- + +Copyright 1991-1999, Be Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/PopUpMenuDefs.h b/src/tests/kits/interface/bshelf/ShelfInspector/PopUpMenuDefs.h new file mode 100644 index 0000000000..5dfb599865 --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/PopUpMenuDefs.h @@ -0,0 +1,22 @@ +// PopUpMenuDefs.h +// Generated by Interface Elements (View v981016) on Feb 24 2004 +// Do not modify this file! + + + +/* + +Views in PopUpMenu: + "TargetPopUp" (BMenuField) + "_mc_mb_" (_BMCMenuBar_) + +*/ + + +// Message constants: +enum { + IE_POPUPMENU_TARGETPOPUP_XCONTAINER_WINDOW = 0x11L, + IE_POPUPMENU_TARGETPOPUP_DESKBAR = 0x13L, + IE_POPUPMENU_TARGETPOPUP_DESKTOP_WINDOW = 0x15L +}; + diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/TPreferences.cpp b/src/tests/kits/interface/bshelf/ShelfInspector/TPreferences.cpp new file mode 100644 index 0000000000..0902a8e201 --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/TPreferences.cpp @@ -0,0 +1,200 @@ +// +// TPreferences +// +// Class for saving and loading preference information +// via BMessages. +// +// Eric Shepherd +// + +/* + Copyright 1999, Be Incorporated. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. + + Modified by H. Reh Dec. 2001 +*/ + +#include +#include +#include +#include +#include // wieder entfernen + +#include "TPreferences.h" + + +// +// TPreferences::TPreferences +// +// Open the settings file and read the data in. +// +TPreferences::TPreferences(char *filename) : BMessage('pref') +// TPreferences von BMessage ableiten, 'pref' = Message-Konstante +{ + BFile file; + + status = find_directory(B_COMMON_SETTINGS_DIRECTORY, &path); + // B_COMMON_SETTINGS_DIRECTORY = Ordner in dem Settings stehen + if (status != B_OK) + { + return; + } + + path.Append(filename); // Filenamen anhängen + + path.GetParent(&parent); // übergeordnetes Verzeichnis suchen + create_directory(parent.Path(), 0777); // Verzeichnis anlegen + parent.Unset(); // File schließen + + status = file.SetTo(path.Path(), B_READ_ONLY); + if (status == B_OK) + { + status = Unflatten(&file); + // da file eine Datei ist, ruft Unflatten sofort Read() auf + } +} + + +// +// TPreferences::~TPreferences +// +// Write the preferences to disk. +// +TPreferences::~TPreferences() +{ + BFile file; + + if (file.SetTo(path.Path(), B_WRITE_ONLY | B_CREATE_FILE) == B_OK) + { + Flatten(&file); + // da file eine Datei ist, ruft Flatten sofort Write() auf + } +} + + +status_t TPreferences::SetBool(const char *name, bool b) +{ + if (HasBool(name)) // Testen auf Typ bool + { + return ReplaceBool(name, 0, b); // Wenn Variable schon existiert -> überschreiben -> Funktion beenden + } + return AddBool(name, b); // Wenn Variable nicht existiert -> neu anlegen -> Funktion beenden +} + +status_t TPreferences::SetInt8(const char *name, int8 i) +{ + if (HasInt8(name)) + { + return ReplaceInt8(name, 0, i); + } + return AddInt8(name, i); +} + +status_t TPreferences::SetInt16(const char *name, int16 i) +{ + if (HasInt16(name)) + { + return ReplaceInt16(name, 0, i); + } + return AddInt16(name, i); +} + +status_t TPreferences::SetInt32(const char *name, int32 i) +{ + if (HasInt32(name)) + { + return ReplaceInt32(name, 0, i); + } + return AddInt32(name, i); +} + +status_t TPreferences::SetInt64(const char *name, int64 i) +{ + if (HasInt64(name)) + { + return ReplaceInt64(name, 0, i); + } + return AddInt64(name, i); +} + +status_t TPreferences::SetFloat(const char *name, float f) +{ + if (HasFloat(name)) + { + return ReplaceFloat(name, 0, f); + } + return AddFloat(name, f); +} + +status_t TPreferences::SetDouble(const char *name, double f) +{ + if (HasDouble(name)) + { + return ReplaceDouble(name, 0, f); + } + return AddDouble(name, f); +} + +status_t TPreferences::SetString(const char *name, const char *s) +{ + if (HasString(name)) + { + return ReplaceString(name, 0, s); + } + return AddString(name, s); +} + +status_t TPreferences::SetPoint(const char *name, BPoint p) +{ + if (HasPoint(name)) + { + return ReplacePoint(name, 0, p); + } + return AddPoint(name, p); +} + +status_t TPreferences::SetRect(const char *name, BRect r) +{ + if (HasRect(name)) + { + return ReplaceRect(name, 0, r); + } + return AddRect(name, r); +} + +status_t TPreferences::SetMessage(const char *name, const BMessage *message) +{ + if (HasMessage(name)) + { + return ReplaceMessage(name, 0, message); + } + return AddMessage(name, message); +} + +status_t TPreferences::SetFlat(const char *name, const BFlattenable *obj) +{ + if (HasFlat(name, obj)) + { + return ReplaceFlat(name, 0, (BFlattenable *) obj); + } + return AddFlat(name, (BFlattenable *) obj); +} + +status_t TPreferences::SetData(const char *name, type_code type,const void *data, ssize_t numBytes) +{ + if (HasData(name, type)) + { + return ReplaceData(name, type, 0, data, numBytes); + } + return AddData(name, type, data, numBytes); +} + +status_t TPreferences::SetRef(const char *name, entry_ref *ref) +{ + if (HasRef(name)) + { + return ReplaceRef(name, 0, ref); + } + return AddRef(name, ref); +} + diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/TPreferences.h b/src/tests/kits/interface/bshelf/ShelfInspector/TPreferences.h new file mode 100644 index 0000000000..533cf98352 --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/TPreferences.h @@ -0,0 +1,57 @@ +// +// TPreferences +// Using BMessages to save user settings. +// +// Eric Shepherd +// +/* + Copyright 1999, Be Incorporated. All Rights Reserved. + This file may be used under the terms of the Be Sample Code License. + + Modified by H. Reh "SetData" added - Dec. 2001 + "SetRef" added - Dec. 2003 +*/ + +#ifndef __TPREFS_H__ +#define __TPREFS_H__ + +#include +#include +#include + +class _EXPORT TPreferences : public BMessage +{ + public: + TPreferences(char *filename); + ~TPreferences(); + + + status_t InitCheck(void); + + status_t SetBool(const char *name, bool b); + status_t SetInt8(const char *name, int8 i); + status_t SetInt16(const char *name, int16 i); + status_t SetInt32(const char *name, int32 i); + status_t SetInt64(const char *name, int64 i); + status_t SetFloat(const char *name, float f); + status_t SetDouble(const char *name, double d); + status_t SetString(const char *name, const char *string); + status_t SetPoint(const char *name, BPoint p); + status_t SetRect(const char *name, BRect r); + status_t SetMessage(const char *name, const BMessage *message); + status_t SetFlat(const char *name, const BFlattenable *obj); + status_t SetData(const char *name, type_code type, const void *data, ssize_t numBytes); + status_t SetRef(const char *name, entry_ref *ref); + + private: + BPath path; + BPath parent; + status_t status; +}; + +inline status_t TPreferences::InitCheck(void) +{ + return status; +} + +#endif diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/XShelfInspector.rdef b/src/tests/kits/interface/bshelf/ShelfInspector/XShelfInspector.rdef new file mode 100644 index 0000000000..15f681dddc --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/XShelfInspector.rdef @@ -0,0 +1,448 @@ + +resource(1, "PopUpMenu") #'ARCV' archive BMenuField { + "_name" = "TargetPopUp", + "_frame" = rect { 0.00000, 0.00000, 194.000, 22.0000 }, + "_resize_mode" = 4626, + "_flags" = 570425344, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 10.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -1, + "_color" = -1, + "_views" = archive _BMCMenuBar_ { + "_name" = "_mc_mb_", + "_frame" = rect { 76.0000, 3.00000, 186.000, 19.0000 }, + "_resize_mode" = 4626, + "_flags" = 603979776, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 10.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656876032, + "_color" = -656876032, + "_rsize_to_fit" = true, + "_maxwidth" = 102.000, + "_items" = archive _BMCItem_ { + "_label" = "XContainer Window", + "_submenu" = archive BPopUpMenu { + "_name" = "Select", + "_frame" = rect { 0.00000, 0.00000, 0.00000, 0.00000 }, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 10.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656876032, + "_color" = -656876032, + "_layout" = 1, + "_rsize_to_fit" = true, + "_radio" = true, + "_dyn_label" = true, + "_items" = archive BMenuItem { + "_label" = "XContainer Window", + "_marked" = true, + "_msg" = message(17) + }, + "_items" = archive BMenuItem { + "_label" = "Deskbar", + "_msg" = message(19) + }, + "_items" = archive BMenuItem { + "_label" = "Desktop Window", + "_msg" = message(21) + } + } + }, + "_border" = 1 + }, + "_label" = "Target Shelf: ", + "_align" = 0, + "_divide" = 74.0000, + "ID" = 24, + "designfsize" = 11.9873 +}; + +resource(0, "InfoWindow") #'ARCV' archive BWindow { + "_prio" = 15, + "_port_cap" = 100, + "_title" = "XShelfInspector", + "_wlook" = 11, + "_sizel" = 302.000, + "_sizel" = 447.000, + "_sizel" = 302.000, + "_sizel" = 447.000, + "ID" = 121, + "_flags" = 524356, + "_type" = 11, + "_wfeel" = 0, + "_name" = "XShelfInspector", + "_frame" = rect { 285.000, 93.0000, 587.000, 540.000 }, + "minWidth" = 302.000, + "maxWidth" = 302.000, + "minHeight" = 447.000, + "maxHeight" = 447.000, + "_views" = archive BView { + "_name" = "InfoView", + "_frame" = rect { -2.00000, -1.00000, 303.000, 448.000 }, + "_resize_mode" = 4660, + "_flags" = 536870912, + "_color" = 255, + "_color" = -1, + "_color" = -656877313, + "_views" = archive BBox { + "_name" = "MainBox", + "_frame" = rect { 7.00000, 30.0000, 299.000, 430.000 }, + "_resize_mode" = 4626, + "_flags" = 738197504, + "_fname" = "Swis721 BT", + "_fname" = "Bold", + "_fflt" = 12.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656877313, + "_color" = -656877313, + "_ploc" = point { 81.0000, 9.77734 }, + "_views" = archive BStringView { + "_name" = "", + "_frame" = rect { 12.0000, 24.0000, 105.000, 38.0000 }, + "_resize_mode" = 4626, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 10.0000, + "_fflt" = 90.0000, + "_fflt" = 0.00000, + "_color" = 255, + "_color" = -656877313, + "_color" = -656877313, + "_text" = "Loaded Replicants:", + "_align" = 0 + }, + "_views" = archive BScrollView { + "_name" = "LibraryScroll", + "_frame" = rect { 10.0000, 227.000, 279.000, 352.000 }, + "_resize_mode" = 4626, + "_flags" = 536870912, + "_color" = -1734829825, + "_color" = -1, + "_color" = -1, + "_ploc" = point { 1.00000, 105.000 }, + "_views" = archive BListView { + "_name" = "LibraryList", + "_frame" = rect { 2.00000, 2.00000, 251.000, 107.000 }, + "_resize_mode" = 4660, + "_flags" = 637534208, + "_color" = 255, + "_color" = -1, + "_color" = -1, + "_lv_type" = 0, + "_msg" = message(46), + "_2nd_msg" = message(43) + }, + "_views" = archive BScrollBar { + "_name" = "_VSB_", + "_frame" = rect { 254.000, 1.00000, 268.000, 110.000 }, + "_resize_mode" = 5172, + "_flags" = 536870912, + "_color" = 255, + "_color" = -1, + "_color" = -1, + "_range" = 0.00000, + "_range" = 0.00000, + "_steps" = 1.00000, + "_steps" = 10.0000, + "_val" = 0.00000, + "_orient" = 1, + "_prop" = 1.00000 + }, + "_views" = archive BScrollBar { + "_name" = "_HSB_", + "_frame" = rect { 1.00000, 110.000, 254.000, 124.000 }, + "_resize_mode" = 12852, + "_flags" = 536870912, + "_color" = 255, + "_color" = -1, + "_color" = -1, + "_range" = 0.00000, + "_range" = 0.00000, + "_steps" = 1.00000, + "_steps" = 10.0000, + "_val" = 0.00000, + "_orient" = 0, + "_prop" = 0.00000 + } + }, + "_views" = archive BStringView { + "_name" = "", + "_frame" = rect { 13.0000, 208.000, 99.0000, 222.000 }, + "_resize_mode" = 4626, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 10.0000, + "_fflt" = 90.0000, + "_fflt" = 0.00000, + "_color" = 255, + "_color" = -656877313, + "_color" = -656877313, + "_text" = "Loaded Libraries:", + "_align" = 0 + }, + "_views" = archive BButton { + "_name" = "UnloadButton", + "_frame" = rect { 18.0000, 363.000, 93.0000, 387.000 }, + "_resize_mode" = 4626, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_color" = -2139062019, + "_color" = -656877313, + "_color" = -656877313, + "_ploc" = point { 58.0000, 16.6353 }, + "_msg" = message(69), + "_label" = "Unload ...", + "_disable" = true, + "be:wants_nav" = true + }, + "_views" = archive BButton { + "_name" = "DeleteButton", + "_frame" = rect { 16.0000, 173.000, 91.0000, 197.000 }, + "_resize_mode" = 4626, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_color" = -2139062019, + "_color" = -656877313, + "_color" = -656877313, + "_ploc" = point { 53.0000, 16.6353 }, + "_msg" = message(9), + "_label" = "Delete", + "_disable" = true, + "be:wants_nav" = true + }, + "_views" = archive BButton { + "_name" = "CopyButton", + "_frame" = rect { 118.000, 173.000, 233.000, 197.000 }, + "_resize_mode" = 4626, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_color" = -2139062019, + "_color" = -656877313, + "_color" = -656877313, + "_ploc" = point { 105.000, 16.6353 }, + "_msg" = message(13), + "_label" = "Copy to Container ...", + "_disable" = true, + "be:wants_nav" = true + }, + "_views" = archive BView { + "_name" = "", + "_frame" = rect { 266.000, 337.000, 279.000, 351.000 }, + "_resize_mode" = 4626, + "_flags" = 536870912, + "_color" = 255, + "_color" = -1, + "_color" = -656877313 + }, + "_views" = archive BScrollView { + "_name" = "ReplicantScroll", + "_frame" = rect { 10.0000, 39.0000, 279.000, 164.000 }, + "_resize_mode" = 4626, + "_flags" = 536870912, + "_color" = -1734829825, + "_color" = -1, + "_color" = -1, + "_ploc" = point { 1.00000, 105.000 }, + "_views" = archive BListView { + "_name" = "ReplicantList", + "_frame" = rect { 2.00000, 2.00000, 251.000, 107.000 }, + "_resize_mode" = 4660, + "_flags" = 637534208, + "_color" = 255, + "_color" = -1, + "_color" = -1, + "_lv_type" = 0, + "_msg" = message(119), + "_2nd_msg" = message(116) + }, + "_views" = archive BScrollBar { + "_name" = "_VSB_", + "_frame" = rect { 254.000, 1.00000, 268.000, 110.000 }, + "_resize_mode" = 5172, + "_flags" = 536870912, + "_color" = 255, + "_color" = -1, + "_color" = -1, + "_range" = 0.00000, + "_range" = 0.00000, + "_steps" = 1.00000, + "_steps" = 10.0000, + "_val" = 0.00000, + "_orient" = 1, + "_prop" = 1.00000 + }, + "_views" = archive BScrollBar { + "_name" = "_HSB_", + "_frame" = rect { 1.00000, 110.000, 254.000, 124.000 }, + "_resize_mode" = 12852, + "_flags" = 536870912, + "_color" = 255, + "_color" = -1, + "_color" = -1, + "_range" = 0.00000, + "_range" = 0.00000, + "_steps" = 1.00000, + "_steps" = 10.0000, + "_val" = 0.00000, + "_orient" = 0, + "_prop" = 0.00000 + } + }, + "_views" = archive BView { + "_name" = "", + "_frame" = rect { 265.000, 150.000, 278.000, 163.000 }, + "_resize_mode" = 4626, + "_flags" = 536870912, + "_color" = 255, + "_color" = -1, + "_color" = -656877313 + }, + "_label" = "Target Shelf" + }, + "_views" = archive BMenuBar { + "_name" = "MainBar", + "_frame" = rect { 0.00000, 0.00000, 306.000, 19.0000 }, + "_resize_mode" = 4628, + "_flags" = 603979776, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 12.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656876032, + "_color" = -656876032, + "_rsize_to_fit" = true, + "_items" = archive BMenuItem { + "_label" = "File", + "_submenu" = archive BMenu { + "_name" = "File", + "_frame" = rect { 0.00000, 0.00000, 0.00000, 0.00000 }, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 12.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656876032, + "_color" = -656876032, + "_layout" = 1, + "_rsize_to_fit" = true, + "_items" = archive BMenuItem { + "_label" = "New", + "_shortcut" = 78, + "_mods" = 2, + "_msg" = message(78) + }, + "_items" = archive BMenuItem { + "_label" = "Open…", + "_shortcut" = 79, + "_mods" = 2, + "_msg" = message(79) + }, + "_items" = archive BSeparatorItem { + "_label" = "", + "_disable" = true + }, + "_items" = archive BMenuItem { + "_label" = "Save", + "_shortcut" = 83, + "_mods" = 2, + "_msg" = message(80) + }, + "_items" = archive BMenuItem { + "_label" = "Save As…", + "_msg" = message(81) + }, + "_items" = archive BSeparatorItem { + "_label" = "", + "_disable" = true + }, + "_items" = archive BMenuItem { + "_label" = "About…", + "_shortcut" = 65, + "_mods" = 2, + "_msg" = message(82) + }, + "_items" = archive BSeparatorItem { + "_label" = "", + "_disable" = true + }, + "_items" = archive BMenuItem { + "_label" = "Quit", + "_shortcut" = 81, + "_mods" = 2, + "_msg" = message(83) + } + } + }, + "_items" = archive BMenuItem { + "_label" = "Edit", + "_submenu" = archive BMenu { + "_name" = "Edit", + "_frame" = rect { 0.00000, 0.00000, 0.00000, 0.00000 }, + "_flags" = 536870912, + "_fname" = "Swis721 BT", + "_fname" = "Roman", + "_fflt" = 12.0000, + "_fflt" = -1.00000, + "_fflt" = -1.00000, + "_color" = 255, + "_color" = -656876032, + "_color" = -656876032, + "_layout" = 1, + "_rsize_to_fit" = true, + "_items" = archive BMenuItem { + "_label" = "Undo", + "_shortcut" = 90, + "_mods" = 2, + "_msg" = message(84) + }, + "_items" = archive BSeparatorItem { + "_label" = "", + "_disable" = true + }, + "_items" = archive BMenuItem { + "_label" = "Cut", + "_shortcut" = 88, + "_mods" = 2, + "_msg" = message(85) + }, + "_items" = archive BMenuItem { + "_label" = "Copy", + "_shortcut" = 67, + "_mods" = 2, + "_msg" = message(86) + }, + "_items" = archive BMenuItem { + "_label" = "Paste", + "_shortcut" = 86, + "_mods" = 2, + "_msg" = message(87) + } + } + } + } + }, + "designfsize" = 11.9873 +}; diff --git a/src/tests/kits/interface/bshelf/ShelfInspector/readme.txt b/src/tests/kits/interface/bshelf/ShelfInspector/readme.txt new file mode 100644 index 0000000000..9fdd4dcfaa --- /dev/null +++ b/src/tests/kits/interface/bshelf/ShelfInspector/readme.txt @@ -0,0 +1,87 @@ +Inspector Detector: the Shelf Inspector + +Writing replicants is cool, and as our system evolves we'll see them used more often. Replicant creation is fairly easily, but there are some trouble spots. To help you avoid them I've started writing an application to smooth out the process: the Shelf Inspector. This app will work as a test bed for writing both replicants and containers. It will also show off some of the new scriptability found in all Replicants and BShelf objects. This is Part 1 of a multipart article. + +The first step is to inspect (and manipulate) the contents of a container view. You can find the sample app associated with this text at . + +This app lets you interrogate a BShelf object (aka "container view") to see what replicants it contains. One common difficulty with replicants is managing the add-on/library that defines the replicant. The Shelf Inspector helps with this by showing the images currently loaded in the target application. It also lets you unload libraries that are no longer in use (be careful not to unload libraries that still are in use). This a good time to build and run the Shelf Inspector. You'll notice when you launch it that it also launches the Container demo application; these two apps work together. + +The Target Shelf: popup in the Shelf Inspector window can target any one of three container views in the system. Try it! The top list shows currently loaded replicants; the lower list shows the libraries loaded by the target application. By selecting a replicant in the top list you can delete it (with the Delete button) or you can try copying (cloning) the replicant into the Container demo application. + +A warning here: not all replicants want to be cloned this way, but I thought it was useful to show the possibility. Such cloning can screw up the Container demo. If you run into problems it might help to remove the backing store file for the Container demo +(delete /boot/home/config/settings/Container_data). + +That's about all there is to the app at this point. There will be more in the future. Now let's switch gears and talk about the implementation. The interesting code -- which figures out what replicants are loaded in some other application -- is in the following functions: + +BMessenger TInfoWindow::MessengerForTarget(type_code w) +int32 TInfoWindow::GetReplicantAt(int32 index) +status_t TInfoWindow::GetReplicantName(int32 uid, BMessage *result) +status_t TInfoWindow::DeleteReplicant(int32 uid) +status_t TInfoWindow::ImportReplicant(int32 uid) + +The MessengerForTarget function uses the BeOS scripting protocol to get a BMessenger for the target shelf in the target application. Taking the Deskbar as an example, the code looks like this: + + request.AddSpecifier("Messenger"); + request.AddSpecifier("Shelf"); + request.AddSpecifier("View", "Status"); + request.AddSpecifier("Window", "Deskbar"); + to = BMessenger("application/x-vnd.Be-TSKB", -1); + +We're asking for the "Messenger" to the "Shelf" in the View "Status" in the Window "Deskbar" of the Deskbar application. + + +Every replicant living inside a BShelf object automatically inherits several "Properties": + + * ID - each replicant gets a unique ID when added to a shelf. + * Name - the Name of the top view of the replicant. + * Signature - the signature of the add-on defining the replicant. + * Suites - the computer-readable description of these properties. + * View - the property "pointing" to the top view of the replicant. + +The GetReplicantName and GetReplicantAt functions use these properties to do their work. Looking more closely at GetReplicantAt, it asks the shelf for the ID of the replicant at a given index: + + BMessage request(B_GET_PROPERTY); + request.AddSpecifier("ID"); // want the ID + request.AddSpecifier("Replicant", index); // the index + // fTarget as returned by MessengerForTarget() + fTarget.SendMessage(request, &reply); + reply.FindInt32("result", &uid); + +And that's how we get the replicant's ID, which remains valid across "saves." Thus, in the Container demo, IDs remain valid across quit/launch cycles. For shelves that don't save their state (e.g., the Deskbar), the ID for a replicant, such as the mailbox widget, potentially changes each time it is added to the shelf. + +Just as every replicant supports a set of properties, so does a shelf. Every shelf defines one property called "Replicant" that supports the following actions: + + * counting the number of replicants + * adding a new replicant + * deleting an existing replicant + * getting the "data archive" defining a replicant + +ImportReplicant() and DeleteReplicant() use these features. ImportReplicant() gets a copy of the data archive (the archived BMessage) for the replicant. Then it sends that archive to the Container demo and asks it to create a new replicant. Let's take a closer look: + + BMessage request(B_GET_PROPERTY); // Get the archive + BMessage uid_specifier(B_ID_SPECIFIER); + + // IDs are specified using code like so: + uid_specifier.AddInt32("id", uid); + uid_specifier.AddString("property", "Replicant"); + request.AddSpecifier(&uid_specifier); + + fTarget.SendMessage(&request, &reply); + // various error checking omitted + + // OK, let's get the archive message + BMessage data; + reply.FindMessage("result", &data); + + // get messenger to the shelf in the Container demo + BMessenger mess MessengerForTarget(CONTAINER_MESSENGER); + BMessage msg(B_CREATE_PROPERTY); + request2.AddMessage("data", &data); + return mess.SendMessage(&request2, &reply); + + +First we send a GET command, asking the shelf to return a copy of the archive data message for the replicant whose unique ID is uid. Then we extract the archived data message and add it to a CREATE message. This is sent to the shelf in the Container demo app, and that's it. Note that not all replicants respond well to this manipulation; the Shelf Inspector warns you if this is the case when you select the Copy to Container button. The Clock replicant works fine, so it's a good one to play with. + +The Library list isn't all that useful right now, but it can let you see if you're properly using some of the advanced replicant features such as the be:load_each_time and be:unload_on_delete flags. If "unload on delete" is set in a replicant that is removed, the corresponding library should also be removed. If "load each time" is set and the same replicant is loaded multiple times you should also see the library loaded the same number of times. In a future version of the Shelf Inspector I'll include some configurable test replicants that show these features in action. + +That's it for this installment. Have fun programming the BeOS!