diff --git a/bazaar/SysInfo_demo_gui/Readme b/bazaar/SysInfo_demo_gui/Readme new file mode 100644 index 000000000..d6afc2fa4 --- /dev/null +++ b/bazaar/SysInfo_demo_gui/Readme @@ -0,0 +1,2 @@ +Icon "Computer" taken from Silk Icons at http://www.famfamfam.com/lab/icons/silk/ by Mark James +under a Creative Commons Attribution 2.5 License \ No newline at end of file diff --git a/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.h b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.h new file mode 100644 index 000000000..67a1700bb --- /dev/null +++ b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.h @@ -0,0 +1,89 @@ +#define LAYOUTFILE +#include + +#define IMAGEFILE +#include + +struct SpecialFolders : WithSpecialFolders { + + typedef SpecialFolders CLASSNAME; + + SpecialFolders() + { + CtrlLayout(*this); + } + void Fill(); + void ButInstalledSoftware_Push(); +}; +struct SystemInfo : WithSystemInfo { + + typedef SystemInfo CLASSNAME; + + SystemInfo() + { + CtrlLayout(*this); + } + void Fill(); + void ButUpdate_Push(); +}; +struct WindowsList_ : WithWindowsList { + + typedef WindowsList_ CLASSNAME; + + WindowsList_() + { + CtrlLayout(*this); + } + void Fill(); + void ButUpdate_Push(); +}; +struct ProcessList : WithProcessList { + + typedef ProcessList CLASSNAME; + + ProcessList() + { + CtrlLayout(*this); + } + void Fill(); + void ButUpdate_Push(); +}; +struct ScreenGrabTab : WithScreenGrabTab { + + typedef ScreenGrabTab CLASSNAME; + + ScreenGrabTab() + { + CtrlLayout(*this); + } + void Fill(); + void ButGrab_Push(); + void ButSnap_Push(); + void SwGrabMode_Action(); +}; + +class SysInfoDemo : public TopWindow { +public: + typedef SysInfoDemo CLASSNAME; + + SysInfoDemo(); + + MenuBar menu; + StatusBar info; + + TabCtrl filesTab; + SpecialFolders specialFolders; + SystemInfo systemInfo; + ProcessList processList; + WindowsList_ windowsList; + ScreenGrabTab screenGrab; + + // Menus + void MainMenu(Bar& bar); + void FileMenu(Bar& bar); + void About(); + + void Exit(); +}; + + diff --git a/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.ico b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.ico new file mode 100644 index 000000000..0a539470b Binary files /dev/null and b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.ico differ diff --git a/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.iml b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.iml new file mode 100644 index 000000000..421b6f31c --- /dev/null +++ b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.iml @@ -0,0 +1,27 @@ +PREMULTIPLIED +IMAGE_ID(Computer) + +IMAGE_BEGIN_DATA +IMAGE_DATA(120,156,141,147,223,75,83,97,24,199,149,46,21,242,166,191,69,48,240,162,171,188,8,18,196,44,188,83,112,52,150,203) +IMAGE_DATA(45,83,154,107,130,41,42,139,54,181,150,201,180,72,36,131,185,185,205,114,7,219,230,54,61,30,143,251,225,118,246,195) +IMAGE_DATA(29,119,116,106,132,89,18,68,20,93,124,123,223,55,23,4,37,30,248,114,224,240,124,222,239,247,125,158,231,148,85,149) +IMAGE_DATA(85,149,157,245,49,153,76,147,145,72,228,103,56,28,70,32,16,0,199,113,88,88,88,128,211,233,132,86,171,157,249,31) +IMAGE_DATA(87,89,89,121,126,112,112,240,181,44,203,216,219,123,15,185,176,11,89,86,144,167,202,23,112,116,244,25,211,211,211,248) +IMAGE_DATA(23,91,83,83,115,217,235,245,238,43,138,130,195,195,67,172,9,49,68,86,214,17,10,11,8,134,120,4,131,171,200,230) +IMAGE_DATA(100,216,237,118,196,227,241,31,201,100,146,190,33,138,34,120,158,71,40,20,130,223,239,135,207,231,3,57,135,101,157,157) +IMAGE_DATA(157,101,126,35,35,163,176,88,172,72,103,242,176,217,108,160,236,241,241,23,40,74,145,169,160,236,98,155,102,221,222,249) +IMAGE_DATA(147,53,71,244,241,232,19,243,123,231,143,128,91,10,65,74,111,145,115,44,136,70,163,140,107,188,231,36,114,225,154,193) +IMAGE_DATA(133,166,158,121,52,25,221,184,126,223,131,27,38,47,174,116,204,32,147,149,153,159,217,108,198,208,208,16,82,82,14,195) +IMAGE_DATA(195,195,16,4,129,121,82,78,245,48,140,155,143,86,160,182,242,208,140,10,104,127,44,66,107,139,50,62,157,206,51,191) +IMAGE_DATA(69,46,136,183,139,1,146,59,131,190,190,62,144,217,176,222,54,245,184,161,182,172,66,51,178,134,91,99,235,208,62,217) +IMAGE_DATA(192,237,167,49,232,158,37,24,95,242,123,201,79,161,241,213,85,36,8,111,52,26,217,76,233,92,104,86,202,181,159,112) +IMAGE_DATA(29,132,211,79,108,226,142,61,197,248,100,234,183,223,165,231,23,81,61,90,141,120,34,141,174,174,46,214,99,218,35,122) +IMAGE_DATA(79,154,213,226,200,194,50,151,59,209,22,238,78,165,25,95,242,115,123,56,184,220,28,98,241,20,116,58,29,60,30,15) +IMAGE_DATA(182,73,175,105,205,105,74,73,91,204,207,53,239,195,156,107,17,209,88,10,26,141,6,14,135,3,197,226,62,36,41,131) +IMAGE_DATA(205,164,132,141,104,130,237,201,50,217,19,126,109,131,244,87,36,251,35,146,254,101,137,159,30,14,194,58,230,222,144,186) +IMAGE_DATA(36,84,42,21,154,155,155,205,189,189,189,162,193,96,16,201,249,34,201,88,160,115,30,31,31,167,121,191,211,59,247,15) +IMAGE_DATA(12,224,65,255,0,38,167,94,48,142,234,224,224,3,90,91,91,255,218,223,218,218,218,246,182,182,182,165,224,114,152,229) +IMAGE_DATA(235,236,236,252,86,87,87,55,209,210,210,178,169,215,235,233,255,2,181,90,13,82,3,242,13,245,245,245,153,18,91,81) +IMAGE_DATA(81,113,193,106,181,146,185,74,80,118,138,108,247,20,178,23,164,254,235,89,254,211,242,242,242,115,228,62,52,63,186,187) +IMAGE_DATA(187,81,242,107,104,104,16,78,227,126,1,218,229,112,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) +IMAGE_END_DATA(704, 1) diff --git a/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.lay b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.lay new file mode 100644 index 000000000..8a84c4277 --- /dev/null +++ b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.lay @@ -0,0 +1,145 @@ +LAYOUT(SpecialFolders, 672, 436) + ITEM(Label, TextSystem, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(176, 16)) + ITEM(Label, dv___1, SetLabel(t_("Video")).LeftPosZ(0, 116).TopPosZ(80, 16)) + ITEM(Label, TextMusic, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(48, 16)) + ITEM(Label, dv___3, SetLabel(t_("Personal")).LeftPosZ(0, 116).TopPosZ(96, 16)) + ITEM(Label, TextPersonal, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(96, 16)) + ITEM(Label, dv___5, SetLabel(t_("Download")).LeftPosZ(0, 116).TopPosZ(128, 16)) + ITEM(Label, TextOs, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(160, 16)) + ITEM(Label, dv___7, SetLabel(t_("Temp")).LeftPosZ(0, 116).TopPosZ(144, 16)) + ITEM(Label, TextTemp, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(144, 16)) + ITEM(Label, dv___9, SetLabel(t_("Os")).LeftPosZ(0, 116).TopPosZ(160, 16)) + ITEM(Label, TextDownload, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(128, 16)) + ITEM(Label, dv___11, SetLabel(t_("System")).LeftPosZ(0, 116).TopPosZ(176, 16)) + ITEM(Label, TextTemplates, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(112, 16)) + ITEM(Label, dv___13, SetLabel(t_("Templates")).LeftPosZ(0, 116).TopPosZ(112, 16)) + ITEM(Label, TextVideo, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(80, 16)) + ITEM(Label, TextPrograms, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(16, 16)) + ITEM(Label, TextApplication, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(32, 16)) + ITEM(Label, TextPictures, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(64, 16)) + ITEM(Label, TextDesktop, SetFrame(ThinInsetFrame()).LeftPosZ(116, 288).TopPosZ(0, 16)) + ITEM(Label, dv___19, SetLabel(t_("Pictures")).LeftPosZ(0, 116).TopPosZ(64, 16)) + ITEM(Label, dv___20, SetLabel(t_("Programs")).LeftPosZ(0, 116).TopPosZ(16, 16)) + ITEM(Label, dv___21, SetLabel(t_("Application Data")).LeftPosZ(0, 116).TopPosZ(32, 16)) + ITEM(Label, dv___22, SetLabel(t_("Music")).LeftPosZ(0, 116).TopPosZ(48, 16)) + ITEM(Label, dv___23, SetLabel(t_("Desktop")).LeftPosZ(0, 116).TopPosZ(0, 16)) + ITEM(Label, dv___24, SetLabel(t_("Software installed")).SetFrame(ThinOutsetFrame()).HSizePosZ(0, 4).TopPosZ(196, 16)) + ITEM(ArrayCtrl, SoftwareInstalled, HSizePosZ(0, 4).VSizePosZ(212, 40)) + ITEM(Button, ButInstalledSoftware, SetLabel(t_("Get installed software list")).LeftPosZ(4, 136).BottomPosZ(8, 24)) + ITEM(Label, dv___27, SetLabel(t_("Default executables for file extensions")).SetFrame(ThinOutsetFrame()).HSizePosZ(408, 4).TopPosZ(0, 16)) + ITEM(ArrayCtrl, DefaultExes, HSizePosZ(408, 4).TopPosZ(16, 176)) +END_LAYOUT + +LAYOUT(SystemInfo, 744, 520) + ITEM(Label, dv___0, SetLabel(t_("Bios release")).LeftPosZ(204, 88).TopPosZ(16, 16)) + ITEM(Label, dv___1, SetLabel(t_("Drives")).SetFrame(ThinOutsetFrame()).HSizePosZ(0, 4).TopPosZ(412, 16)) + ITEM(Label, TextSpeed, SetFrame(ThinInsetFrame()).LeftPosZ(292, 116).TopPosZ(52, 16)) + ITEM(Label, TextBiosRelease, SetFrame(ThinInsetFrame()).LeftPosZ(292, 80).TopPosZ(16, 16)) + ITEM(Label, TextManufacturer, SetFrame(ThinInsetFrame()).LeftPosZ(88, 116).TopPosZ(0, 16)) + ITEM(Label, TextProductName, SetFrame(ThinInsetFrame()).LeftPosZ(88, 116).TopPosZ(16, 16)) + ITEM(Label, dv___6, SetLabel(t_("Bios version")).LeftPosZ(204, 88).TopPosZ(0, 16)) + ITEM(Label, dv___7, SetLabel(t_("CPU Speed")).LeftPosZ(204, 88).TopPosZ(52, 16)) + ITEM(Label, TextBiosVersion, SetFrame(ThinInsetFrame()).LeftPosZ(292, 376).TopPosZ(0, 16)) + ITEM(Label, TextVersion, SetFrame(ThinInsetFrame()).LeftPosZ(88, 116).TopPosZ(32, 16)) + ITEM(Label, TextKerArchitecture, SetFrame(ThinInsetFrame()).LeftPosZ(528, 140).TopPosZ(72, 16)) + ITEM(Label, dv___11, SetLabel(t_("Version")).LeftPosZ(0, 88).TopPosZ(32, 16)) + ITEM(Label, dv___12, SetLabel(t_("Architecture")).LeftPosZ(464, 64).TopPosZ(72, 16)) + ITEM(Label, TextDeskVersion, SetFrame(ThinInsetFrame()).LeftPosZ(292, 116).TopPosZ(104, 16)) + ITEM(Label, dv___14, SetLabel(t_("Version")).LeftPosZ(204, 88).TopPosZ(104, 16)) + ITEM(Label, TextMemPercentage, SetFrame(ThinInsetFrame()).LeftPosZ(88, 36).TopPosZ(124, 16)) + ITEM(Label, TextMemFreeVirtualbytes, SetFrame(ThinInsetFrame()).LeftPosZ(584, 68).TopPosZ(156, 16)) + ITEM(Label, TextMemFreeVirtual, SetFrame(ThinInsetFrame()).LeftPosZ(688, 52).TopPosZ(156, 16)) + ITEM(Label, TextMemTotVirtual, SetFrame(ThinInsetFrame()).LeftPosZ(688, 52).TopPosZ(140, 16)) + ITEM(Label, TextMemTotVirtualbytes, SetFrame(ThinInsetFrame()).LeftPosZ(584, 68).TopPosZ(140, 16)) + ITEM(Label, TextDesktop, SetFrame(ThinInsetFrame()).LeftPosZ(88, 116).TopPosZ(104, 16)) + ITEM(Label, dv___21, SetLabel(t_("%")).LeftPosZ(124, 16).TopPosZ(124, 16)) + ITEM(Label, dv___22, SetLabel(t_("Free Virtual")).LeftPosZ(496, 88).TopPosZ(156, 16)) + ITEM(Label, dv___23, SetLabel(t_("bytes =")).LeftPosZ(652, 36).TopPosZ(156, 16)) + ITEM(Label, dv___24, SetLabel(t_("bytes =")).LeftPosZ(652, 36).TopPosZ(140, 16)) + ITEM(Label, dv___25, SetLabel(t_("Total Virtual")).LeftPosZ(496, 88).TopPosZ(140, 16)) + ITEM(Label, TextMemFreePagingbytes, SetFrame(ThinInsetFrame()).LeftPosZ(336, 68).TopPosZ(156, 16)) + ITEM(Label, TextMemFreePaging, SetFrame(ThinInsetFrame()).LeftPosZ(440, 52).TopPosZ(156, 16)) + ITEM(Label, TextMemTotPaging, SetFrame(ThinInsetFrame()).LeftPosZ(440, 52).TopPosZ(140, 16)) + ITEM(Label, TextMemTotPagingbytes, SetFrame(ThinInsetFrame()).LeftPosZ(336, 68).TopPosZ(140, 16)) + ITEM(Label, dv___30, SetLabel(t_("Free Paging")).LeftPosZ(248, 88).TopPosZ(156, 16)) + ITEM(Label, dv___31, SetLabel(t_("bytes =")).LeftPosZ(404, 36).TopPosZ(156, 16)) + ITEM(Label, dv___32, SetLabel(t_("bytes =")).LeftPosZ(404, 36).TopPosZ(140, 16)) + ITEM(Label, dv___33, SetLabel(t_("Total Paging")).LeftPosZ(248, 88).TopPosZ(140, 16)) + ITEM(Label, TextCompilationDate, SetFrame(ThinInsetFrame()).LeftPosZ(356, 76).TopPosZ(176, 16)) + ITEM(Label, TextCompilerVersion, SetFrame(ThinInsetFrame()).LeftPosZ(200, 64).TopPosZ(176, 16)) + ITEM(Label, TextCompiler, SetFrame(ThinInsetFrame()).LeftPosZ(112, 44).TopPosZ(176, 16)) + ITEM(Label, TextMemFreePhysicalbytes, SetFrame(ThinInsetFrame()).LeftPosZ(88, 68).TopPosZ(156, 16)) + ITEM(Label, TextMemFreePhysical, SetFrame(ThinInsetFrame()).LeftPosZ(192, 52).TopPosZ(156, 16)) + ITEM(Label, TextMemTotPhysical, SetFrame(ThinInsetFrame()).LeftPosZ(192, 52).TopPosZ(140, 16)) + ITEM(Label, TextMemTotPhysicalbytes, SetFrame(ThinInsetFrame()).LeftPosZ(88, 68).TopPosZ(140, 16)) + ITEM(Label, dv___41, SetLabel(t_("Compilation date:")).LeftPosZ(268, 88).TopPosZ(176, 16)) + ITEM(Label, dv___42, SetLabel(t_("Program compiled with:")).LeftPosZ(0, 112).TopPosZ(176, 16)) + ITEM(Label, dv___43, SetLabel(t_("Free Physical")).LeftPosZ(0, 88).TopPosZ(156, 16)) + ITEM(Label, dv___44, SetLabel(t_("Version:")).LeftPosZ(160, 40).TopPosZ(176, 16)) + ITEM(Label, dv___45, SetLabel(t_("bytes =")).LeftPosZ(156, 36).TopPosZ(156, 16)) + ITEM(Label, dv___46, SetLabel(t_("bytes =")).LeftPosZ(156, 36).TopPosZ(140, 16)) + ITEM(Label, dv___47, SetLabel(t_("Total Physical")).LeftPosZ(0, 88).TopPosZ(140, 16)) + ITEM(Label, dv___48, SetLabel(t_("Memory in use")).LeftPosZ(0, 88).TopPosZ(124, 16)) + ITEM(Label, dv___49, SetLabel(t_("Desktop")).LeftPosZ(0, 88).TopPosZ(104, 16)) + ITEM(Label, TextDistVersion, SetFrame(ThinInsetFrame()).LeftPosZ(292, 116).TopPosZ(88, 16)) + ITEM(Label, dv___51, SetLabel(t_("Version")).LeftPosZ(204, 88).TopPosZ(88, 16)) + ITEM(Label, TextDistro, SetFrame(ThinInsetFrame()).LeftPosZ(88, 116).TopPosZ(88, 16)) + ITEM(Label, dv___53, SetLabel(t_("Distro")).LeftPosZ(0, 88).TopPosZ(88, 16)) + ITEM(Label, TextKerVersion, SetFrame(ThinInsetFrame()).LeftPosZ(292, 168).TopPosZ(72, 16)) + ITEM(Label, dv___55, SetLabel(t_("Version")).LeftPosZ(204, 88).TopPosZ(72, 16)) + ITEM(Label, TextKernel, SetFrame(ThinInsetFrame()).LeftPosZ(88, 116).TopPosZ(72, 16)) + ITEM(Label, dv___57, SetLabel(t_("Kernel")).LeftPosZ(0, 88).TopPosZ(72, 16)) + ITEM(Label, TextNumber, SetFrame(ThinInsetFrame()).LeftPosZ(88, 116).TopPosZ(52, 16)) + ITEM(Label, dv___59, SetLabel(t_("Processors num.")).LeftPosZ(0, 88).TopPosZ(52, 16)) + ITEM(Label, dv___60, SetLabel(t_("Manufacturer")).LeftPosZ(0, 88).TopPosZ(0, 16)) + ITEM(Label, dv___61, SetLabel(t_("Product name")).LeftPosZ(0, 88).TopPosZ(16, 16)) + ITEM(ArrayCtrl, Drives, HSizePosZ(0, 4).VSizePosZ(428, 36)) + ITEM(Label, dv___63, SetLabel(t_("Video")).SetFrame(ThinOutsetFrame()).HSizePosZ(0, 4).TopPosZ(336, 16)) + ITEM(ArrayCtrl, Video, HSizePosZ(0, 4).TopPosZ(352, 56)) + ITEM(Label, dv___65, SetLabel(t_("Processors")).SetFrame(ThinOutsetFrame()).HSizePosZ(0, 4).TopPosZ(196, 16)) + ITEM(ArrayCtrl, Processors, HSizePosZ(0, 4).TopPosZ(212, 120)) + ITEM(Button, ButUpdate, SetLabel(t_("Update")).LeftPosZ(4, 88).BottomPosZ(5, 23)) +END_LAYOUT + +LAYOUT(ScreenGrabTab, 468, 204) + ITEM(LabelBox, dv___0, SetLabel(t_("Image Snapshot")).LeftPosZ(8, 452).TopPosZ(68, 40)) + ITEM(LabelBox, dv___1, SetLabel(t_("Video Grab")).LeftPosZ(8, 452).TopPosZ(4, 60)) + ITEM(LabelBox, dv___2, SetLabel(t_("Mode")).LeftPosZ(8, 452).TopPosZ(112, 84)) + ITEM(Label, dv___3, SetLabel(t_("secs/frame")).LeftPosZ(220, 56).TopPosZ(40, 19)) + ITEM(Label, Top, SetLabel(t_("Top:")).LeftPosZ(176, 24).TopPosZ(168, 19)) + ITEM(Label, Width, SetLabel(t_("Width:")).LeftPosZ(256, 36).TopPosZ(168, 19)) + ITEM(Label, Height, SetLabel(t_("Height:")).LeftPosZ(348, 40).TopPosZ(168, 19)) + ITEM(EditString, EditFileNameSnap, NotNull(true).LeftPosZ(72, 316).TopPosZ(84, 19)) + ITEM(EditString, EditFileNameGrab, NotNull(true).LeftPosZ(72, 316).TopPosZ(20, 19)) + ITEM(EditIntNotNull, EditTime, Min(1).LeftPosZ(72, 32).TopPosZ(40, 19)) + ITEM(EditIntNotNull, EditFrameRate, Min(0).LeftPosZ(196, 24).TopPosZ(40, 19)) + ITEM(Option, OpGrabMouse, SetLabel(t_("Grab mouse")).LeftPosZ(288, 76).TopPosZ(44, 16)) + ITEM(Switch, SwGrabMode, LeftPosZ(16, 80).TopPosZ(128, 64)) + ITEM(EditString, EditWindowTitle, LeftPosZ(164, 269).TopPosZ(148, 19)) + ITEM(EditInt, EditLeft, Min(0).LeftPosZ(120, 44).TopPosZ(168, 19)) + ITEM(EditInt, EditTop, Min(0).LeftPosZ(200, 44).TopPosZ(168, 19)) + ITEM(EditInt, EditWidth, Min(0).LeftPosZ(292, 44).TopPosZ(168, 19)) + ITEM(EditInt, EditHeight, Min(0).LeftPosZ(388, 44).TopPosZ(168, 19)) + ITEM(Label, Left, SetLabel(t_("Left:")).LeftPosZ(96, 24).TopPosZ(168, 19)) + ITEM(Label, dv___19, SetLabel(t_("Window Title:")).LeftPosZ(96, 64).TopPosZ(148, 19)) + ITEM(Label, dv___20, SetLabel(t_("File Name:")).LeftPosZ(16, 52).TopPosZ(84, 19)) + ITEM(Label, dv___21, SetLabel(t_("File Name:")).LeftPosZ(16, 52).TopPosZ(20, 19)) + ITEM(Button, ButSnap, SetLabel(t_("Snap it!")).LeftPosZ(392, 56).TopPosZ(84, 20)) + ITEM(Button, ButGrab, SetLabel(t_("Record it!")).LeftPosZ(392, 56).TopPosZ(20, 40)) + ITEM(Label, dv___24, SetLabel(t_("Frame rate:")).LeftPosZ(140, 56).TopPosZ(40, 19)) + ITEM(Label, dv___25, SetLabel(t_("sec")).LeftPosZ(104, 24).TopPosZ(40, 19)) + ITEM(Label, dv___26, SetLabel(t_("Time:")).LeftPosZ(16, 52).TopPosZ(40, 19)) +END_LAYOUT + +LAYOUT(WindowsList, 672, 120) + ITEM(Label, dv___0, SetLabel(t_("Windows list")).SetFrame(ThinOutsetFrame()).HSizePosZ(0, 4).TopPosZ(0, 16)) + ITEM(ArrayCtrl, Windows, HSizePosZ(0, 4).VSizePosZ(16, 36)) + ITEM(Button, ButUpdate, SetLabel(t_("Update")).LeftPosZ(4, 88).BottomPosZ(5, 23)) +END_LAYOUT + +LAYOUT(ProcessList, 672, 120) + ITEM(Label, dv___0, SetLabel(t_("Process list")).SetFrame(ThinOutsetFrame()).HSizePosZ(0, 4).TopPosZ(0, 16)) + ITEM(ArrayCtrl, Process, HSizePosZ(0, 4).VSizePosZ(16, 36)) + ITEM(Button, ButUpdate, SetLabel(t_("Update")).LeftPosZ(4, 88).BottomPosZ(5, 23)) +END_LAYOUT + diff --git a/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.rc b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.rc new file mode 100644 index 000000000..64c06670c --- /dev/null +++ b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.rc @@ -0,0 +1 @@ +5555 ICON DISCARDABLE "SysInfo_demo_gui.ico" diff --git a/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.upp b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.upp new file mode 100644 index 000000000..84a2dde4b --- /dev/null +++ b/bazaar/SysInfo_demo_gui/SysInfo_demo_gui.upp @@ -0,0 +1,27 @@ +description "Gui demo of SysInfo package\377"; + +uses + CtrlLib, + DropGrid, + plugin\jpg, + plugin\jpg, + plugin\gif, + plugin\gif, + Web, + plugin\png, + plugin\bmp, + SysInfo; + +library(WIN32) psapi; + +file + main.cpp, + SysInfo_demo_gui.h, + SysInfo_demo_gui.iml, + SysInfo_demo_gui.lay, + SysInfo_demo_gui.rc, + Readme; + +mainconfig + "" = "GUI"; + diff --git a/bazaar/SysInfo_demo_gui/init b/bazaar/SysInfo_demo_gui/init new file mode 100644 index 000000000..f0a6562ea --- /dev/null +++ b/bazaar/SysInfo_demo_gui/init @@ -0,0 +1,11 @@ +#ifndef _SysInfo_demo_gui_icpp_init_stub +#define _SysInfo_demo_gui_icpp_init_stub +#include "CtrlLib/init" +#include "DropGrid/init" +#include "plugin\jpg/init" +#include "plugin\gif/init" +#include "Web/init" +#include "plugin\png/init" +#include "plugin\bmp/init" +#include "SysInfo/init" +#endif diff --git a/bazaar/SysInfo_demo_gui/main.cpp b/bazaar/SysInfo_demo_gui/main.cpp new file mode 100644 index 000000000..c1cb1c641 --- /dev/null +++ b/bazaar/SysInfo_demo_gui/main.cpp @@ -0,0 +1,395 @@ +#include + +#include "SysInfo/SysInfo.h" +#include "SysInfo_demo_gui.h" + +#define IMAGEFILE +#define IMAGECLASS Images +#include +#define LAYOUTFILE + +//using namespace Upp; + +GUI_APP_MAIN +{ + SysInfoDemo program; + + SetLanguage(LNGC_('E','N','U','S', CHARSET_UTF8)); + + program.Run(); +} + +void SpecialFolders::Fill() +{ + TextDesktop.SetText(GetDesktopFolder()); + TextPrograms.SetText(GetProgramsFolder()); + TextApplication.SetText(GetAppDataFolder()); + TextMusic.SetText(GetMusicFolder()); + TextPictures.SetText(GetPicturesFolder()); + TextVideo.SetText(GetVideoFolder()); + TextPersonal.SetText(GetPersonalFolder()); + TextTemplates.SetText(GetTemplatesFolder()); + TextDownload.SetText(GetDownloadFolder()); + TextTemp.SetText(GetTempFolder()); + TextOs.SetText(GetOsFolder()); + TextSystem.SetText(GetSystemFolder()); + + DefaultExes.Reset(); + DefaultExes.AddColumn("Extension", 5); + DefaultExes.AddColumn("Program", 40); + const char *ext[] = {".html", ".doc", ".png", ".pdf", ".txt", ".xyz", ""}; + for (int i = 0; *ext[i] != 0; ++i) + DefaultExes.Add(ext[i], GetExtExecutable(ext[i])); +#if defined(PLATFORM_WIN32) + ButInstalledSoftware.WhenPush = THISBACK(ButInstalledSoftware_Push); +#else + SoftwareInstalled.Enable(false); + ButInstalledSoftware.Enable(false); +#endif +} +void SpecialFolders::ButInstalledSoftware_Push() +{ +#if defined(PLATFORM_WIN32) + ButInstalledSoftware.SetLabel("Getting list ..."); + ButInstalledSoftware.ProcessEvents(); + SoftwareInstalled.Reset(); + SoftwareInstalled.AddColumn("Name", 60); + SoftwareInstalled.AddColumn("Version", 15); + SoftwareInstalled.AddColumn("Vendor", 30); + SoftwareInstalled.AddColumn("Install Date", 15); + SoftwareInstalled.AddColumn("Caption", 60); + SoftwareInstalled.AddColumn("Description", 60); + SoftwareInstalled.AddColumn("Install State", 10); + Array name, version, vendor, caption, installDate, description, state; + if (GetPackagesInfo(name, version, vendor, installDate, caption, description, state)) { + for (int i = 0; i < name.GetCount(); ++i) + SoftwareInstalled.Add(name[i], version[i], vendor[i], installDate[i], caption[i], description[i], state[i]); + } + ButInstalledSoftware.SetLabel("Get installed software list"); +#endif +} + +void SystemInfo::Fill() +{ + String manufacturer, productName, version; + Date releaseDate; + int numberOfProcessors; + GetSystemInfo(manufacturer, productName, version, numberOfProcessors); + + TextManufacturer.SetText(manufacturer); + TextProductName.SetText(productName); + TextVersion.SetText(version); + TextNumber.SetText(AsString(numberOfProcessors)); + TextSpeed.SetText(Format("%.3f GHz", GetCpuSpeed()/1000.)); + + String biosVersion; + Date biosReleaseDate; + GetBiosInfo(biosVersion, biosReleaseDate); + TextBiosVersion.SetText(biosVersion); + TextBiosRelease.SetText(AsString(biosReleaseDate)); + + String kernel, kerVersion, kerArchitecture, distro, distVersion, desktop, deskVersion; + if (GetOsInfo(kernel, kerVersion, kerArchitecture, distro, distVersion, desktop, deskVersion)) { + TextKernel.SetText(kernel); + TextKerVersion.SetText(kerVersion); + TextKerArchitecture.SetText(kerArchitecture); + TextDistro.SetText(distro); + TextDistVersion.SetText(distVersion); + TextDesktop.SetText(desktop); + TextDeskVersion.SetText(deskVersion); + } + + int memoryLoad; + uint64 totalPhys, freePhys, totalPageFile, freePageFile, totalVirtual, freeVirtual; + if (GetMemoryInfo(memoryLoad, totalPhys, freePhys, totalPageFile, freePageFile, totalVirtual, freeVirtual)) { + TextMemPercentage.SetText(FormatInt(memoryLoad)); + TextMemTotPhysicalbytes.SetText(Format64(totalPhys)); + TextMemTotPhysical.SetText(BytesToString(totalPhys)); + TextMemFreePhysicalbytes.SetText(Format64(freePhys)); + TextMemFreePhysical.SetText(BytesToString(freePhys)); + TextMemTotPagingbytes.SetText(Format64(totalPageFile)); + TextMemTotPaging.SetText(BytesToString(totalPageFile)); + TextMemFreePagingbytes.SetText(Format64(freePageFile)); + TextMemFreePaging.SetText(BytesToString(freePageFile)); + TextMemTotVirtualbytes.SetText(Format64(totalVirtual)); + TextMemTotVirtual.SetText(BytesToString(totalVirtual)); + TextMemFreeVirtualbytes.SetText(Format64(freeVirtual)); + TextMemFreeVirtual.SetText(BytesToString(freeVirtual)); + } + String compiler, date; + int compilerVersion; + GetCompilerInfo(compiler, compilerVersion, date); + TextCompiler.SetText(compiler); + TextCompilerVersion.SetText(FormatInt(compilerVersion)); + TextCompilationDate.SetText(date); + + Processors.Reset(); + Processors.AddColumn("Processor", 6); + Processors.AddColumn("Vendor", 12); + Processors.AddColumn("Identifier", 40); + Processors.AddColumn("Architecture", 30); + Processors.AddColumn("Speed MHz", 10); + String vendor, identifier, architecture; + int speed; + for (int i = 0; i < numberOfProcessors; ++i) { + GetProcessorInfo(i, vendor, identifier, architecture, speed); + Processors.Add(Format("#%d", i), vendor, identifier, architecture, FormatInt(speed)); + } +#if defined(PLATFORM_WIN32) + Video.Reset(); + Video.AddColumn("Name", 10); + Video.AddColumn("Description", 10); + Video.AddColumn("Video Processor", 10); + Video.AddColumn("Adapter RAM Mb", 6); + Video.AddColumn("Video Mode Description", 10); + Array name, description, videoProcessor, videoMode, ram; + if (GetVideoInfo(name, description, videoProcessor, ram, videoMode)) { + for (int i = 0; i < name.GetCount(); ++i) + Video.Add(name[i], description[i], videoProcessor[i], ram[i], videoMode[i]); + } else + Video.Add("Video data not accesible"); +#else + Video.Enable(false); +#endif + Drives.Reset(); + Drives.AddColumn("Path", 10); + Drives.AddColumn("Type", 10); + Drives.AddColumn("Volume", 10); + Drives.AddColumn("Max name", 5); + Drives.AddColumn("File System", 5); + Drives.AddColumn("Total User bytes", 10); + Drives.AddColumn("Total User", 6); + Drives.AddColumn("Free User bytes", 10); + Drives.AddColumn("Free User", 6); + Drives.AddColumn("Total Free bytes", 10); + Drives.AddColumn("Total Free", 6); + Array drives; + drives = GetDriveList(); + for (int i = 0; i < drives.GetCount(); ++i) { + Vector row; + row.Clear(); + row.Add(drives[i]); + String type, volume, fileSystem; + int maxName; + bool mounted = GetDriveInformation(drives[i], type, volume, maxName, fileSystem); + if (mounted) { + row.Add(type); + row.Add(volume); + row.Add(maxName); + row.Add(fileSystem); + uint64 freeBytesUser, totalBytesUser, totalFreeBytes; + if(!GetDriveSpace(drives[i], freeBytesUser, totalBytesUser, totalFreeBytes)) + row.Add("Installed but no access to drive"); + else { + row.Add(Format64(totalBytesUser)); + row.Add(BytesToString(totalBytesUser)); + row.Add(Format64(freeBytesUser)); + row.Add(BytesToString(freeBytesUser)); + row.Add(Format64(totalFreeBytes)); + row.Add(BytesToString(totalFreeBytes)); + } + } else + row.Add("Not mounted"); + + Drives.Add(row); + } + ButUpdate.WhenPush = THISBACK(ButUpdate_Push); +} +void SystemInfo::ButUpdate_Push() +{ + Fill(); +} + +void WindowsList_::Fill() +{ + Windows.Reset(); + Windows.AddColumn("Title", 30); + Windows.AddColumn("Window handle", 6); + Windows.AddColumn("Process Id", 6); + Windows.AddColumn("Name", 20); + Windows.AddColumn("File name", 30); + Array widL, pidL; + Array name, fileName, caption; + GetWindowsList(widL, pidL, name, fileName, caption); + for (int i = 0; i < widL.GetCount(); ++i) + Windows.Add(caption[i], FormatLong(widL[i]), FormatLong(pidL[i]), name[i], fileName[i]); + ButUpdate.WhenPush = THISBACK(ButUpdate_Push); +} +void WindowsList_::ButUpdate_Push() +{ + Fill(); +} + +void ProcessList::Fill() +{ + Process.Reset(); + Process.AddColumn("Id", 6); + Process.AddColumn("Priority", 6); + Process.AddColumn("Program", 12); + Array pidL; + pidL.Clear(); + Array pNames; + if (!GetProcessList(pidL, pNames)) + Process.Add("Error getting process info"); + else { + for (int i = 0; i < pidL.GetCount(); ++i) { + int priority = GetProcessPriority(pidL[i]); + Process.Add(FormatLong(pidL[i]), priority >= 0? FormatInt(priority): "Not accesible", pNames[i]); + } + } + ButUpdate.WhenPush = THISBACK(ButUpdate_Push); +} +void ProcessList::ButUpdate_Push() +{ + Fill(); +} + +void ScreenGrabTab::Fill() +{ + EditFileNameGrab <<= AppendFileName(GetDesktopFolder(), "ScreenGrab.avi"); + EditTime <<= 5; + EditFrameRate <<= 1; + OpGrabMouse <<= true; + SwGrabMode.Add("Desktop"); + SwGrabMode.Add("Window"); +#if defined(PLATFORM_WIN32) + SwGrabMode.Add("Rectangle"); +#endif + SwGrabMode.MinCaseHeight(20); + SwGrabMode.SetData(0); + SwGrabMode.WhenAction = THISBACK(SwGrabMode_Action); + SwGrabMode_Action(); +#if defined(PLATFORM_WIN32) + ButGrab.WhenPush = THISBACK(ButGrab_Push); +#else + ButGrab.Enable(false); + EditFileNameGrab.Enable(false); + EditTime.Enable(false); + EditFrameRate.Enable(false); + OpGrabMouse.Enable(false); + EditLeft.Hide(); + EditTop.Hide(); + EditWidth.Hide(); + EditHeight.Hide(); + Left.Hide(); + Top.Hide(); + Width.Hide(); + Height.Hide(); +#endif + + String extension; +#if defined(PLATFORM_WIN32) + extension = "bmp"; +#else + extension = "xwd"; +#endif + EditFileNameSnap <<= AppendFileName(GetDesktopFolder(), "ScreenSnap." + extension); + ButSnap.WhenPush = THISBACK(ButSnap_Push); +} + +void ScreenGrabTab::SwGrabMode_Action() +{ + switch((int)SwGrabMode.GetData()) { + case 0: + EditLeft.Enable(false); + EditTop.Enable(false); + EditWidth.Enable(false); + EditHeight.Enable(false); + EditWindowTitle.Enable(false); + break; + case 1: + EditLeft.Enable(false); + EditTop.Enable(false); + EditWidth.Enable(false); + EditHeight.Enable(false); + EditWindowTitle.Enable(true); + break; + case 2: + EditLeft.Enable(true); + EditTop.Enable(true); + EditWidth.Enable(true); + EditHeight.Enable(true); + EditWindowTitle.Enable(false); + break; + } +} + +void ScreenGrabTab::ButGrab_Push() +{ +#if defined(PLATFORM_WIN32) + FileDelete(EditFileNameGrab.GetData().ToString()); + + if (SwGrabMode.GetData() == 0) + Record_Desktop(EditFileNameGrab, EditTime, EditFrameRate, OpGrabMouse); + else if (SwGrabMode.GetData() == 1) + Record_Window(EditFileNameGrab, EditTime, GetWindowIdFromCaption(EditWindowTitle, false), EditFrameRate, OpGrabMouse); + else if (SwGrabMode.GetData() == 2) + Record_DesktopRectangle(EditFileNameGrab, EditTime, EditLeft, EditTop, EditWidth, EditHeight, EditFrameRate, OpGrabMouse); + else + throw Exc("Unexpected value"); +#endif +} + +void ScreenGrabTab::ButSnap_Push() +{ + FileDelete(EditFileNameSnap.GetData().ToString()); + + if (SwGrabMode.GetData() == 0) + Snap_Desktop(EditFileNameSnap); + else if (SwGrabMode.GetData() == 1) + Snap_Window(EditFileNameSnap, GetWindowIdFromCaption(EditWindowTitle, false)); + else if (SwGrabMode.GetData() == 2) + Snap_DesktopRectangle(EditFileNameSnap, EditLeft, EditTop, EditWidth, EditHeight); + else + throw Exc("Unexpected value"); +} + +SysInfoDemo::SysInfoDemo() +{ + Title("SysInfo"); + Icon(Images::Computer()); + LargeIcon(Images::Computer()); + + systemInfo.Fill(); + filesTab.Add(systemInfo.SizePos(), "System Info"); + windowsList.Fill(); + filesTab.Add(windowsList.SizePos(), "Windows list"); + processList.Fill(); + filesTab.Add(processList.SizePos(), "Process list"); + specialFolders.Fill(); + filesTab.Add(specialFolders.SizePos(), "Special Folders/Executables/Installed Software"); + screenGrab.Fill(); + filesTab.Add(screenGrab.SizePos(), "Screen Grab"); + + AddFrame(menu); + AddFrame(TopSeparatorFrame()); + AddFrame(info); + Add(filesTab.SizePos()); + + menu.Set(THISBACK(MainMenu)); + menu.WhenHelp = info; + + Sizeable().Zoomable(); +} + +void SysInfoDemo::MainMenu(Bar& bar) +{ + menu.Add("Menu", THISBACK(FileMenu)); +} + +void SysInfoDemo::FileMenu(Bar& bar) +{ + bar.Add("About...", THISBACK(About)).Help("SysInfo demo gui: SysInfo package demo"); + bar.Separator(); + bar.Add("Exit", THISBACK(Exit)).Help("Leave the program"); +} + +void SysInfoDemo::About() +{ + Prompt("SysInfo demo gui", Images::Computer(), DeQtf("SysInfo package demo"), "Close"); +} + +void SysInfoDemo::Exit() +{ + Break(); +}