Contraster v.02 Beta; Author: Dave Anderson ---------------------------------------------------------- NEW RELEASE! 3 times as many features! (v.01 had one feature) With today's creeping featurism, I felt that I should get a leg up on MicroGraft(Soft). Even the mighty Gates has never had the audacity to triple the number of features between minor releases! :) The drawback is that the package takes up about 20%(1.3K) more storage, and uses twice as much heap as the previous version(Now about 400bytes). Billy Boy would likely be unimpressed, since the M$(Multiple Sclerosis) way would be to increase the resource requirements by an order of magnitude or two for such a revolutionary increase in functionality. Seriously though, I discovered upon installation of the 717260 upgrade on my MP2000 that Contraster no longer worked properly; re-centering using Extras made the slider adjust too far in one direction, and not far enough in the other. This bug is fixed in this release, though you should check "Known bugs" below. Contraster v.02 Beta adds a button for re-centering the contrast slider, as well as a button to reset to "No Offset". These two extra buttons are normally not visible, and are accessed by tapping on the pallette bar that appears above the slider. -------------------------[Original README]--------------------------------- This is the first really useful package that I have made since obtaining my first copy of NTK... Technically, it's my second package that actually works. :) The first one simply adds a number of cool "Lost In Space" robot sound bites, but since WinNTK stupidly insists on bringing sounds in at 22KHz, my 9 sounds take up >400K. :( I put this info at the beginning of this file so that you will understand the full implications of the phrase "You're on your own" as it applies to this software. I'm a rookie at this, but I have years of experience with other languages and with software QA in general. Within the limitations of my ability to design and test, I can say that I have not had any problems with Contraster(since I got it right)(NOTE for v.02; see "Known Bugs") And I have made my best, most conscientious effort to see that you don't either. However, I will only be responsible for an amount not to exceed the purchase price, which is zilch or nada, depending on your local currency. :) The risk is yours, my friend. Contraster is extremely handy for twiddling screen contrast while running NetHopper; when you are dangling by a heap-based thread, the last thing you want to do is open up a heap hog like the Extras Drawer. The preferred way to launch Contraster is via some 3rd party package launcher(I use i++). Of course it can be launched by tapping the icon in Extras(so much for not eating heap...). Contraster consists of a tiny floating window which contains a contrast slider, a narrow band of 16 shades of grey(for reference) and a close box. Very basic! I built this package to get around the problems I was having while viewing large images in Nethopper. Opening Extras usually covers about half of the screen(often more) making it difficult to determine if the image looks acceptable while adjusting the contrast. Additionally, the heap needed to open Extras would occasionally push my MP2000 over the edge, causing resets while online or at best, things would begin to run real slow. Contraster uses very little screen real estate and very little heap. Its floating, draggable window is about twice the size of an Extras Icon. My best guess at heap usage is <200 bytes, but since HeapShow often shows fluctuations of between 0.2K and 1K depending on what IdleScripts are running, I can't give an exact number. Since there are about a zillion app-launchers out there, I made no attempt to tie Contraster in with Nethopper's (or anyone else's) status bars. Just run it from a launcher(like i++), and close it when you're done. It's so tiny that I often leave it floating around while browsing. Try it; you'll like it! NOTE: This package should not let you install it on any 1.x devices(It was compiled for 2.x, so it shouldn't work on 1.x, I suppose). It should install on any 2.x device, but when you launch it it checks to make sure that it is installed on a device that supports software-controlled LCD contrast adjustment and is supposed to shut itself down if such is not the case(e.g. MP120, MP130). If someone out there is really bored and would like to test this for me, I would very much appreciate it. :) Comments, Suggestions, Questions, Feedback to 1-800-EAT... >OOPS< Comments, Suggestions, Questions, Feedback to 72110.3112@compuserve.com --------------------------[Files in this archive]------------------------------- CONTRST1.TXT - What you are reading CONTRST1.PKG - Duh. CONTRAST.ZIP - Contraster v.01 for those who wish for simpler times... --------------------------[Version History]------------------------------------- v.02 - Added option to tap pallette to expand window and display new buttons - Added "Recenter" button to expanded window; No Prompts, just tap. - Added "No Offset" button to expanded window; one tap removes offsets. v.01 - First Release. No Known bugs. -----------------------------[Known Bugs]--------------------------------------- - When Tapping "Re-Center" or "No Offset" with Extras open, the contrast slider in the Extras Drawer is not updated unless Extras is closed then re-opened. Workarounds: Duh. - When using the built-in "Re-Center" facility, if Contraster is open, then Contraster's slider will not update unless the pallette bar is tapped or the app is closed and reopened. Workarounds: See Above. --------------------[Contraster v.02 Source(Ain't I nice?)]--------------------- // Text of project D:\NTK\DAVE\MINE\CONTRAST\CNTRST04.NTK written on: 11/23/97 23:09:09 // Beginning of file CNTRST04.LYT ContrastApp := {viewBounds: {left: -11, top: 160, bottom: 177, right: 57}, viewEffect: 12317834, ViewSetupFormScript: // be sure to call inherited:?ViewSetupFormScript() func() begin inherited:?ViewSetupFormScript(); local ThisViewSize := nil; // flag for determining size of this view. local ContrastInfo := Gestalt(kGestaltArg_HasSoftContrast); local msg := nil; if ContrastInfo and ContrastInfo[0] then begin SetValue(myContrastSlider, 'MinValue, ContrastInfo[1] + GetUserConfig('UniC)); SetValue(myContrastSlider, 'MaxValue, ContrastInfo[2] + GetUserConfig('UniC)); msg; end else begin // unit does not have Soft Contrast. msg := "Sorry, This Application only works on Messagepad models that have software-controlled contrast." end; ContrastInfo := nil; if msg then begin :Notify(kNotifyAlert, "Contraster", msg); self.viewbounds := Setbounds(-70, -18, -1, -1); self.viewJustify := vjParentLeftH + vjParentTopV; AddDeferredCall( func() begin :Close(); removeSlot(self, 'viewBounds); removeSlot(self, 'viewJustify); end, nil); end; end, ViewSetupDoneScript: func() begin end, _proto: @180 }; myContrastSlider := /* child of ContrastApp */ {viewBounds: {left: 1, top: 8, right: 51, bottom: 18}, gaugeDrawLimits: true, trackSlider: func() begin SetUserConfig('LCDContrast, viewValue); end, ViewSetupFormScript: func() begin // set the initial values for the slider self.viewValue := GetUserConfig('LCDContrast); end, ViewQuitScript: // must return the value of inherited:?ViewQuitScript() func() begin inherited:?ViewQuitScript(); UnRegUserConfigChange(UserConfigChangeSym); end, ViewSetupDoneScript: func() begin self.UserConfigChangeSym := Intern("ContrastSlider." & viewCObject); RegUserConfigChange(UserConfigChangeSym, func(Arg1) begin :HandleConfigChange(Arg1) end); end, HandleConfigChange: func(Arg1) begin local Local1; Local1 := GetUserConfig('LCDContrast); Arg1 = 'LCDContrast and viewValue <> Local1 and SetValue(self, 'viewValue, Local1); SetValue(self, 'MinValue, :Parent().ContrastInfo[1] + GetUserConfig('UniC)); SetValue(self, 'MaxValue, :Parent().ContrastInfo[2] + GetUserConfig('UniC)); end, changedSlider: func() begin end, _proto: @212 }; // View myContrastSlider is declared to ContrastApp _view000 := /* child of ContrastApp */ {_proto: @166}; Pallette := /* child of ContrastApp */ {viewBounds: {left: 1, top: 1, right: 52, bottom: 6}, buttonClickScript: func() begin local box := :Parent().ViewBounds; if :Parent().ThisViewSize then begin NewBottom := box.bottom - 17; SetValue(:Parent(), 'viewBounds, SetBounds(box.left, box.top, box.right, NewBottom)); SetValue(:Parent(), 'ThisViewSize, nil); end else begin NewBottom := box.bottom + 17; SetValue(:Parent(), 'viewBounds, SetBounds(box.left, box.top, box.right, NewBottom)); SetValue(:Parent(), 'ThisViewSize, "Big"); end; end, icon: BuildPictureViewSlot({ imageFile4: "PALLETTE.BMP", maskOption: 0}), viewFormat: 81, viewFlags: 515, _proto: @198 }; // View Pallette is declared to ContrastApp Center := /* child of ContrastApp */ {viewBounds: {left: -13, top: -31, bottom: -20, right: -2}, buttonClickScript: func() begin If GetUserConfig('LCDContrast) = GetUserConfig('UniC) then begin // Print("Do Nothing"); end else begin Local Offset := GetUserConfig('LCDContrast) - GetUserConfig('UniC); SetUserConfig('UniC, Offset); SetValue(myContrastSlider, 'MinValue, myContrastSlider.MinValue + Offset); SetValue(myContrastSlider, 'MaxValue, myContrastSlider.MaxValue + Offset); end; end, viewJustify: 166, viewFormat: 117441105, icon: BuildPictureViewSlot({ imageFile4: "9X9CNTR.BMP", maskOption: 0}), _proto: @198 }; _view001 := /* child of ContrastApp */ { buttonClickScript: func() begin Local Offset := GetUserConfig('UniC); SetUserConfig('UniC, 0); SetUserConfig('LCDContrast, 0); SetValue(myContrastSlider, 'MinValue, myContrastSlider.MinValue - Offset); SetValue(myContrastSlider, 'MaxValue, myContrastSlider.MaxValue - Offset); end, text: "No Offset", viewBounds: {left: 4, top: 21, right: 50, bottom: 30}, viewFont: ROM_fontSystem9, _proto: @226 }; constant |layout_CNTRST04.LYT| := ContrastApp; // End of file CNTRST04.LYT =============================================================================== =============================================================================== --------------------[Contraster v.01 Source(Ain't I nice?)]------------------------- // Text of project D:\NTK\DAVE\MINE\CONTRAST\CNTRST03.NTK written on: 11/13/97 08:10:50 // Beginning of file CNTRST03.LYT ContrastApp := {viewBounds: {left: -11, top: 160, bottom: 177, right: 57}, viewEffect: 12317834, ViewSetupFormScript: // be sure to call inherited:?ViewSetupFormScript() func() begin inherited:?ViewSetupFormScript(); local ContrastInfo := Gestalt(kGestaltArg_HasSoftContrast); local msg := nil; if ContrastInfo and ContrastInfo[0] then begin SetValue(myContrastSlider, 'MinValue, ContrastInfo[1]); SetValue(myContrastSlider, 'MaxValue, ContrastInfo[2]); msg; end else begin // unit does not have Soft Contrast. msg := "Sorry, This Application only works on Messagepad models that have software-controlled contrast." end; ContrastInfo := nil; if msg then begin :Notify(kNotifyAlert, "Contraster", msg); self.viewbounds := Setbounds(-70, -18, -1, -1); self.viewJustify := vjParentLeftH + vjParentTopV; AddDeferredCall( func() begin :Close(); removeSlot(self, 'viewBounds); removeSlot(self, 'viewJustify); end, nil); end; end, _proto: @180 }; myContrastSlider := /* child of ContrastApp */ {viewBounds: {left: 1, top: 8, right: 51, bottom: 18}, gaugeDrawLimits: true, trackSlider: func() begin SetUserConfig('LCDContrast, viewValue); end, ViewSetupFormScript: func() begin // set the initial values for the slider self.viewValue := GetUserConfig('LCDContrast); end, ViewQuitScript: // must return the value of inherited:?ViewQuitScript() func() begin inherited:?ViewQuitScript(); UnRegUserConfigChange(UserConfigChangeSym); end, ViewSetupDoneScript: func() begin self.UserConfigChangeSym := Intern("ContrastSlider." & viewCObject); RegUserConfigChange(UserConfigChangeSym, func(Arg1) begin :HandleConfigChange(Arg1) end); end, HandleConfigChange: func(Arg1) begin local Local1; Local1 := GetUserConfig('LCDContrast); Arg1 = 'LCDContrast and viewValue <> Local1 and SetValue(self, 'viewValue, Local1); end, changedSlider: func() begin end, _proto: @212 }; // View myContrastSlider is declared to ContrastApp _view000 := /* child of ContrastApp */ {_proto: @166}; _view001 := /* child of ContrastApp */ {viewBounds: {left: 1, top: 1, right: 52, bottom: 6}, buttonClickScript: func() begin end, icon: BuildPictureViewSlot({ imageFile4: "PALLETTE.BMP", maskOption: 0}), viewFormat: 81, viewFlags: 3, _proto: @198 }; constant |layout_CNTRST03.LYT| := ContrastApp; // End of file CNTRST03.LYT