/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.console.Console; /* */ import NET.worlds.console.DialogReceiver; /* */ import NET.worlds.console.FileSysDialog; /* */ import NET.worlds.console.PolledDialog; /* */ import java.awt.Button; /* */ import java.awt.Checkbox; /* */ import java.awt.Event; /* */ import java.awt.Font; /* */ import java.awt.GridBagConstraints; /* */ import java.awt.GridBagLayout; /* */ import java.awt.Label; /* */ import java.awt.Panel; /* */ import java.awt.TextField; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ class EditMusicDialog /* */ extends PolledDialog /* */ implements DialogReceiver /* */ { /* */ private static final long serialVersionUID = 1L; /* 646 */ private TextField nameField = new TextField(20); /* 647 */ private TextField trackField = new TextField(3); /* 648 */ private TextField midiField = new TextField(30); /* 649 */ private Button browseButton = new Button(Console.message("Browse")); /* 650 */ private Checkbox loopBox = new Checkbox(Console.message("Loop-cont")); /* 651 */ private Button okButton = new Button(Console.message("OK")); /* 652 */ private Button cancelButton = new Button(Console.message("Cancel")); /* */ /* */ private MusicTrack music; /* */ private String oldName; /* */ private String path; /* 657 */ private static Font font = new Font(Console.message("MenuFont"), /* 658 */ 0, 12); /* 659 */ private static Font bfont = new Font(Console.message("ButtonFont"), /* 660 */ 0, 12); /* */ /* */ public EditMusicDialog(MusicManagerDialog parent, MusicTrack music) /* */ { /* 664 */ super(parent, parent, music == null ? Console.message("Add-Music") : Console.message("Edit-Music"), true); /* */ /* 666 */ this.music = music; /* 667 */ if (music != null) /* 668 */ this.oldName = music.getName(); /* 669 */ this.path = parent.getManager().getFileName().toLowerCase() /* 670 */ .replace('/', '\\'); /* 671 */ this.path = this.path.substring(0, this.path.lastIndexOf('\\') + 1); /* 672 */ ready(); /* */ } /* */ /* */ protected void build() { /* 676 */ GridBagLayout gbag = new GridBagLayout(); /* 677 */ setLayout(gbag); /* 678 */ GridBagConstraints c = new GridBagConstraints(); /* 679 */ c.fill = 0; /* 680 */ c.anchor = 13; /* 681 */ add(gbag, new Label(Console.message("Name"), 2), c); /* 682 */ c.gridwidth = 0; /* 683 */ c.anchor = 17; /* */ /* 685 */ this.nameField.setFont(font); /* 686 */ this.trackField.setFont(font); /* 687 */ this.midiField.setFont(font); /* 688 */ this.browseButton.setFont(bfont); /* 689 */ this.loopBox.setFont(font); /* */ /* 691 */ add(gbag, this.nameField, c); /* 692 */ c.gridwidth = 1; /* 693 */ c.anchor = 13; /* 694 */ Label vt = new Label(Console.message("Virtual-track"), 2); /* 695 */ vt.setFont(font); /* 696 */ add(gbag, vt, c); /* 697 */ c.gridwidth = 0; /* 698 */ c.anchor = 17; /* 699 */ add(gbag, this.trackField, c); /* 700 */ c.gridwidth = 1; /* 701 */ c.anchor = 13; /* 702 */ Label am = new Label(Console.message("Alternate-MIDI"), 2); /* 703 */ am.setFont(font); /* 704 */ add(gbag, am, c); /* 705 */ c.fill = 2; /* 706 */ c.weightx = 1.0D; /* 707 */ c.anchor = 17; /* 708 */ add(gbag, this.midiField, c); /* 709 */ c.fill = 0; /* 710 */ c.weightx = 0.0D; /* 711 */ c.gridwidth = 0; /* 712 */ add(gbag, this.browseButton, c); /* 713 */ add(gbag, this.loopBox, c); /* 714 */ c.fill = 0; /* 715 */ c.anchor = 10; /* 716 */ Panel p = new Panel(); /* 717 */ this.okButton.setFont(bfont); /* 718 */ this.cancelButton.setFont(bfont); /* 719 */ p.add(this.okButton); /* 720 */ p.add(this.cancelButton); /* 721 */ add(gbag, p, c); /* 722 */ if (this.music != null) { /* 723 */ this.nameField.setText(this.music.getName()); /* 724 */ this.trackField.setText(this.music.getVirtTrackNumber()); /* 725 */ this.midiField.setText(this.music.getMIDIFileName()); /* 726 */ this.loopBox.setState(this.music.getLooping()); /* */ } /* */ } /* */ /* */ @Deprecated /* */ public boolean action(Event event, Object what) { /* 732 */ Object target = event.target; /* 733 */ if ((target == this.okButton) && (this.nameField.getText().trim().length() != 0)) /* 734 */ return done(true); /* 735 */ if (target == this.cancelButton) /* 736 */ return done(false); /* 737 */ if (target == this.browseButton) { /* 738 */ dialogDisable(true); /* 739 */ new FileSysDialog(Console.getFrame(), this, /* 740 */ Console.message("Browse-MIDI"), 0, /* 741 */ "MIDI Files|*.mid;*.midi|All Files|*.*", this.path + /* 742 */ this.midiField.getText(), false); /* */ } /* */ /* 745 */ return false; /* */ } /* */ /* */ public synchronized void dialogDone(Object who, boolean confirmed) { /* 749 */ dialogDisable(false); /* 750 */ if ((confirmed) && ((who instanceof FileSysDialog))) { /* 751 */ String name = ((FileSysDialog)who).fileName().toLowerCase(); /* 752 */ if (name.startsWith(this.path)) /* 753 */ this.midiField.setText(name.substring(this.path.length())); /* */ } /* */ } /* */ /* */ public boolean isEditor() { /* 758 */ return this.music != null; /* */ } /* */ /* */ public MusicTrack getMusicTrack() { /* 762 */ String name = this.nameField.getText().trim(); /* 763 */ int track = 0; /* */ try { /* 765 */ track = Integer.parseInt(this.trackField.getText()); /* */ } /* */ catch (NumberFormatException localNumberFormatException) {} /* 768 */ String midi = this.midiField.getText().trim(); /* 769 */ boolean loop = this.loopBox.getState(); /* */ /* 771 */ if (this.music == null) { /* 772 */ return new MusicTrack(name, track, midi, loop); /* */ } /* 774 */ this.music.setName(name); /* 775 */ if (track != -1) /* 776 */ this.music.setVirtTrackNumber(track); /* 777 */ this.music.setMIDIFileName(midi); /* 778 */ this.music.setLooping(loop); /* 779 */ return this.music; /* */ } /* */ /* */ public String getOldName() /* */ { /* 784 */ return this.oldName; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\EditMusicDialog.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */