diff --git a/resources/images/images.properties b/resources/images/images.properties index eaafc174c..8005fa51c 100644 --- a/resources/images/images.properties +++ b/resources/images/images.properties @@ -154,6 +154,30 @@ service.gui.buttons.NINE_DIAL_BUTTON=resources/images/impl/gui/buttons/nine.png service.gui.buttons.STAR_DIAL_BUTTON=resources/images/impl/gui/buttons/star.png service.gui.buttons.ZERO_DIAL_BUTTON=resources/images/impl/gui/buttons/zero.png service.gui.buttons.DIEZ_DIAL_BUTTON=resources/images/impl/gui/buttons/diez.png +service.gui.buttons.ONE_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/oneMac.png +service.gui.buttons.TWO_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/twoMac.png +service.gui.buttons.THREE_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/threeMac.png +service.gui.buttons.FOUR_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/fourMac.png +service.gui.buttons.FIVE_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/fiveMac.png +service.gui.buttons.SIX_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/sixMac.png +service.gui.buttons.SEVEN_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/sevenMac.png +service.gui.buttons.EIGHT_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/eightMac.png +service.gui.buttons.NINE_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/nineMac.png +service.gui.buttons.STAR_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/starMac.png +service.gui.buttons.ZERO_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/zeroMac.png +service.gui.buttons.DIEZ_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/diezMac.png +service.gui.buttons.ONE_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/oneMacRollover.png +service.gui.buttons.TWO_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/twoMacRollover.png +service.gui.buttons.THREE_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/threeMacRollover.png +service.gui.buttons.FOUR_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/fourMacRollover.png +service.gui.buttons.FIVE_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/fiveMacRollover.png +service.gui.buttons.SIX_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/sixMacRollover.png +service.gui.buttons.SEVEN_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/sevenMacRollover.png +service.gui.buttons.EIGHT_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/eightMacRollover.png +service.gui.buttons.NINE_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/nineMacRollover.png +service.gui.buttons.STAR_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/starMacRollover.png +service.gui.buttons.ZERO_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/zeroMacRollover.png +service.gui.buttons.DIEZ_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/diezMacRollover.png service.gui.buttons.CALL_PANEL_MINIMIZE_BUTTON=resources/images/impl/gui/buttons/callPanelMinimizeButton.png service.gui.buttons.CALL_PANEL_RESTORE_BUTTON=resources/images/impl/gui/buttons/callPanelRestoreButton.png service.gui.buttons.CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON=resources/images/impl/gui/buttons/callPanelMinimizeButtonRollover.png @@ -218,6 +242,10 @@ service.gui.buttons.TRANSPARENT_WINDOW_BUTTON=resources/images/impl/gui/buttons/ service.gui.buttons.HD_VIDEO_BUTTON=resources/images/impl/gui/buttons/hdVideo.png service.gui.buttons.SD_VIDEO_BUTTON=resources/images/impl/gui/buttons/sdVideo.png service.gui.buttons.LO_VIDEO_BUTTON=resources/images/impl/gui/buttons/loVideo.png +service.gui.buttons.CONTACT_LIST_DIAL_BUTTON=resources/images/impl/gui/buttons/contactListDialButton.png +service.gui.buttons.CONTACT_LIST_DIAL_BUTTON_PRESSED=resources/images/impl/gui/buttons/contactListDialButtonPressed.png +service.gui.buttons.DIAL_PAD_CALL_BUTTON_BG=resources/images/impl/gui/buttons/dialPadCallButtonBg.png +service.gui.buttons.DIAL_PAD_CALL_BUTTON_ROLLOVER_BG=resources/images/impl/gui/buttons/dialPadCallButtonBgRollover.png # Sound level icons service.gui.soundlevel.SOUND_LEVEL_ACTIVE=resources/images/impl/gui/common/soundlevel/soundActive.png diff --git a/resources/images/impl/gui/buttons/contactListDialButton.png b/resources/images/impl/gui/buttons/contactListDialButton.png new file mode 100644 index 000000000..50bd8e085 Binary files /dev/null and b/resources/images/impl/gui/buttons/contactListDialButton.png differ diff --git a/resources/images/impl/gui/buttons/contactListDialButtonPressed.png b/resources/images/impl/gui/buttons/contactListDialButtonPressed.png new file mode 100644 index 000000000..fd5754f78 Binary files /dev/null and b/resources/images/impl/gui/buttons/contactListDialButtonPressed.png differ diff --git a/resources/images/impl/gui/buttons/dialPadCallButtonBg.png b/resources/images/impl/gui/buttons/dialPadCallButtonBg.png new file mode 100644 index 000000000..2d638a347 Binary files /dev/null and b/resources/images/impl/gui/buttons/dialPadCallButtonBg.png differ diff --git a/resources/images/impl/gui/buttons/dialPadCallButtonBgRollover.png b/resources/images/impl/gui/buttons/dialPadCallButtonBgRollover.png new file mode 100644 index 000000000..75f53856d Binary files /dev/null and b/resources/images/impl/gui/buttons/dialPadCallButtonBgRollover.png differ diff --git a/resources/images/impl/gui/buttons/diezMac.png b/resources/images/impl/gui/buttons/diezMac.png new file mode 100644 index 000000000..d38916b75 Binary files /dev/null and b/resources/images/impl/gui/buttons/diezMac.png differ diff --git a/resources/images/impl/gui/buttons/diezMacRollover.png b/resources/images/impl/gui/buttons/diezMacRollover.png new file mode 100644 index 000000000..5cafe4e48 Binary files /dev/null and b/resources/images/impl/gui/buttons/diezMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/eightMac.png b/resources/images/impl/gui/buttons/eightMac.png new file mode 100644 index 000000000..6aa71725f Binary files /dev/null and b/resources/images/impl/gui/buttons/eightMac.png differ diff --git a/resources/images/impl/gui/buttons/eightMacRollover.png b/resources/images/impl/gui/buttons/eightMacRollover.png new file mode 100644 index 000000000..456b8fbf5 Binary files /dev/null and b/resources/images/impl/gui/buttons/eightMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/fiveMac.png b/resources/images/impl/gui/buttons/fiveMac.png new file mode 100644 index 000000000..5edbba064 Binary files /dev/null and b/resources/images/impl/gui/buttons/fiveMac.png differ diff --git a/resources/images/impl/gui/buttons/fiveMacRollover.png b/resources/images/impl/gui/buttons/fiveMacRollover.png new file mode 100644 index 000000000..cbc905602 Binary files /dev/null and b/resources/images/impl/gui/buttons/fiveMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/fourMac.png b/resources/images/impl/gui/buttons/fourMac.png new file mode 100644 index 000000000..30710a9e5 Binary files /dev/null and b/resources/images/impl/gui/buttons/fourMac.png differ diff --git a/resources/images/impl/gui/buttons/fourMacRollover.png b/resources/images/impl/gui/buttons/fourMacRollover.png new file mode 100644 index 000000000..ac54f1710 Binary files /dev/null and b/resources/images/impl/gui/buttons/fourMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/nineMac.png b/resources/images/impl/gui/buttons/nineMac.png new file mode 100644 index 000000000..f58caca8f Binary files /dev/null and b/resources/images/impl/gui/buttons/nineMac.png differ diff --git a/resources/images/impl/gui/buttons/nineMacRollover.png b/resources/images/impl/gui/buttons/nineMacRollover.png new file mode 100644 index 000000000..035d80964 Binary files /dev/null and b/resources/images/impl/gui/buttons/nineMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/oneMac.png b/resources/images/impl/gui/buttons/oneMac.png new file mode 100644 index 000000000..187759128 Binary files /dev/null and b/resources/images/impl/gui/buttons/oneMac.png differ diff --git a/resources/images/impl/gui/buttons/oneMacRollover.png b/resources/images/impl/gui/buttons/oneMacRollover.png new file mode 100644 index 000000000..83c82495a Binary files /dev/null and b/resources/images/impl/gui/buttons/oneMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/sevenMac.png b/resources/images/impl/gui/buttons/sevenMac.png new file mode 100644 index 000000000..98a57317a Binary files /dev/null and b/resources/images/impl/gui/buttons/sevenMac.png differ diff --git a/resources/images/impl/gui/buttons/sevenMacRollover.png b/resources/images/impl/gui/buttons/sevenMacRollover.png new file mode 100644 index 000000000..f161f4f90 Binary files /dev/null and b/resources/images/impl/gui/buttons/sevenMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/sixMac.png b/resources/images/impl/gui/buttons/sixMac.png new file mode 100644 index 000000000..0996ee5a5 Binary files /dev/null and b/resources/images/impl/gui/buttons/sixMac.png differ diff --git a/resources/images/impl/gui/buttons/sixMacRollover.png b/resources/images/impl/gui/buttons/sixMacRollover.png new file mode 100644 index 000000000..e1ee78c9c Binary files /dev/null and b/resources/images/impl/gui/buttons/sixMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/src/dialNumbers.svg b/resources/images/impl/gui/buttons/src/dialNumbers.svg index fe7be2cca..baf30dc75 100644 --- a/resources/images/impl/gui/buttons/src/dialNumbers.svg +++ b/resources/images/impl/gui/buttons/src/dialNumbers.svg @@ -1,24 +1,188 @@ + + sodipodi:modified="true" + version="1.1"> + id="defs4"> + + + + + + + + + + + + + + + + + + + + + + + + + + + inkscape:window-y="0" + showgrid="false" + inkscape:window-maximized="0" /> @@ -43,6 +209,7 @@ image/svg+xml + @@ -365,5 +532,896 @@ x="140.14545" y="440.64554" style="font-size:10.000000px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1.0000000;font-family:Bitstream Vera Sans">+ + + 9 + xyz + 1 + 6 + mno + 2 + ABC + 4 + ghi + 7 + pqrs + 3 + DEF + 5 + jkl + 8 + tuv + * + # + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/impl/gui/buttons/starMac.png b/resources/images/impl/gui/buttons/starMac.png new file mode 100644 index 000000000..63e4d6c35 Binary files /dev/null and b/resources/images/impl/gui/buttons/starMac.png differ diff --git a/resources/images/impl/gui/buttons/starMacRollover.png b/resources/images/impl/gui/buttons/starMacRollover.png new file mode 100644 index 000000000..6f4939de1 Binary files /dev/null and b/resources/images/impl/gui/buttons/starMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/threeMac.png b/resources/images/impl/gui/buttons/threeMac.png new file mode 100644 index 000000000..7d366e307 Binary files /dev/null and b/resources/images/impl/gui/buttons/threeMac.png differ diff --git a/resources/images/impl/gui/buttons/threeMacRollover.png b/resources/images/impl/gui/buttons/threeMacRollover.png new file mode 100644 index 000000000..ba6e02ec8 Binary files /dev/null and b/resources/images/impl/gui/buttons/threeMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/twoMac.png b/resources/images/impl/gui/buttons/twoMac.png new file mode 100644 index 000000000..6258be3f9 Binary files /dev/null and b/resources/images/impl/gui/buttons/twoMac.png differ diff --git a/resources/images/impl/gui/buttons/twoMacRollover.png b/resources/images/impl/gui/buttons/twoMacRollover.png new file mode 100644 index 000000000..4a28b5249 Binary files /dev/null and b/resources/images/impl/gui/buttons/twoMacRollover.png differ diff --git a/resources/images/impl/gui/buttons/zeroMac.png b/resources/images/impl/gui/buttons/zeroMac.png new file mode 100644 index 000000000..b90b0347e Binary files /dev/null and b/resources/images/impl/gui/buttons/zeroMac.png differ diff --git a/resources/images/impl/gui/buttons/zeroMacRollover.png b/resources/images/impl/gui/buttons/zeroMacRollover.png new file mode 100644 index 000000000..af9014933 Binary files /dev/null and b/resources/images/impl/gui/buttons/zeroMacRollover.png differ diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index b8a856c1d..dddea2c1e 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -156,7 +156,7 @@ service.gui.DATE=Date service.gui.DELETE=Delete service.gui.DENY=&Deny service.gui.DESKTOP_SHARING_WARNING=Are you sure you want to start screen sharing?
Clicking OK will let people on this call see your screen. -service.gui.DIALPAD=Dialpad +service.gui.DIALPAD=Dial Pad service.gui.DISPLAY_NAME=Display name service.gui.DISCONNECTED_STATUS=Disconnected service.gui.DND_STATUS=Do not disturb diff --git a/src/net/java/sip/communicator/impl/gui/main/DialPadButton.java b/src/net/java/sip/communicator/impl/gui/main/DialPadButton.java new file mode 100644 index 000000000..1ee78e844 --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/DialPadButton.java @@ -0,0 +1,62 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.main; + +import java.awt.*; +import java.awt.event.*; + +import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.util.swing.*; + +/** + * The dial pad button in the contact list. + * + * @author Yana Stamcheva + */ +public class DialPadButton + extends SIPCommTextButton +{ + /** + * The dial pad dialog that this button opens. + */ + GeneralDialPadDialog dialPad; + + /** + * Creates an instance of DialPadButton. + */ + public DialPadButton() + { + super(""); + + loadSkin(); + + addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if (dialPad == null) + dialPad = new GeneralDialPadDialog(); + + dialPad.clear(); + dialPad.setVisible(true); + } + }); + } + + /** + * Loads images and sets history view. + */ + public void loadSkin() + { + Image image = ImageLoader.getImage(ImageLoader.CONTACT_LIST_DIAL_BUTTON); + + setBgImage(image); + + this.setPreferredSize(new Dimension(image.getWidth(this), + image.getHeight(this))); + } +} diff --git a/src/net/java/sip/communicator/impl/gui/main/DialPadFieldUI.java b/src/net/java/sip/communicator/impl/gui/main/DialPadFieldUI.java new file mode 100644 index 000000000..ca43cea2d --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/DialPadFieldUI.java @@ -0,0 +1,93 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.main; + +import java.awt.*; + +import net.java.sip.communicator.util.*; +import net.java.sip.communicator.util.skin.*; +import net.java.sip.communicator.util.swing.*; +import net.java.sip.communicator.util.swing.plaf.*; + +/** + * The SearchTextFieldUI is the one responsible for the search field + * look & feel. It draws a search icon inside the field and adjusts the bounds + * of the editor rectangle according to it. + * + * @author Yana Stamcheva + * @author Adam Netocny + */ +public class DialPadFieldUI + extends SIPCommTextFieldUI + implements Skinnable +{ + /** + * Creates a SIPCommTextFieldUI. + */ + public DialPadFieldUI() + { + loadSkin(); + } + + /** + * Adds the custom mouse listeners defined in this class to the installed + * listeners. + */ + protected void installListeners() + { + super.installListeners(); + } + + /** + * Implements parent paintSafely method and enables antialiasing. + * @param g the Graphics object that notified us + */ + protected void paintSafely(Graphics g) + { + customPaintBackground(g); + super.paintSafely(g); + } + + /** + * Paints the background of the associated component. + * @param g the Graphics object used for painting + */ + protected void customPaintBackground(Graphics g) + { + Graphics2D g2 = (Graphics2D) g.create(); + + try + { + AntialiasingManager.activateAntialiasing(g2); + super.customPaintBackground(g2); + } + finally + { + g2.dispose(); + } + } + + /** + * If we are in the case of disabled delete button, we simply call the + * parent implementation of this method, otherwise we recalculate the editor + * rectangle in order to leave place for the delete button. + * @return the visible editor rectangle + */ + protected Rectangle getVisibleEditorRect() + { + Rectangle rect = super.getVisibleEditorRect(); + + if ((rect.width > 0) && (rect.height > 0)) + { + rect.x += 8; + rect.width -= 18; + + return rect; + } + return null; + } +} \ No newline at end of file diff --git a/src/net/java/sip/communicator/impl/gui/main/GeneralDialPadDialog.java b/src/net/java/sip/communicator/impl/gui/main/GeneralDialPadDialog.java new file mode 100644 index 000000000..926c6ecb0 --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/GeneralDialPadDialog.java @@ -0,0 +1,320 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.main; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; + +import net.java.sip.communicator.impl.gui.*; +import net.java.sip.communicator.impl.gui.main.call.*; +import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.util.*; +import net.java.sip.communicator.util.skin.*; +import net.java.sip.communicator.util.swing.*; +import net.java.sip.communicator.util.swing.plaf.*; + +import com.explodingpixels.macwidgets.*; + +/** + * The DialpadDialog is a popup dialog containing a dialpad. + * + * @author Yana Stamcheva + */ +public class GeneralDialPadDialog +{ + /** + * The call field, where the dialed number is typed. + */ + private final JTextField callField; + + /** + * The actual dial pad dialog. + */ + private final JDialog dialPadDialog; + + /** + * The call button. + */ + private JButton callButton; + + /** + * A keyboard manager, where we register our own key dispatcher. + */ + private KeyboardFocusManager keyManager; + + /** + * A key dispatcher that redirects all key events to call field. + */ + private KeyEventDispatcher keyDispatcher; + + /** + * Creates an instance of GeneralDialPadDialog. + */ + public GeneralDialPadDialog() + { + if (OSUtils.IS_MAC) + { + HudWindow window = new HudWindow(); + + dialPadDialog = window.getJDialog(); + } + else + { + dialPadDialog = new SIPCommDialog(false); + } + + callField = new CallField(GuiActivator.getResources() + .getI18NString("service.gui.ENTER_NAME_OR_NUMBER")); + + dialPadDialog.setTitle( + GuiActivator.getResources().getI18NString("service.gui.DIALPAD")); + + JPanel mainPanel = new TransparentPanel(new BorderLayout()); + + mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + + mainPanel.add(callField, BorderLayout.NORTH); + DTMFHandler dtmfHandler = new DTMFHandler(); + dtmfHandler.addParent(dialPadDialog); + mainPanel.add(new GeneralDialPanel(this, dtmfHandler)); + mainPanel.add(createCallPanel(), BorderLayout.SOUTH); + + dialPadDialog.add(mainPanel); + dialPadDialog.pack(); + + dialPadDialog.addWindowListener(new WindowAdapter() + { + public void windowOpened(WindowEvent e) + { + if (keyManager == null) + { + keyManager + = KeyboardFocusManager.getCurrentKeyboardFocusManager(); + + keyDispatcher = new MainKeyDispatcher(keyManager); + } + + keyManager.addKeyEventDispatcher( + new MainKeyDispatcher(keyManager)); + } + + @Override + public void windowClosed(WindowEvent e) + { + if (keyManager != null) + keyManager.removeKeyEventDispatcher(keyDispatcher); + + keyManager = null; + keyDispatcher = null; + } + }); + } + + /** + * Creates the call panel. + * + * @return the created call panel. + */ + private JComponent createCallPanel() + { + JPanel buttonsPanel + = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); + + Image callButtonImage + = ImageLoader.getImage(ImageLoader.DIAL_PAD_CALL_BUTTON_BG); + + callButton = new SIPCommTextButton( + GuiActivator.getResources().getI18NString("service.gui.CALL"), + callButtonImage); + + callButton.setPreferredSize(new Dimension( + callButtonImage.getWidth(null), + callButtonImage.getHeight(null))); + + callButton.setForeground(Color.WHITE); + + callButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + CallManager.createCall(callField.getText(), callButton, + new CallInterfaceListener() + { + public void callInterfaceStarted() + { + dialPadDialog.setVisible(false); + } + }); + } + }); + + buttonsPanel.add(callButton); + + dialPadDialog.getRootPane().setDefaultButton(callButton); + + return buttonsPanel; + } + + /** + * Indicates that a dial button was pressed. + * + * @param s the string corresponding to a number to add to the call field + */ + public void dialButtonPressed(String s) + { + callField.setText(callField.getText() + s); + } + + /** + * Shows/hides the dial pad dialog. + * + * @param visible indicates if the dial pad should be shown or hidden. + */ + public void setVisible(boolean visible) + { + dialPadDialog.setLocationRelativeTo( + GuiActivator.getUIService().getMainFrame()); + dialPadDialog.setVisible(visible); + callField.requestFocus(); + } + + /** + * Clears the call field. + */ + public void clear() + { + callField.setText(""); + } + + /** + * The MainKeyDispatcher is added to pre-listen KeyEvents before + * they're delivered to the current focus owner in order to introduce a + * specific behavior for the CallField on top of the dial pad. + */ + private class MainKeyDispatcher implements KeyEventDispatcher + { + private KeyboardFocusManager keyManager; + + /** + * Creates an instance of MainKeyDispatcher. + * @param keyManager the parent KeyboardFocusManager + */ + public MainKeyDispatcher(KeyboardFocusManager keyManager) + { + this.keyManager = keyManager; + } + + /** + * Dispatches the given KeyEvent. + * @param e the KeyEvent to dispatch + * @return true if the KeyboardFocusManager should take no + * further action with regard to the KeyEvent; false + * otherwise + */ + public boolean dispatchKeyEvent(KeyEvent e) + { + // If this window is not the focus window or if the event is not + // of type PRESSED we have nothing more to do here. + if (!dialPadDialog.isFocused() + || (e.getID() != KeyEvent.KEY_TYPED)) + return false; + + if (e.getKeyChar() == KeyEvent.CHAR_UNDEFINED + || e.getKeyCode() == KeyEvent.VK_ENTER + || e.getKeyCode() == KeyEvent.VK_DELETE + || e.getKeyCode() == KeyEvent.VK_BACK_SPACE + || e.getKeyCode() == KeyEvent.VK_TAB + || e.getKeyCode() == KeyEvent.VK_SPACE) + { + return false; + } + + if (!callField.isFocusOwner() + && keyManager.getFocusOwner() != null) + { + // Request the focus in the call field if a letter is typed. + callField.requestFocusInWindow(); + + // We re-dispatch the event to call field. + keyManager.redispatchEvent(callField, e); + + // We don't want to dispatch further this event. + return true; + } + + return false; + } + } + + /** + * A custom call field. + */ + private class CallField + extends SIPCommTextField + implements Skinnable + { + /** + * The text field ui. + */ + private SIPCommTextFieldUI textFieldUI; + + /** + * Creates an instance of the CallField. + */ + public CallField(String text) + { + super(text); + + textFieldUI = new DialPadFieldUI(); + textFieldUI.setDeleteButtonEnabled(true); + + this.setPreferredSize(new Dimension(200, 23)); + this.setUI(textFieldUI); + this.setBorder(null); + this.setOpaque(false); + + this.setDragEnabled(true); + + InputMap imap + = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape"); + ActionMap amap = getActionMap(); + amap.put("escape", new AbstractAction() + { + public void actionPerformed(ActionEvent e) + { + setText(""); + } + }); + + loadSkin(); + } + + /** + * Reloads text field UI defs. + */ + public void loadSkin() + { + textFieldUI.loadSkin(); + + if (OSUtils.IS_MAC) + { + textFieldUI.setBgStartColor(Color.BLACK); + textFieldUI.setBgEndColor(Color.BLACK); + textFieldUI.setBgBorderStartColor(Color.DARK_GRAY); + textFieldUI.setBgBorderEndColor(Color.GRAY); + + setForegroundColor(Color.WHITE); + setDefaultTextColor(Color.GRAY); + + setCaretColor(Color.WHITE); + } + } + } +} diff --git a/src/net/java/sip/communicator/impl/gui/main/GeneralDialPanel.java b/src/net/java/sip/communicator/impl/gui/main/GeneralDialPanel.java new file mode 100755 index 000000000..16f1f1ddd --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/GeneralDialPanel.java @@ -0,0 +1,244 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.main; + +import java.awt.*; +import java.awt.event.*; +import java.awt.image.*; + +import javax.swing.*; + +import net.java.sip.communicator.impl.gui.*; +import net.java.sip.communicator.impl.gui.main.call.*; +import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.service.resources.*; +import net.java.sip.communicator.util.*; +import net.java.sip.communicator.util.skin.*; +import net.java.sip.communicator.util.swing.*; + +/** + * The DialPanel is the panel that contains the buttons to dial a + * phone number. + * + * @author Yana Stamcheva + * @author Adam Netocny + */ +public class GeneralDialPanel + extends TransparentPanel + implements MouseListener, + Skinnable +{ + /** + * The dial panel. + */ + private final JPanel dialPadPanel = + new TransparentPanel(new GridLayout(4, 3, + GuiActivator.getResources() + .getSettingsInt("impl.gui.DIAL_PAD_HORIZONTAL_GAP"), + GuiActivator.getResources() + .getSettingsInt("impl.gui.DIAL_PAD_VERTICAL_GAP"))); + + /** + * Handles DTMFs. + */ + private DTMFHandler dtmfHandler; + + /** + * The parent dial pad dialog. + */ + private final GeneralDialPadDialog dialPadDialog; + + /** + * Creates an instance of DialPanel for a specific call, by + * specifying the parent CallManager and the + * CallPeer. + * + * @param dtmfHandler handles DTMFs. + */ + public GeneralDialPanel(GeneralDialPadDialog dialPadDialog, + DTMFHandler dtmfHandler) + { + this.dialPadDialog = dialPadDialog; + this.dtmfHandler = dtmfHandler; + + this.init(); + } + + /** + * Initializes this panel by adding all dial buttons to it. + */ + public void init() + { + this.dialPadPanel.setOpaque(false); + + this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + + loadSkin(); + + this.add(dialPadPanel, BorderLayout.CENTER); + } + + /** + * Creates DTMF button. + * + * @param bgImage + * @param iconImage + * @param name + * @return the created dial button + */ + private JButton createDialButton(Image bgImage, ImageID iconImage, + String name) + { + JButton button = + new SIPCommButton(bgImage, ImageLoader.getImage(iconImage)); + + button.setAlignmentY(JButton.LEFT_ALIGNMENT); + button.setName(name); + button.setOpaque(false); + button.addMouseListener(this); + return button; + } + + /** + * Creates DTMF button. + * + * @param bgImage + * @param iconImage + * @param name + * @return the created dial button + */ + private JButton createMacOSXDialButton( ImageID imageID, + ImageID rolloverImageID, + String name) + { + JButton button = new SIPCommButton( + ImageLoader.getImage(imageID), + ImageLoader.getImage(rolloverImageID), + ImageLoader.getImage(rolloverImageID), + null, + null, + null); + + button.setName(name); + button.addMouseListener(this); + + return button; + } + + public void mouseClicked(MouseEvent e) {} + + public void mouseEntered(MouseEvent e) {} + + public void mouseExited(MouseEvent e) {} + + /** + * Handles the MouseEvent triggered when user presses one of the + * dial buttons. + * @param e the event + */ + public void mousePressed(MouseEvent e) + { + JButton button = (JButton) e.getSource(); + + dialPadDialog.dialButtonPressed(button.getName()); + dtmfHandler.startSendingDtmfTone(button.getName()); + } + + /** + * Handles the MouseEvent triggered when user releases one of the + * dial buttons. + * @param e the event + */ + public void mouseReleased(MouseEvent e) + { + dtmfHandler.stopSendingDtmfTone(); + } + + /** + * Paints the main background image to the background of this dial panel. + * + * @param g the Graphics object used for painting + */ + public void paintComponent(Graphics g) + { + // do the superclass behavior first + super.paintComponent(g); + + Graphics2D g2 = (Graphics2D) g; + + boolean isTextureBackground + = Boolean.parseBoolean(GuiActivator.getResources() + .getSettingsString("impl.gui.IS_CONTACT_LIST_TEXTURE_BG_ENABLED")); + + BufferedImage bgImage + = ImageLoader.getImage(ImageLoader.MAIN_WINDOW_BACKGROUND); + + // paint the image + if (bgImage != null) + { + if (isTextureBackground) + { + Rectangle rect + = new Rectangle(0, 0, + bgImage.getWidth(null), + bgImage.getHeight(null)); + + TexturePaint texture = new TexturePaint(bgImage, rect); + + g2.setPaint(texture); + + g2.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + else + { + g.setColor(new Color( + GuiActivator.getResources() + .getColor("contactListBackground"))); + + // paint the background with the choosen color + g.fillRect(0, 0, getWidth(), getHeight()); + + g2.drawImage(bgImage, + this.getWidth() - bgImage.getWidth(), + this.getHeight() - bgImage.getHeight(), + this); + } + } + } + + /** + * Reloads dial buttons. + */ + public void loadSkin() + { + dialPadPanel.removeAll(); + + Image bgImage = ImageLoader.getImage(ImageLoader.DIAL_BUTTON_BG); + + DTMFHandler.DTMFToneInfo[] availableTones = DTMFHandler.availableTones; + for (int i = 0; i < availableTones.length; i++) + { + DTMFHandler.DTMFToneInfo info = availableTones[i]; + + // we add only buttons having image + if(info.imageID == null) + continue; + + JComponent c; + if (OSUtils.IS_MAC) + c = createMacOSXDialButton( + info.macImageID, + info.macImageRolloverID, + info.tone.getValue()); + else + c = createDialButton( + bgImage, info.imageID, info.tone.getValue()); + + dialPadPanel.add(c); + } + } +} diff --git a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java index 3e1d4fa93..8f4e3fc37 100644 --- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java @@ -265,8 +265,9 @@ private void init() TransparentPanel searchPanel = new TransparentPanel(new BorderLayout(2, 0)); - searchPanel.add(searchField); + searchPanel.add(searchField); + searchPanel.add(new DialPadButton(), BorderLayout.WEST); searchPanel.add(createButtonPanel(), BorderLayout.EAST); northPanel.add(accountStatusPanel, BorderLayout.CENTER); diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallInterfaceListener.java b/src/net/java/sip/communicator/impl/gui/main/call/CallInterfaceListener.java new file mode 100644 index 000000000..39839eea2 --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallInterfaceListener.java @@ -0,0 +1,21 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.main.call; + +/** + * The CallInterfaceListener is notified when the call interface has + * been started after the call was created. + * + * @author Yana Stamcheva + */ +public interface CallInterfaceListener +{ + /** + * Indicates that the call interface was started. + */ + public void callInterfaceStarted(); +} diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java b/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java index 25c433c13..f7d383ac0 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java @@ -626,7 +626,23 @@ public static void enableDesktopRemoteControl( CallPeer callPeer, * @param c the component, which indicates where should be shown the "call * via" menu if needed */ - public static void createCall(String callString, JComponent c) + public static void createCall( String callString, + JComponent c) + { + createCall(callString, c, null); + } + + /** + * Creates a call to the given call string. The given component indicates + * where should be shown the "call via" menu if needed. + * + * @param callString the string to call + * @param c the component, which indicates where should be shown the "call + * via" menu if needed + */ + public static void createCall( String callString, + JComponent c, + CallInterfaceListener l) { callString = callString.trim(); @@ -653,6 +669,9 @@ public static void createCall(String callString, JComponent c) { CallManager.createCall( telephonyProviders.get(0), callString); + + if (l != null) + l.callInterfaceStarted(); } else if (telephonyProviders.size() > 1) { @@ -660,12 +679,22 @@ else if (telephonyProviders.size() > 1) = new ChooseCallAccountPopupMenu( c, callString, - telephonyProviders); + telephonyProviders, + l); chooseAccountDialog .setLocation(c.getLocation()); chooseAccountDialog.showPopupMenu(); } + else + { + new ErrorDialog( + null, + GuiActivator.getResources().getI18NString("service.gui.WARNING"), + GuiActivator.getResources().getI18NString( + "service.gui.NO_ONLINE_TELEPHONY_ACCOUNT")) + .showDialog(); + } } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/call/ChooseCallAccountPopupMenu.java b/src/net/java/sip/communicator/impl/gui/main/call/ChooseCallAccountPopupMenu.java index cd4f307d5..d210f6407 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/ChooseCallAccountPopupMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/ChooseCallAccountPopupMenu.java @@ -46,6 +46,12 @@ public class ChooseCallAccountPopupMenu */ private final JComponent invoker; + /** + * The call interface listener, which would be notified once the call + * interface is created. + */ + private CallInterfaceListener callInterfaceListener; + /** * Creates this dialog. * @@ -62,6 +68,25 @@ public ChooseCallAccountPopupMenu( OperationSetBasicTelephony.class); } + /** + * Creates this dialog. + * + * @param invoker the invoker of this pop up menu + * @param contactToCall the contact to call + * @param telephonyProviders a list of all possible telephony providers + */ + public ChooseCallAccountPopupMenu( + JComponent invoker, + final String contactToCall, + List telephonyProviders, + CallInterfaceListener l) + { + this(invoker, contactToCall, telephonyProviders, + OperationSetBasicTelephony.class); + + callInterfaceListener = l; + } + /** * Creates this dialog. * @@ -180,6 +205,9 @@ else if (opSetClass.equals( providerItem.getProtocolProvider(), contactString); + if (callInterfaceListener != null) + callInterfaceListener.callInterfaceStarted(); + ChooseCallAccountPopupMenu.this.setVisible(false); } }); diff --git a/src/net/java/sip/communicator/impl/gui/main/call/DTMFHandler.java b/src/net/java/sip/communicator/impl/gui/main/call/DTMFHandler.java index 798170fe6..bcba73566 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/DTMFHandler.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/DTMFHandler.java @@ -51,103 +51,135 @@ public class DTMFHandler * All available tones and its properties like images for buttons, and * sounds to be played during send. */ - static final DTMFToneInfo[] availableTones = new DTMFToneInfo[] + public static final DTMFToneInfo[] availableTones = new DTMFToneInfo[] { new DTMFToneInfo( DTMFTone.DTMF_1, KeyEvent.VK_1, '1', ImageLoader.ONE_DIAL_BUTTON, + ImageLoader.ONE_DIAL_BUTTON_MAC, + ImageLoader.ONE_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_ONE), new DTMFToneInfo( DTMFTone.DTMF_2, KeyEvent.VK_2, '2', ImageLoader.TWO_DIAL_BUTTON, + ImageLoader.TWO_DIAL_BUTTON_MAC, + ImageLoader.TWO_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_TWO), new DTMFToneInfo( DTMFTone.DTMF_3, KeyEvent.VK_3, '3', ImageLoader.THREE_DIAL_BUTTON, + ImageLoader.THREE_DIAL_BUTTON_MAC, + ImageLoader.THREE_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_THREE), new DTMFToneInfo( DTMFTone.DTMF_4, KeyEvent.VK_4, '4', ImageLoader.FOUR_DIAL_BUTTON, + ImageLoader.FOUR_DIAL_BUTTON_MAC, + ImageLoader.FOUR_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_FOUR), new DTMFToneInfo( DTMFTone.DTMF_5, KeyEvent.VK_5, '5', ImageLoader.FIVE_DIAL_BUTTON, + ImageLoader.FIVE_DIAL_BUTTON_MAC, + ImageLoader.FIVE_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_FIVE), new DTMFToneInfo( DTMFTone.DTMF_6, KeyEvent.VK_6, '6', ImageLoader.SIX_DIAL_BUTTON, + ImageLoader.SIX_DIAL_BUTTON_MAC, + ImageLoader.SIX_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_SIX), new DTMFToneInfo( DTMFTone.DTMF_7, KeyEvent.VK_7, '7', ImageLoader.SEVEN_DIAL_BUTTON, + ImageLoader.SEVEN_DIAL_BUTTON_MAC, + ImageLoader.SEVEN_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_SEVEN), new DTMFToneInfo( DTMFTone.DTMF_8, KeyEvent.VK_8, '8', ImageLoader.EIGHT_DIAL_BUTTON, + ImageLoader.EIGHT_DIAL_BUTTON_MAC, + ImageLoader.EIGHT_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_EIGHT), new DTMFToneInfo( DTMFTone.DTMF_9, KeyEvent.VK_9, '9', ImageLoader.NINE_DIAL_BUTTON, + ImageLoader.NINE_DIAL_BUTTON_MAC, + ImageLoader.NINE_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_NINE), new DTMFToneInfo( DTMFTone.DTMF_A, KeyEvent.VK_A, 'a', null, + null, + null, null), new DTMFToneInfo( DTMFTone.DTMF_B, KeyEvent.VK_B, 'b', null, + null, + null, null), new DTMFToneInfo( DTMFTone.DTMF_C, KeyEvent.VK_C, 'c', null, + null, + null, null), new DTMFToneInfo( DTMFTone.DTMF_D, KeyEvent.VK_D, 'd', null, + null, + null, null), new DTMFToneInfo( DTMFTone.DTMF_STAR, KeyEvent.VK_ASTERISK, '*', ImageLoader.STAR_DIAL_BUTTON, + ImageLoader.STAR_DIAL_BUTTON_MAC, + ImageLoader.STAR_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_STAR), new DTMFToneInfo( DTMFTone.DTMF_0, KeyEvent.VK_0, '0', ImageLoader.ZERO_DIAL_BUTTON, + ImageLoader.ZERO_DIAL_BUTTON_MAC, + ImageLoader.ZERO_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_ZERO), new DTMFToneInfo( DTMFTone.DTMF_SHARP, KeyEvent.VK_NUMBER_SIGN, '#', ImageLoader.DIEZ_DIAL_BUTTON, + ImageLoader.DIEZ_DIAL_BUTTON_MAC, + ImageLoader.DIEZ_DIAL_BUTTON_MAC_ROLLOVER, SoundProperties.DIAL_DIEZ) }; @@ -167,11 +199,23 @@ public DTMFHandler(CallPanel callContainer) keyManager.addKeyEventDispatcher(this); } + /** + * Creates DTMF handler for a call. + * @param callContainer the CallContainer, where this handler is + * registered + */ + public DTMFHandler() + { + KeyboardFocusManager keyManager + = KeyboardFocusManager.getCurrentKeyboardFocusManager(); + keyManager.addKeyEventDispatcher(this); + } + /** * Add parent on which we listen for key entering. * @param w */ - void addParent(Window w) + public void addParent(Window w) { parents.add(w); } @@ -233,7 +277,7 @@ else if(e.getID() == KeyEvent.KEY_RELEASED) * * @param toneValue the value of the DTMF tone to send. */ - void startSendingDtmfTone(String toneValue) + public void startSendingDtmfTone(String toneValue) { for (int i = 0; i < availableTones.length; i++) { @@ -266,8 +310,35 @@ private synchronized void startSendingDtmfTone(DTMFToneInfo info) currentlyPlayingAudio.playInLoop(10); } - Iterator callPeers - = callContainer.getCurrentCallRenderer().getCall().getCallPeers(); + if (callContainer != null) + startSendingDtmfTone( + callContainer.getCurrentCallRenderer().getCall(), + info); + else + { + Collection activeCalls = CallManager.getActiveCalls(); + + if (activeCalls != null) + { + Iterator callsIter = activeCalls.iterator(); + + while (callsIter.hasNext()) + { + startSendingDtmfTone(callsIter.next(), info); + } + } + } + } + + /** + * Sends a DTMF tone to the current DTMF operation set of the given call. + * + * @param call The call to which we send DTMF-s. + * @param info The DTMF tone to send. + */ + private void startSendingDtmfTone(Call call, DTMFToneInfo info) + { + Iterator callPeers = call.getCallPeers(); try { @@ -299,15 +370,40 @@ private synchronized void startSendingDtmfTone(DTMFToneInfo info) /** * Stop sending DTMF tone. */ - synchronized void stopSendingDtmfTone() + public synchronized void stopSendingDtmfTone() { if(currentlyPlayingAudio != null) currentlyPlayingAudio.stop(); currentlyPlayingAudio = null; - Iterator callPeers - = callContainer.getCurrentCallRenderer().getCall().getCallPeers(); + if (callContainer != null) + stopSendingDtmfTone( + callContainer.getCurrentCallRenderer().getCall()); + else + { + Collection activeCalls = CallManager.getActiveCalls(); + + if (activeCalls != null) + { + Iterator callsIter = activeCalls.iterator(); + + while (callsIter.hasNext()) + { + stopSendingDtmfTone(callsIter.next()); + } + } + } + } + + /** + * Stops sending DTMF tone to the given call. + * + * @param call The call to which we send DTMF-s. + */ + private void stopSendingDtmfTone(Call call) + { + Iterator callPeers = call.getCallPeers(); try { @@ -332,32 +428,42 @@ synchronized void stopSendingDtmfTone() /** * DTMF extended information. */ - static class DTMFToneInfo + public static class DTMFToneInfo { /** * The tone itself */ - DTMFTone tone; + public DTMFTone tone; /** * The key code when entered from keyboard. */ - int keyCode; + public int keyCode; /** * The char associated with this DTMF tone. */ - char keyChar; + public char keyChar; /** * The image to display in buttons sending DTMFs. */ - ImageID imageID; + public ImageID imageID; + + /** + * The image to display on Mac buttons. + */ + public ImageID macImageID; + + /** + * The id of the image to display on Mac buttons on rollover. + */ + public ImageID macImageRolloverID; /** * The sound to play during send of this tone. */ - String sound; + public String sound; /** * Creates DTMF extended info. @@ -365,16 +471,20 @@ static class DTMFToneInfo * @param keyCode its key code. * @param keyChar the char associated with the DTMF * @param imageID the image if any. + * @param macImageID the Mac image if any. * @param sound the sound if any. */ public DTMFToneInfo( DTMFTone tone, int keyCode, char keyChar, - ImageID imageID, String sound) + ImageID imageID, ImageID macImageID, + ImageID macImageRolloverID, String sound) { this.tone = tone; this.keyCode = keyCode; this.keyChar = keyChar; this.imageID = imageID; + this.macImageID = macImageID; + this.macImageRolloverID = macImageRolloverID; this.sound = sound; } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java index a2536694d..4d028f8d3 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java @@ -134,7 +134,7 @@ protected void customPaintBackground(Graphics g) int dy = (c.getY() + c.getHeight()) / 2 - searchIcon.getIconHeight()/2; - g2.drawImage(searchIcon.getImage(), c.getX() + 5, dy + 1, null); + g2.drawImage(searchIcon.getImage(), 5, dy + 1, null); if (c.getText() != null && c.getText().length() > 0 diff --git a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java index 7c6b9896a..946e263ef 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java +++ b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java @@ -397,6 +397,150 @@ public class ImageLoader public static final ImageID STATUS_SELECTOR_BOX = new ImageID("service.gui.buttons.STATUS_SELECTOR_BOX"); + /** + * A dial button icon. + */ + public static final ImageID ONE_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.ONE_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID TWO_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.TWO_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID THREE_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.THREE_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID FOUR_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.FOUR_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID FIVE_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.FIVE_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID SIX_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.SIX_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID SEVEN_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.SEVEN_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID EIGHT_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.EIGHT_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID NINE_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.NINE_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID STAR_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.STAR_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID ZERO_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.ZERO_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID DIEZ_DIAL_BUTTON_MAC + = new ImageID("service.gui.buttons.DIEZ_DIAL_BUTTON_MAC"); + + /** + * A dial button icon. + */ + public static final ImageID ONE_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.ONE_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID TWO_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.TWO_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID THREE_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.THREE_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID FOUR_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.FOUR_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID FIVE_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.FIVE_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID SIX_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.SIX_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID SEVEN_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.SEVEN_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID EIGHT_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.EIGHT_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID NINE_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.NINE_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID STAR_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.STAR_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID ZERO_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.ZERO_DIAL_BUTTON_MAC_ROLLOVER"); + + /** + * A dial button icon. + */ + public static final ImageID DIEZ_DIAL_BUTTON_MAC_ROLLOVER + = new ImageID("service.gui.buttons.DIEZ_DIAL_BUTTON_MAC_ROLLOVER"); + /** * A dial button icon. */ @@ -973,6 +1117,30 @@ public class ImageLoader public static final ImageID TRANSPARENT_WINDOW_BUTTON = new ImageID("service.gui.buttons.TRANSPARENT_WINDOW_BUTTON"); + /** + * The dial button shown in contact list. + */ + public static final ImageID CONTACT_LIST_DIAL_BUTTON + = new ImageID("service.gui.buttons.CONTACT_LIST_DIAL_BUTTON"); + + /** + * The dial button shown in contact list. + */ + public static final ImageID CONTACT_LIST_DIAL_BUTTON_PRESSED + = new ImageID("service.gui.buttons.CONTACT_LIST_DIAL_BUTTON_PRESSED"); + + /** + * The dial pad call button background. + */ + public static final ImageID DIAL_PAD_CALL_BUTTON_BG + = new ImageID("service.gui.buttons.DIAL_PAD_CALL_BUTTON_BG"); + + /** + * The dial pad call button rollover background. + */ + public static final ImageID DIAL_PAD_CALL_BUTTON_ROLLOVER_BG + = new ImageID("service.gui.buttons.DIAL_PAD_CALL_BUTTON_ROLLOVER_BG"); + /* * ======================================================================= * ------------------------ EDIT TOOLBAR ICONS --------------------------- diff --git a/src/net/java/sip/communicator/util/swing/SIPCommDialog.java b/src/net/java/sip/communicator/util/swing/SIPCommDialog.java index 75a31cf2f..2f26e612f 100644 --- a/src/net/java/sip/communicator/util/swing/SIPCommDialog.java +++ b/src/net/java/sip/communicator/util/swing/SIPCommDialog.java @@ -18,7 +18,7 @@ * @author Yana Stamcheva * @author Lubomir Marinov */ -public abstract class SIPCommDialog +public class SIPCommDialog extends JDialog { /** @@ -416,5 +416,14 @@ public void dispose() * @param escaped true if this dialog has been closed by pressing * the Esc key; otherwise, false */ - protected abstract void close(boolean escaped); + /** + * All functions implemented in this method will be invoked when user + * presses the Escape key. + * @param isEscaped indicates if this frame has been closed by pressing the + * Esc key + */ + protected void close(boolean isEscaped) + { + + } } diff --git a/src/net/java/sip/communicator/util/swing/plaf/SIPCommTextFieldUI.java b/src/net/java/sip/communicator/util/swing/plaf/SIPCommTextFieldUI.java index eeb081488..4da1b0b0a 100644 --- a/src/net/java/sip/communicator/util/swing/plaf/SIPCommTextFieldUI.java +++ b/src/net/java/sip/communicator/util/swing/plaf/SIPCommTextFieldUI.java @@ -64,28 +64,28 @@ public class SIPCommTextFieldUI /** * The start background gradient color. */ - private final Color bgStartColor + private Color bgStartColor = new Color(UtilActivator.getResources().getColor( "service.gui.SEARCH_BACKGROUND")); /** * The end background gradient color. */ - private final Color bgEndColor + private Color bgEndColor = new Color(UtilActivator.getResources().getColor( "service.gui.SEARCH_GRADIENT")); /** * The start background gradient color. */ - private final Color bgBorderStartColor + private Color bgBorderStartColor = new Color(UtilActivator.getResources().getColor( "service.gui.SEARCH_BORDER")); /** * The end background gradient color. */ - private final Color bgBorderEndColor + private Color bgBorderEndColor = new Color(UtilActivator.getResources().getColor( "service.gui.SEARCH_BORDER_GRADIENT")); @@ -264,8 +264,8 @@ protected Rectangle getDeleteButtonRect() Rectangle rect = c.getBounds(); - int dx = rect.x + rect.width - deleteButton.getWidth() - BUTTON_GAP - 5; - int dy = (rect.y + rect.height) / 2 - deleteButton.getHeight()/2; + int dx = rect.width - deleteButton.getWidth() - BUTTON_GAP - 5; + int dy = rect.height / 2 - deleteButton.getHeight()/2; return new Rectangle( dx, dy, @@ -297,7 +297,7 @@ protected Rectangle getVisibleEditorRect() alloc.x += insets.left; alloc.y += insets.top; alloc.width -= insets.left + insets.right - + deleteButton.getWidth(); + + getDeleteButtonRect().getWidth(); alloc.height -= insets.top + insets.bottom; return alloc; } @@ -305,6 +305,38 @@ protected Rectangle getVisibleEditorRect() return null; } + /** + * @param bgStartColor the bgStartColor to set + */ + public void setBgStartColor(Color bgStartColor) + { + this.bgStartColor = bgStartColor; + } + + /** + * @param bgEndColor the bgEndColor to set + */ + public void setBgEndColor(Color bgEndColor) + { + this.bgEndColor = bgEndColor; + } + + /** + * @param bgBorderStartColor the bgBorderStartColor to set + */ + public void setBgBorderStartColor(Color bgBorderStartColor) + { + this.bgBorderStartColor = bgBorderStartColor; + } + + /** + * @param bgBorderEndColor the bgBorderEndColor to set + */ + public void setBgBorderEndColor(Color bgBorderEndColor) + { + this.bgBorderEndColor = bgBorderEndColor; + } + /** * Reloads skin information. */