public void eventDispatched(AWTEvent event) { if (isDirectedScanning) { MouseEvent me = (MouseEvent) event; if (me.getButton() == MouseEvent.BUTTON1) { // 96 // if (HiHaFiambreig) PararTimerFiambreig(); if (me.getID() == MouseEvent.MOUSE_RELEASED) { if (withSwaying) { stopSwayingTimer(); } actPanel.clickLeftButton(); if (withSwaying) { startDirectedScanSwayingTimer(); } } } else if (me.getButton() == MouseEvent.BUTTON3) { if (event.getID() == MouseEvent.MOUSE_RELEASED) { if (withSwaying) { stopSwayingTimer(); } actPanel.nextScanPosition(); if (withSwaying) { startSwayingTimer(); } } } } }
public void initActivity(Activity.Panel actPanel) { this.actPanel = actPanel; if (formKeyboard.isVisible()) { formKeyboard.setVisible(false); } activityWithKeyboard = false; activityType = actPanel.getActivity().getShortClassName(); // Clear data // WARNING: Avoid the use of fixed-length arrays! for (int i = 0; i < MAX_SCANNING_ZONES; i++) { zonePoints[i] = -1; for (int n = 0; n < MAX_POINTS_PER_ZONE; n++) { px[i][n] = 0; py[i][n] = 0; sll[i][n] = ""; } } currentZone = 0; // Start scanning only buttons place = 0; oldActPanelRectangle.setBounds(0, 0, 0, 0); activityFinished = false; activityWithKeyboard = actPanel.getActivity().needsKeyboard(); if (formKeyboard != null && activityWithKeyboard && showKeyboard && isScanning) { formKeyboard.isHorizontalScanning = false; formKeyboard.xPos = 0; formKeyboard.yPos = -1; formKeyboard.setVisible(true); formKeyboard.calcFrameSize(); numberOfZones = 1; clickNumber = 1; currentZone = 1; } actPanel.calcScanPoints(); if (autoAutoScan) { if (autoScanActivationTimer == null) { enableAutoScanTimer(); } } else if (weAreAtTheStart) { if (autoScanOnStart) { enableAutoScan(); } else if (directedScanOnStart) { enableDirectedScan(); } } weAreAtTheStart = false; if (isAutoScanning) { startScanTimer(); } }
/** * **************************************************************************************************** */ public void startScanning() { if (actPanel != null) { zonePoints[0] = -1; zonePoints[1] = -1; zonePoints[2] = -1; if (withChangeZoneButton && formExchange != null) { formExchange.setVisible(true); } place = 0; isFirstScreen = true; isScanning = true; isAutoScanning = false; isDirectedScanning = false; actPanel.calcScanPoints(); // WARNING: isScanning was just initialized, so it always will be "true": if (formKeyboard != null && activityWithKeyboard && showKeyboard && isScanning) { formKeyboard.isHorizontalScanning = false; formKeyboard.xPos = 0; formKeyboard.yPos = -1; formKeyboard.setVisible(true); formKeyboard.calcFrameSize(); numberOfZones = 1; clickNumber = 1; currentZone = 1; } } }
/** * **************************************************************************************************** */ public void enableDirectedScan() { disableScanning(); startScanning(); isDirectedScanning = true; if (withSwaying) { stopSwayingTimer(); } actPanel.nextScanPosition(); if (withSwaying) { stopSwayingTimer(); } Toolkit.getDefaultToolkit() .addAWTEventListener(mouseDirectedScanListener, AWTEvent.MOUSE_EVENT_MASK); Toolkit.getDefaultToolkit() .addAWTEventListener(directedScanKeyboardListener, AWTEvent.KEY_EVENT_MASK); // if (HiHaFiambreig) TimerEscaneigDirigitEngegarFiambreig(); }