Changes in SuperWaba 2.0 beta 4 release 8 DONT FORGET TO TURN OFF "SCREEN ACCESS" IN EMULATOR!!! *** Note: some changes in the constants behaviour may make your controls move around, due to the clientRect. *** 124. changed default values of Container.lastX/Y to -1. Now, if BEFORE/AFTER is used without a previous absolute coordinate added, they is set to the Window's client rect x/y positions. Also, TOP/LEFT/RIGHT/BOTTOM use the Window client rect too. 125. changed how the control's colors are initialized. Now, only Containers have assigned its foreColor and backColors in their constructors. These two colors are now initialy NULL in the other controls, and when the control is added to the container, the container veryfies if the colors are still NULL; if so, they are initialized to the container's colors. This test must be done bc some controls (like the Check box and Radio change their colors to white as default). 126. now all controls erase its background every time they are repainted. this is necessary bc a control's background color may be different from the container's. 127. fixed array index out of bounds in Palette class when getColor index was greater than the convertion table index. . reformatted ScrollBar . fixed TabPanel and label 3d paints. . fixed Calculator behaviour. 128. now the SAME constant can be used in the width/height 129. added new constructor to class Edit. Now you can specify defaultWidth based in the mask given in the new constructor. Note that this mask is not used to mask the control's input. This will be left to another control in the future (in a separate library that i hope someone build). 130. fixed ListBox when using getPreferredWidth. . changed all onEvent method in controls to use switch instead of a bunch of if's . optimized ScrollBar. Now its working perfectly and has 2 styles: palmOS and WinCE. . changed Graphics.draw3dRect. removed controlShadow1/3. Now the rect is drawed based in the control's fore and back colors. 131. Now the Window is erased only if a full repaint is needed; otherwise, the background erasing is left to the control do it. This may reintroduce some repainting problems, but it is necessary bc its far more efficient. 132. new flag in Event: consumed. Set to true to stop the event propagation to the parents. 133. changed ListBox constructor to startup faster. 134. changed ComboBox constructors to startup faster. You may need to change your code. See ComboBox source code for details . changed ListBox to use ScrollBar. 135. deep reestructuration of the repaint method. Now, instead of mark a area for repaint, the repaint control is added to a vector at the parent Window; then, all controls in this vector are repainted. This may reintroduce bugs, but will avoid unnecessary repaints. . new field parentWindow in class Container. This speeds up the repaint . changed Vm.oldStyle to Vm.uiStyle, who can assume the values Vm.PalmOS and Vm.WinCE. 136. added parameter /uiStyle to applet. . removed warning for appPath. 137. new method Settings.setPalmOSStyle(boolean withWhiteBackground). Must be called in MainWindow's constructor. 138. new method Control.setRect(x,y,width,height,Control relative) to let you set the coords relative to the ones of the given control, instead to just the last one. new method Container.add(Control control, int x, int y, Control relative) . Shrinked welcome class. Some menu entries went to .txt files in the org/superwaba directory. . fixed Compression javadocs. . added Vik changed to Socket class at VM to correct a bug that was not restarting the Socket after a timeout . changed in all java files * by << and / by >> when possible. 139. changed back & 999 to % 1000 and & 9 to % 10. This was a bad thing i did and Peter Dickerson reminded me. This fixes a wrong time calculation issue and also a double2str wrong formatting one. 140. fixed bug when alarm was called and SW was running. 141. This one i'm sure everybody will like: added retroguard to the ext folder. This program is a freeware that obfuscates the code, by changing variables and method to 2 letters only. In the VM, it saves only about 5%, but in a finished program, it may save 30-40%. I used this since 1999, and i love this program. I decided to share this with SuperWaba users. *** Note on retroguard use: you must make sure the main class name and onStart method are not obfuscated or your program can not run. Read its docs. . now the make.bat file uses retroguard to shrink the VM . To see an example of how to use retroguard to shrink your files, please see the make.bat file at examples/GuiBuilder. In this case, retroguard shrinked from 30kb to 24.6kb . added Tomas Roher changes to fix some Scanner bugs related to barcode length. . as Sean Luke suggested, i removed the CharacterConverter member of String class and placed it in the ConvertClass. 142. new Label.canScroll that returns if the label can scroll in the specified direction. 143. now the arrows in MessageBox grays out when the limits are reached. 144. fixed array index out of bounds in PushButtonGroup (not tested) 145. now when you call ListBox.select, the item is made visible if its not. 146. CANCELED: changed setFocus: now only enabled items can receive focus. Putted a message to alert user. 147. now if the target of a keypress event is not enabled, the focus is changed to the first enabled parent. 148. fixed Date.setDayOfWeek. changed the algorithm. 149. now the Vm.onDevice is false as default. In waba.sys.Settings constructor we set it. 150. at waba.sys.NativeMethods4JDK we test if the waba.applet.Applet is created. See the class for more details. 151. now the NativeMethods.nm will always construct a 4JDK. The VM will tweak the name to load the correct class. . fixed IKeys documentation. . added -g:none -O to all make.bat files. -- start of High level optimizations 152. new method Control.onColorsChanged. Called after a setEnabled, setForeColor and setBackColor 153. new method Control.onFontChanged; called in Control.setFont. 154. new Control.currentFore/BackColor: state dependent colors . now all waba.fx classes are final. . new field Control.fmH = fm.getHeight(). . Combo now changes focus to listbox when its poped up. 155. fixed bug when Edit's cursor was drawn after the bounds. 156. fixed TabPanel.captionColor. Now it is used to set the caption color of the tab panel. . changed Control.isDisplayed to true. . avoided unnecessary createGraphics. 157. fixed window move not computing the initial distance. 158. changed Color luminance formula in getGray to improve performance. . changed RelativeLayoutInfo. Since now Rect is final, we tack a Rect member in it. . fixed PushButtonGroup: now you can change the font before calling getPreferredW/H. -- final optimizations result: 85910ms -> 64040ms. ! removed some methods from class Vm and putted as constants in class Settings. Below is the convertion table: . Vm.oldStyle==true -> Settings.uiStyle == Settings.PalmOS . Vm.oldStyle==false -> Settings.uiStyle == Settings.WinCE . Vm.getScreenSize() -> Settings.screenWidth,Settings.screenHeight . Vm.isColor() -> Settings.isColor . Vm.getMaxColors() -> Settings.maxColors . Vm.getUserName() -> Settings.userName . Vm.getPlatform() -> Settings.platform . Vm.getVersion() -> Settings.version . Vm.getRomVersion() -> Settings.romVersion . Vm.getFreeClassHeap() -> Vm.getDeviceFreeMemory Remember that Settings properties are always read-only. Writing to them doesnt change any behaviour and may lead the VM to crash. Use Settings.setPalmOSStyle(boolean withWhiteBackground) to switch layouts. 159. added Vm.gc to explicitly call the garbage collector. . moved Graphic*.c to SWNatives directory. . made Vm, Settings and Time final. . now the fast assembler functions are used in all devices and OS versions. This eliminates the slow-but-compatible PalmOS functions, but boost performance up to 5x 160. fixed getting of colors in Visor Prism devices with offscreen bitmaps 161. fixed wrong repaint when moving Keyboard window. 162. NOTE: THIS DIDNT WORK. NEED TO THINK MORE HOW TO HANDLE THIS PROBLEM. created a timer to make sure that the window will be repainted. on the damageRect method, a timer is set. (windows are repainted every time an event occurs; if a window is marked for repaint and no event occurs, the window is never repainted. With this dummy timer, we can ensure that the window will be repainted) 163. new flag Window.eraseBackgroundNow. It erases the background in the next window repaint only. Used in Control.setVisible. 164. new Graphics.getFont: returns the last font set with setFont. 165. fixed bug when you called gImg.free (an image Graphics object) followed by a img.free. Please void do this, anyway (call only img.free) 166. fixed problem when clicking on the menu, on the about and on the menu again. 167. fixed bug in Edit that it was creating too much timers (specially in the Keyboard popup) . putted a good explanation at Control.repaint javadocs regarding issue 162 . note regarding UI Styles: WinCE is looks better with bright background; PalmOS looks better with white background. 168. Vik: Changed socket code so that allUp is accessable when we check to see if the Netlib open worked. If either the Netlib or any of the interfaces called by Netlib fail to come up, we close Netlib. This makes the next Netlib open restart any closed connections. . removed Control.repaintNow(boolean eraseBack). Since now each control erase its background, this flag is unneeded.