public void resizeTo(int pWidth, int pHeight) { super.resizeTo(pWidth, pHeight); Rect coordsRect = CoordsP.getRect(); int roseHeight = pHeight - coordsRect.y - coordsRect.height; if (Gui.screenIs(Gui.PDA_SCREEN) && Vm.isMobile()) { // some space for the SIP button if ((Vm.getParameter(VmConstants.VM_FLAGS) & (VmConstants.VM_FLAG_SIP_BUTTON_ON_SCREEN)) == (VmConstants.VM_FLAG_SIP_BUTTON_ON_SCREEN)) { Rect screen = (Rect) Window.getGuiInfo(WindowConstants.INFO_SCREEN_RECT, null, new Rect(), 0); roseHeight -= screen.height / 14; } } roseP.resizeTo(pWidth, roseHeight); icRose.resizeTo(pWidth, roseHeight); compassRose.resize(pWidth, roseHeight); }
public AttributesSelector() { scp.setOptions(MyScrollBarPanel.NeverShowHorizontalScrollers); TILESIZE = 30; W_OFFSET = 100; H_OFFSET = 150; if (Vm.isMobile()) { if (MyLocale.getScreenWidth() == 240 & MyLocale.getScreenHeight() == 320) { TILESIZE = 28; W_OFFSET = 80; H_OFFSET = 120; } if (MyLocale.getScreenWidth() == 320 & MyLocale.getScreenHeight() == 240) {} if (MyLocale.getScreenWidth() == 480 & MyLocale.getScreenHeight() == 640) {} if (MyLocale.getScreenWidth() == 480 & MyLocale.getScreenHeight() == 800) {} if (MyLocale.getScreenWidth() == 640 & MyLocale.getScreenHeight() == 480) {} } else { TILESIZE = 36; W_OFFSET = 106; H_OFFSET = 150; } iap.virtualSize = new Rect(0, 0, 0, 0); // create once addLast(scp, STRETCH, FILL); addLast(mInfo = new mLabel(""), HSTRETCH, HFILL); }
/** Eventhandler */ public void onEvent(Event ev) { if (ev instanceof MenuEvent) { if (ev.type == MenuEvent.SELECTED) { if (((MenuEvent) ev).menu == mnuContextFormt) { mnuContextFormt.close(); mnuContextFormt.getItemAt(currFormatSel).modifiers &= ~MenuItem.Checked; currFormatSel = mnuContextFormt.getInt(); mnuContextFormt.getItemAt(currFormatSel).modifiers |= MenuItem.Checked; lblPosition.setText( myNavigation.gpsPos.toString(CoordsScreen.getLocalSystem(currFormatSel))); btnGoto.setText(getGotoBtnText()); } // end lat-lon-format context menu if (((MenuEvent) ev).menu == mnuContextRose) { MenuItem action = (MenuItem) mnuContextRose.getSelectedItem(); if (action != null) { for (int i = 0; i < miLuminary.length; i++) { if (action == miLuminary[i]) { myNavigation.setLuminary(i); miLuminary[i].modifiers |= MenuItem.Checked; compassRose.setLuminaryName(SkyOrientation.getLuminaryName(myNavigation.luminary)); } else miLuminary[i].modifiers &= ~MenuItem.Checked; } if (action == miNorthCentered) { if (compassRose.isNorthCentered()) { compassRose.setNorthCentered(false); miNorthCentered.modifiers &= ~MenuItem.Checked; } else { compassRose.setNorthCentered(true); miNorthCentered.modifiers |= MenuItem.Checked; } } } } } } if (ev instanceof ControlEvent && ev.type == ControlEvent.PRESSED) { // start/stop GPS connection if (ev.target == btnGPS) { if (btnGPS.getText().equals(MyLocale.getMsg(1504, "Start"))) startGps(); else myNavigation.stopGps(); } // set current position as centre and recalculate distance of caches in MainTab if (ev.target == btnCenter) { if (myNavigation.gpsPos.isValid()) { pref.setCurCentrePt(myNavigation.gpsPos); } else (new MessageBox( MyLocale.getMsg(312, "Error"), MyLocale.getMsg( 1514, "Cannot recalculate distances, because the GPS position is not set"), FormBase.OKB)) .execute(); } // Start moving map if (ev.target == btnMap) { switchToMovingMap(); } // create new waypoint with current GPS-position if (ev.target == btnSave) { CacheHolder ch = new CacheHolder(); ch.setPos(myNavigation.gpsPos); ch.setType(CacheType.CW_TYPE_STAGE); // see CacheType.GC_AW_STAGE_OF_MULTI // TODO unfertig mainT.newWaypoint(ch); } // change destination waypoint if (ev.target == btnGoto) { if (Vm.isMobile()) { InputScreen InScr = new InputScreen(CoordsScreen.getLocalSystem(currFormatSel)); if (myNavigation.destination.isValid()) InScr.setCoords(myNavigation.destination); else InScr.setCoords(new CWPoint(0, 0)); if (InScr.execute(null, CellConstants.TOP) == FormBase.IDOK) setDestination(InScr.getCoords()); } else { CoordsScreen cs = new CoordsScreen(); if (myNavigation.destination.isValid()) cs.setFields(myNavigation.destination, CoordsScreen.getLocalSystem(currFormatSel)); else cs.setFields(new CWPoint(0, 0), CoordsScreen.getLocalSystem(currFormatSel)); if (cs.execute(null, CellConstants.TOP) == FormBase.IDOK) setDestination(cs.getCoords()); } } } super.onEvent(ev); }
/** * This function checks whether the device supports a supplementary input panel (SIP) and if yes, * hides it and just shows the button. */ public static void setSIPButton() { if (Gui.screenIs(Gui.PDA_SCREEN) && Vm.isMobile()) { Vm.setSIP(Vm.SIP_LEAVE_BUTTON); } }
/** * This function checks whether the device supports a supplementary input panel (SIP) and if yes, * hides it and also hides the button. */ public static void setSIPOff() { if (Gui.screenIs(Gui.PDA_SCREEN) && Vm.isMobile()) { Vm.setSIP(0); } }
/** * This function checks whether the device supports a supplementary input panel (SIP) and if yes, * shows it. */ public static void setSIPOn() { if (Gui.screenIs(Gui.PDA_SCREEN) && Vm.isMobile()) { Vm.setSIP(Vm.SIP_ON); } }
public static void main(String vmargs[]) { // start with parameters: // args[0]: spider // args[1]: distance ewe.sys.Vm.startEwe(vmargs); /* Gui.screenIs(Gui.PDA_SCREEN); Rect s = (Rect)Window.getGuiInfo(Window.INFO_SCREEN_RECT,null,new Rect(),0); //Gui.screenIs(Gui.PDA_SCREEN) if (Vm.isMobile() && s.height >= 400) { Font defaultGuiFont = mApp.findFont("gui"); int sz = (int)(defaultGuiFont.getSize()); Font newGuiFont = new Font(defaultGuiFont.getName(), defaultGuiFont.getStyle(), sz); mApp.addFont(newGuiFont, "gui"); mApp.fontsChanged(); mApp.mainApp.font = newGuiFont; } */ if (Gui.screenIs(Gui.PDA_SCREEN) && Vm.isMobile()) { Vm.setSIP(Vm.SIP_LEAVE_BUTTON); } // get program command line parameters and switches String[] args = vmargs; // Vm.getProgramArguments(); <-- only works in eclipse, but mixes the letters in the // ewe-vm (tested in ewe-1.49 on win xp) String configfile = null; boolean debug = false; if (args.length > 0) { if (args[0].equals("test")) { Test t = new Test(); t.testAll(); } for (int i = 0; i < args.length; i++) { Vm.debug("prog: " + args[i]); Vm.debug("vm: " + vmargs[i]); if (args[i] != null && args[i].length() > 1 && (args[i].startsWith("-") || args[i].startsWith("/"))) { String c = args[i].substring(1, args[i].length()); if (c.equalsIgnoreCase("c")) { if (i < args.length - 1) { configfile = args[i + 1]; i++; } else { (new MessageBox( "Error", MyLocale.getMsg(7200, "Usage: CacheWolf [-c <path to pref.xml>] [-debug]"), MessageBox.OKB)) .execute(); // return usage info ewe.sys.Vm.exit(1); } } if (c.equalsIgnoreCase("debug")) { // Vm.debug("d"); debug = true; } } } } if (debug) { Vm.debug("prg-args: " + args.length); Vm.debug("vm-args: " + vmargs.length); } Editor mainF = new MainForm(debug, configfile); Device.preventIdleState(true); mainF.execute(); Device.preventIdleState(false); ewe.sys.Vm.exit(0); }
public void doIt() { // CellPanel [] p = addToolbar(); Global.mainForm = this; // this.title = "CacheWolf " + Version.getRelease(); this.exitSystemOnClose = true; this.resizable = true; this.moveable = true; this.windowFlagsToSet = WindowConstants.FLAG_MAXIMIZE_ON_PDA; // Rect screen = ((ewe.fx.Rect) // (Window.getGuiInfo(WindowConstants.INFO_SCREEN_RECT,null,new // ewe.fx.Rect(),0))); // if ( screen.height >= 600 && screen.width >= 800) // this.setPreferredSize(800, 600); this.resizeOnSIP = true; InfoBox infB = null; try { pref.readPrefFile(); if (MyLocale.initErrors.length() != 0) { new MessageBox("Error", MyLocale.initErrors, FormBase.OKB).execute(); } if (Vm.isMobile() == true) { // this.windowFlagsToSet |=Window.FLAG_FULL_SCREEN; this.resizable = false; this.moveable = false; } else { int h, w; h = pref.myAppHeight; if (h > MyLocale.getScreenHeight()) h = MyLocale.getScreenHeight(); w = pref.myAppWidth; if (w > MyLocale.getScreenWidth()) w = MyLocale.getScreenWidth(); this.setPreferredSize(w, h); } addGuiFont(); if (!pref.selectProfile(profile, Preferences.PROFILE_SELECTOR_ONOROFF, true)) ewe.sys.Vm.exit(0); // User MUST select or create a profile Vm.showWait(true); // Replace buildt-in symbols with customized images GuiImageBroker.customizedSymbols(); // Load CacheList infB = new InfoBox("CacheHound", MyLocale.getMsg(5000, "Loading Cache-List")); infB.exec(); infB.waitUntilPainted(100); profile.readIndex(infB); pref.setCurCenter(new CWPoint(profile.getCenter())); profile.updateBearingDistance(); setTitle("CacheHound " + Version.getRelease() + " - " + profile.name); } catch (Exception e) { if (pref.debug == true) Vm.debug("MainForm:: Exception:: " + e.toString()); } if (pref.showStatus) statBar = new StatusBar(pref, profile.cacheDB); mMenu = new MainMenu(this); mTab = new MainTab(mMenu, statBar); split = new SplittablePanel(PanelSplitter.HORIZONTAL); split.theSplitter.thickness = 0; split.theSplitter.modify(Invisible, 0); CellPanel pnlCacheList = split.getNextPanel(); CellPanel pnlMainTab = split.getNextPanel(); split.setSplitter( PanelSplitter.MIN_SIZE | PanelSplitter.BEFORE, PanelSplitter.HIDDEN | PanelSplitter.BEFORE, PanelSplitter.CLOSED); pnlCacheList.addLast(cacheList = new CacheList(), STRETCH, FILL); pnlMainTab.addLast(mTab, STRETCH, FILL); mTab.dontAutoScroll = true; this.addLast(split, STRETCH, FILL); /* * if (pref.menuAtTop) { this.addLast(mMenu,CellConstants.DONTSTRETCH, * CellConstants.FILL); this.addLast(split,STRETCH,FILL); } else { * this.addLast(split,STRETCH,FILL); * this.addLast(mMenu,CellConstants.DONTSTRETCH, CellConstants.FILL); } */ mMenu.setTablePanel(mTab.getTablePanel()); if (infB != null) infB.close(0); mTab.tbP.refreshTable(); mTab.tbP.selectFirstRow(); // mTab.tbP.tc.paintSelection(); Vm.showWait(false); }