#10 add KeyListener

closed
nobody
None
5
2008-08-14
2004-09-29
No

Hello,

most functions are not used by user.

In the most cases, only 20% functions or less are used
frequently.

KeyListener bind some frequently used functionality or
scripts
------
private int display_mode=0;
private String[] display_commands={"spacefill
off;wireframe on","spacefill off;wireframe
0.20","wireframe 0.20;spacefill 20%","spacefill
75%;wireframe off"};
private boolean vector_mode=false;
private boolean vibration_mode=false;
private boolean spin_mode=false;
private boolean movie_mode=false;

public void keyTyped(KeyEvent e)
{
char keyChar = e.getKeyChar();
if (keyChar == 'h' || keyChar == 'H') {
System.err.println("oops");
// help messages for short cut keys (or HotKeys)
return;
}
//if (standalone == true && (keyChar == 'z' ||
keyChar == 'Z')) {
// System.err.println("oops");
// destroy();
// return;
//}
if (keyChar == KeyEvent.CHAR_UNDEFINED)
return;
switch(keyChar) {
case 'm':
case 'M':
if (vector_mode) {
if (vibration_mode) {
vibration_mode=false;
script("vibration off");
} else {
vibration_mode=true;
script("vibration on");
}
repaint();
break;
}
if (movie_mode) {
movie_mode=false;
script("anim off");
} else {
movie_mode=true;
script("anim mode palindrome 2 2;anim on");
}
repaint();
break;
case 'd':
case 'D':
display_mode++;
display_mode %=4;
script(display_commands[display_mode]);
repaint();
break;
case 'n':
case 'N':
script("frame next");
break;
case 'b':
case 'B':
script("frame prev");
break;
case 'r':
case 'R':
if (spin_mode) {
spin_mode=false;
script("spin off");
} else {
spin_mode=true;
script("spin on");
}
repaint();
break;
case 'v':
case 'V':
if (vector_mode) {
vector_mode=false;
script("vectors off");
} else {
vector_mode=true;
script("vectors on");
}
repaint();
break;
}
}
--------

Discussion

  • Won Kyu Park

    Won Kyu Park - 2004-09-29

    Logged In: YES
    user_id=76597

    Oops!

    You can test above simple keyListener in the following site.

    http://chemie.skku.ac.kr/wiki/jmol.html

     
  • Egon Willighagen

    • labels: 319765 -->
    • milestone: 245266 -->
     
  • Miguel

    Miguel - 2004-10-08

    Logged In: YES
    user_id=1050060

    I am glad that you are interested in helping.

    I plan to add extensive keyboard support to the JmolApplet
    in the future.

    Therefore, I do not want to start implementing keyboard
    support at this time. Not until we have fully specified how
    it will be used.

    Miguel

     
  • Won Kyu Park

    Won Kyu Park - 2005-07-02

    Logged In: YES
    user_id=76597

    When this features are fully specified ?

    I suggest common frequently used features
    * toggle display mode (ball&stick, CPK, wireframe) => D
    * prev/next, with animation movie => ",(<)", ".(>)" "m"
    * vibration animation, multiple vibration modes (with
    prev/next)
    * toggle vector => V
    * toggle mesurement (angstrom, nanometer etc.) => U(nit)
    * increase precision => F(loating point)
    * toggle van der waals surfaces => S(urface ?)
    * toggle background (white/black are most frequently used) => B
    * toggle axes => X
    * toggle rotation => R

    and toggle Editing mode (not supported yet) :)

     
  • Bob Hanson

    Bob Hanson - 2008-08-14
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks