04
This commit is contained in:
parent
79af0bb07a
commit
bd3ac77767
@ -56,12 +56,12 @@ Meter
|
|||||||
Play
|
Play
|
||||||
Play origin
|
Play origin
|
||||||
Ok
|
Ok
|
||||||
Up one level
|
Language (need to restart)
|
||||||
Delete
|
Delete
|
||||||
Choose folder
|
Instruments language
|
||||||
Open file
|
Note width
|
||||||
Please wait
|
Please wait
|
||||||
Updating list
|
Note height
|
||||||
Save in this folder
|
Save in this folder
|
||||||
Insert tempo
|
Insert tempo
|
||||||
Delete tempo
|
Delete tempo
|
||||||
@ -91,4 +91,6 @@ Key map
|
|||||||
Quick commands
|
Quick commands
|
||||||
Navigation
|
Navigation
|
||||||
Nums, otherwise keypad, when edit notes
|
Nums, otherwise keypad, when edit notes
|
||||||
Name
|
Name
|
||||||
|
Temp directory
|
||||||
|
New folder
|
@ -56,12 +56,12 @@
|
|||||||
Играть
|
Играть
|
||||||
Играть оригинал
|
Играть оригинал
|
||||||
Ok
|
Ok
|
||||||
Назад
|
Язык (необходим рестарт)
|
||||||
Удалить
|
Удалить
|
||||||
Выбрать папку
|
Язык инструментов
|
||||||
Открытый файл
|
Ширина ноты
|
||||||
Пожалуйста, подождите
|
Пожалуйста, подождите
|
||||||
Обновление списка
|
Высота ноты
|
||||||
Сохранить здесь
|
Сохранить здесь
|
||||||
Вставить Темп
|
Вставить Темп
|
||||||
Удалить Темп
|
Удалить Темп
|
||||||
@ -91,4 +91,6 @@ Ok
|
|||||||
Быстрые команды
|
Быстрые команды
|
||||||
Навигация
|
Навигация
|
||||||
Цифрами, иначе джойстиком, при редактировании нот
|
Цифрами, иначе джойстиком, при редактировании нот
|
||||||
Имя
|
Имя
|
||||||
|
Временная папка
|
||||||
|
Новая папка
|
@ -70,12 +70,12 @@ public class L {
|
|||||||
play = 55,
|
play = 55,
|
||||||
playOrigin = 56,
|
playOrigin = 56,
|
||||||
ok = 57,
|
ok = 57,
|
||||||
upOneLevel = 58,
|
language = 58,
|
||||||
delete = 59,
|
delete = 59,
|
||||||
chooseFolder = 60,
|
instrlang = 60,
|
||||||
openFile = 61,
|
noteWidth = 61,
|
||||||
pleaseWait = 62,
|
pleaseWait = 62,
|
||||||
updatingList = 63,
|
noteHeight = 63,
|
||||||
saveInThisFolder = 64,
|
saveInThisFolder = 64,
|
||||||
insertTempo = 65,
|
insertTempo = 65,
|
||||||
deleteTempo = 66,
|
deleteTempo = 66,
|
||||||
@ -105,7 +105,9 @@ public class L {
|
|||||||
quickCommands = 90,
|
quickCommands = 90,
|
||||||
navigation = 91,
|
navigation = 91,
|
||||||
numkeysOptionString = 92,
|
numkeysOptionString = 92,
|
||||||
midiName = 93;
|
midiName = 93,
|
||||||
|
tempDir = 94,
|
||||||
|
newFolder = 95;
|
||||||
|
|
||||||
|
|
||||||
/** Ìàññèâ òåêñòîâûõ ìåòîê */
|
/** Ìàññèâ òåêñòîâûõ ìåòîê */
|
||||||
|
@ -31,8 +31,8 @@ public class P {
|
|||||||
|
|
||||||
//ñêèíû
|
//ñêèíû
|
||||||
//title and soft
|
//title and soft
|
||||||
public static int colup = 0xD0604080;
|
public static int colup = 0x593C77;
|
||||||
public static int coldn = 0xD0754E9C;
|
public static int coldn = 0x926DB6;
|
||||||
//çàäíèé ôîí
|
//çàäíèé ôîí
|
||||||
public static int backgrnd = 0xFFFFFF;
|
public static int backgrnd = 0xFFFFFF;
|
||||||
// ôîí êóðñîðà
|
// ôîí êóðñîðà
|
||||||
|
@ -5,10 +5,11 @@ MIDedit 2.1 / 3.0
|
|||||||
- Сохранение в .mid, а не в .MID
|
- Сохранение в .mid, а не в .MID
|
||||||
- Исправления в локализации.
|
- Исправления в локализации.
|
||||||
- Новое графическое меню. Убраны лишние пункты при запуске.
|
- Новое графическое меню. Убраны лишние пункты при запуске.
|
||||||
|
- Добавлен графический файловый менеджер, показывающий только те файлы, с которыми работает программа.
|
||||||
|
- Добавлена возможность прослушивания мелодии и создания новой папки в файлменеджере.
|
||||||
|
- Некоторые экраны (в основном помощи) изменены на графические.
|
||||||
|
|
||||||
********
|
********
|
||||||
Добавить украинский язык.
|
Добавить украинский язык.
|
||||||
При первом запуске - настройки
|
|
||||||
Help в aNMPWR
|
Help в aNMPWR
|
||||||
player.realize
|
player.realize
|
@ -358,7 +358,6 @@ public class CompositionForm extends Form implements CommandListener, Runnable,
|
|||||||
} else if (command == addInstrument) {
|
} else if (command == addInstrument) {
|
||||||
isAdd = true;
|
isAdd = true;
|
||||||
display.setCurrent(getListOfInstruments());
|
display.setCurrent(getListOfInstruments());
|
||||||
System.out.println("displayable = " + displayable);
|
|
||||||
} else if (command == setInstrument) {
|
} else if (command == setInstrument) {
|
||||||
isAdd = false;
|
isAdd = false;
|
||||||
display.setCurrent(getListOfInstruments());
|
display.setCurrent(getListOfInstruments());
|
||||||
@ -467,7 +466,6 @@ public class CompositionForm extends Form implements CommandListener, Runnable,
|
|||||||
return null;
|
return null;
|
||||||
}*/
|
}*/
|
||||||
private Form getListOfInstruments() {
|
private Form getListOfInstruments() {
|
||||||
System.out.println("in getListInstruments");
|
|
||||||
if (listInstrumentsForm == null) {
|
if (listInstrumentsForm == null) {
|
||||||
ChoiceGroup[] groupsChoiseGroup = new ChoiceGroup[16];
|
ChoiceGroup[] groupsChoiseGroup = new ChoiceGroup[16];
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package midedit;
|
package midedit;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import main.Rms;
|
|
||||||
import main.L;
|
import main.L;
|
||||||
|
|
||||||
//import java.util.*;
|
//import java.util.*;
|
||||||
@ -56,37 +55,7 @@ public class Constants {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static final int MAX_NOTE_LENGTH = 8; // min == 1/(2^5)
|
public static final int MAX_NOTE_LENGTH = 8; // min == 1/(2^5)
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public final static String[] KEY_MAP = {
|
|
||||||
"<LeftSoftKey>", L.str[L.menu],
|
|
||||||
"<RightSoftKey>", L.str[L.back],
|
|
||||||
"<Fire>,<5>", L.str[L.insertNoteWithCurrentAttributes] + "\n" + L.str[L.noteAttributeHelp],
|
|
||||||
"<9>,<Clear>", L.str[L.deleteNote],
|
|
||||||
"<Red Phone>", L.str[L.undo],
|
|
||||||
"<Volume +'\'->", L.str[L.noteVolume],
|
|
||||||
|
|
||||||
"<1>", L.str[L.playFromCurrent],
|
|
||||||
"<3>", L.str[L.playNoteOnCursor],
|
|
||||||
"<7>,<Green Phone>", L.str[L.selectNoteAttribute],
|
|
||||||
"<*>,<#>,<0>", L.str[L.changeNoteAttribute],
|
|
||||||
Rms.numKeysEdit ? "<4>,<6>,<2>,<8>" : "<up>,<down>,<left>,<right>", L.str[L.navigationOnComposition],
|
|
||||||
Rms.numKeysEdit ? "<up>,<down>,<left>,<right>" : "<4>,<6>,<2>,<8>", L.str[L.quicknav],};
|
|
||||||
|
|
||||||
public final static String[] QUICK_COMMANDS = {
|
|
||||||
"<1> ", L.str[L.markBegin],
|
|
||||||
"<2> ", L.str[L.markEnd],
|
|
||||||
"<3> ", L.str[L.copy],
|
|
||||||
"<4> ", L.str[L.pasteInsert],
|
|
||||||
"<5> ", L.str[L.pasteReplace],
|
|
||||||
"<6> ", L.str[L.pasteOverwrite],
|
|
||||||
"<7> ", L.str[L.shiftDelete],
|
|
||||||
"<8> ", L.str[L.clean],
|
|
||||||
"<9> ", L.str[L.playChannelOnScreen],
|
|
||||||
"<*> ", L.str[L.undo],
|
|
||||||
"<0> ", L.str[L.playChannelAll],
|
|
||||||
"<#> ", L.str[L.redo]};
|
|
||||||
|
|
||||||
static VectorArr instrVectorArr = new VectorArr(L.instr, 1, 128);
|
static VectorArr instrVectorArr = new VectorArr(L.instr, 1, 128);
|
||||||
|
|
||||||
|
@ -85,13 +85,7 @@ protected void doSmallDown (){
|
|||||||
for(int i=0; i<Constants.NCHANNEL; ++i)
|
for(int i=0; i<Constants.NCHANNEL; ++i)
|
||||||
drumsTableInverse[drumsTable[i]]=(byte)i;
|
drumsTableInverse[drumsTable[i]]=(byte)i;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public byte[] getDrumsTable()
|
|
||||||
{ return drumsTable; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param g
|
* @param g
|
||||||
|
@ -373,7 +373,6 @@ public class MidiFile implements Waitable {
|
|||||||
}
|
}
|
||||||
return /*numBytesToWrite*/;
|
return /*numBytesToWrite*/;
|
||||||
}
|
}
|
||||||
// private byte getVolume
|
|
||||||
|
|
||||||
public byte[] writeNote(byte instr, byte nn)//+
|
public byte[] writeNote(byte instr, byte nn)//+
|
||||||
{
|
{
|
||||||
|
@ -8,12 +8,13 @@ import main.L;
|
|||||||
import main.P;
|
import main.P;
|
||||||
import main.Main;
|
import main.Main;
|
||||||
import main.Rms;
|
import main.Rms;
|
||||||
|
import ui.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author user
|
* @author user
|
||||||
*/
|
*/
|
||||||
abstract public class MixerCanvas extends Canvas implements Runnable {
|
public abstract class MixerCanvas extends Canvas implements Runnable {
|
||||||
|
|
||||||
private static final Font defFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
|
private static final Font defFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
|
||||||
protected Composition composition;
|
protected Composition composition;
|
||||||
@ -32,8 +33,8 @@ abstract public class MixerCanvas extends Canvas implements Runnable {
|
|||||||
private final Runnable playingRunnable = new Runnable() {
|
private final Runnable playingRunnable = new Runnable() {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
System.out.println("getTimeToCanvasConct() = " + composition.getTime2CanvasConst());
|
//System.out.println("getTimeToCanvasConct() = " + composition.getTime2CanvasConst());
|
||||||
System.out.println("Thread.currentThread = " + Thread.currentThread());
|
//System.out.println("Thread.currentThread = " + Thread.currentThread());
|
||||||
while (CompositionForm.isPlaying) {
|
while (CompositionForm.isPlaying) {
|
||||||
try {
|
try {
|
||||||
doSmallRight();
|
doSmallRight();
|
||||||
@ -381,7 +382,7 @@ abstract public class MixerCanvas extends Canvas implements Runnable {
|
|||||||
model.playMix(composition, xBase * Constants.timeConst);
|
model.playMix(composition, xBase * Constants.timeConst);
|
||||||
playingThread = new Thread(playingRunnable);
|
playingThread = new Thread(playingRunnable);
|
||||||
playingThread.start();
|
playingThread.start();
|
||||||
System.out.println("CompositionForm.isPlaying = " + CompositionForm.isPlaying);
|
//System.out.println("CompositionForm.isPlaying = " + CompositionForm.isPlaying);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Exception = " + e);
|
System.out.println("Exception = " + e);
|
||||||
@ -1411,13 +1412,26 @@ abstract public class MixerCanvas extends Canvas implements Runnable {
|
|||||||
mainMenu.addItem(undoMenu);
|
mainMenu.addItem(undoMenu);
|
||||||
|
|
||||||
Menu helpMenu = new Menu(L.str[L.help], mainMenu, MENU_BEGX, MENU_BEGY, MENU_WIDTH, menuNumLines, ONE_LINE_HEIGHT);
|
Menu helpMenu = new Menu(L.str[L.help], mainMenu, MENU_BEGX, MENU_BEGY, MENU_WIDTH, menuNumLines, ONE_LINE_HEIGHT);
|
||||||
|
|
||||||
MenuItem mapItem = new MenuItem(L.str[L.keymap], 0) {
|
MenuItem mapItem = new MenuItem(L.str[L.keymap], 0) {
|
||||||
|
|
||||||
public boolean actionPerformed() {
|
public boolean actionPerformed() {
|
||||||
Form form = new Form(L.str[L.quickCommands], createStringItems(Constants.KEY_MAP));
|
String[] KEY_MAP = {
|
||||||
form.addCommand(CompositionForm.ok);
|
"<LeftSoftKey>", L.str[L.menu],
|
||||||
form.setCommandListener(Options.this);
|
"<RightSoftKey>", L.str[L.back],
|
||||||
MixerCanvas.this.display.setCurrent(form);
|
"<Fire>,<5>", L.str[L.insertNoteWithCurrentAttributes] + "\n" + L.str[L.noteAttributeHelp],
|
||||||
|
"<9>,<Clear>", L.str[L.deleteNote],
|
||||||
|
"<Red Phone>", L.str[L.undo],
|
||||||
|
"<Volume +'\'->", L.str[L.noteVolume],
|
||||||
|
"<1>", L.str[L.playFromCurrent],
|
||||||
|
"<3>", L.str[L.playNoteOnCursor],
|
||||||
|
"<7>,<Green Phone>", L.str[L.selectNoteAttribute],
|
||||||
|
"<*>,<#>,<0>", L.str[L.changeNoteAttribute],
|
||||||
|
Rms.numKeysEdit ? "<4>,<6>,<2>,<8>" : "<up>,<down>,<left>,<right>", L.str[L.navigationOnComposition],
|
||||||
|
Rms.numKeysEdit ? "<up>,<down>,<left>,<right>" : "<4>,<6>,<2>,<8>", L.str[L.quicknav]
|
||||||
|
};
|
||||||
|
TextView tv = new TextView(createString(KEY_MAP), L.str[L.keymap], MixerCanvas.this);
|
||||||
|
MixerCanvas.this.display.setCurrent(tv);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1425,10 +1439,22 @@ abstract public class MixerCanvas extends Canvas implements Runnable {
|
|||||||
MenuItem quickItem = new MenuItem(L.str[L.quickCommands], 0) {
|
MenuItem quickItem = new MenuItem(L.str[L.quickCommands], 0) {
|
||||||
|
|
||||||
public boolean actionPerformed() {
|
public boolean actionPerformed() {
|
||||||
Form form = new Form(L.str[L.quickCommands], createStringItems(Constants.QUICK_COMMANDS));
|
String[] QUICK_COMMANDS = {
|
||||||
form.addCommand(CompositionForm.ok);
|
"<1> ", L.str[L.markBegin],
|
||||||
form.setCommandListener(Options.this);
|
"<2> ", L.str[L.markEnd],
|
||||||
MixerCanvas.this.display.setCurrent(form);
|
"<3> ", L.str[L.copy],
|
||||||
|
"<4> ", L.str[L.pasteInsert],
|
||||||
|
"<5> ", L.str[L.pasteReplace],
|
||||||
|
"<6> ", L.str[L.pasteOverwrite],
|
||||||
|
"<7> ", L.str[L.shiftDelete],
|
||||||
|
"<8> ", L.str[L.clean],
|
||||||
|
"<9> ", L.str[L.playChannelOnScreen],
|
||||||
|
"<*> ", L.str[L.undo],
|
||||||
|
"<0> ", L.str[L.playChannelAll],
|
||||||
|
"<#> ", L.str[L.redo]
|
||||||
|
};
|
||||||
|
TextView tv = new TextView(createString(QUICK_COMMANDS), L.str[L.quickCommands], MixerCanvas.this);
|
||||||
|
MixerCanvas.this.display.setCurrent(tv);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1447,13 +1473,12 @@ abstract public class MixerCanvas extends Canvas implements Runnable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Item[] createStringItems(String strings[]) {
|
private String createString(String[] strings) {
|
||||||
StringItem[] strItem = new StringItem[strings.length / 2];
|
StringBuffer sb = new StringBuffer();
|
||||||
for (int i = 0; i < strings.length / 2; i++) {
|
for (int i = 0; i < strings.length / 2; i++) {
|
||||||
strItem[i] = new StringItem(strings[i * 2], strings[i * 2 + 1], 1);
|
sb.append(strings[i * 2]).append(" - ").append(strings[i * 2 + 1]).append('\n');
|
||||||
strItem[i].setFont(P.smPlain);
|
|
||||||
}
|
}
|
||||||
return strItem;
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commandAction(Command c, Displayable displayable) {
|
public void commandAction(Command c, Displayable displayable) {
|
||||||
|
@ -31,7 +31,7 @@ public class MixerModel extends Thread {
|
|||||||
static AbstractFile rmsFile = new RMSFile(),
|
static AbstractFile rmsFile = new RMSFile(),
|
||||||
//localFile,//=rmsFile,
|
//localFile,//=rmsFile,
|
||||||
jsr75File;//=rmsFile;// = new JSR75File();
|
jsr75File;//=rmsFile;// = new JSR75File();
|
||||||
AbstractPlayer crossPlayer = null;
|
public AbstractPlayer crossPlayer = null;
|
||||||
|
|
||||||
public MixerModel() {
|
public MixerModel() {
|
||||||
try {
|
try {
|
||||||
|
@ -31,14 +31,6 @@ public class NotesCanvas extends MixerCanvas {
|
|||||||
channel = ch;
|
channel = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int getChannel() {
|
|
||||||
return channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -55,14 +47,6 @@ public class NotesCanvas extends MixerCanvas {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected String getCurTuneString() {
|
|
||||||
return "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param g
|
* @param g
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package midedit;
|
package midedit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import midedit.media.Composition;
|
import midedit.media.Composition;
|
||||||
import javax.microedition.lcdui.*;
|
import javax.microedition.lcdui.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -9,165 +7,150 @@ import javax.microedition.lcdui.List;
|
|||||||
import main.L;
|
import main.L;
|
||||||
import main.P;
|
import main.P;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author user
|
* @author user
|
||||||
*/
|
*/
|
||||||
public class TempoList extends List implements CommandListener
|
public class TempoList extends List implements CommandListener {
|
||||||
{
|
|
||||||
private Composition composition;
|
|
||||||
private MixerModel model;
|
|
||||||
private Displayable backForm;
|
|
||||||
private Vector tempNotes;
|
|
||||||
static private Command instempo = new Command(L.str[L.insertTempo],Command.ITEM, 1);
|
|
||||||
static private Command deltempo = new Command(L.str[L.deleteTempo],Command.ITEM, 1);
|
|
||||||
private int tick = 0;
|
|
||||||
private int meterNom=4,meterDenom=4;
|
|
||||||
private int editNum = -1;
|
|
||||||
|
|
||||||
/**
|
private Composition composition;
|
||||||
*
|
private MixerModel model;
|
||||||
* @param c
|
private Displayable backForm;
|
||||||
* @param m
|
private Vector tempNotes;
|
||||||
* @param back
|
static private Command instempo = new Command(L.str[L.insertTempo], Command.ITEM, 1);
|
||||||
*/
|
static private Command deltempo = new Command(L.str[L.deleteTempo], Command.ITEM, 1);
|
||||||
public TempoList(Composition c,MixerModel m,Displayable back)
|
private int tick = 0;
|
||||||
{
|
private int meterNom = 4, meterDenom = 4;
|
||||||
super(L.str[L.tempo],IMPLICIT);
|
private int editNum = -1;
|
||||||
composition = c;
|
|
||||||
model = m;
|
/**
|
||||||
backForm = back;
|
*
|
||||||
tempNotes = new Vector();
|
* @param c
|
||||||
meterNom = composition.getNom();
|
* @param m
|
||||||
meterDenom = 1<<composition.getDenomE();
|
* @param back
|
||||||
tick = composition.getTicksPer4() * 4 * meterNom/meterDenom;
|
*/
|
||||||
|
public TempoList(Composition c, MixerModel m, Displayable back) {
|
||||||
|
super(L.str[L.tempo], IMPLICIT);
|
||||||
|
composition = c;
|
||||||
|
model = m;
|
||||||
|
backForm = back;
|
||||||
|
tempNotes = new Vector();
|
||||||
|
meterNom = composition.getNom();
|
||||||
|
meterDenom = 1 << composition.getDenomE();
|
||||||
|
tick = composition.getTicksPer4() * 4 * meterNom / meterDenom;
|
||||||
System.out.println("tick = " + tick);
|
System.out.println("tick = " + tick);
|
||||||
this.addCommand(instempo);
|
this.addCommand(instempo);
|
||||||
this.addCommand(deltempo);
|
this.addCommand(deltempo);
|
||||||
this.addCommand(CompositionForm.back);
|
this.addCommand(CompositionForm.back);
|
||||||
this.setCommandListener(this);
|
this.setCommandListener(this);
|
||||||
int
|
int tmp;
|
||||||
tmp;
|
NoteLong notelong;
|
||||||
NoteLong notelong;
|
for (Note note = c.getNoteListByChannel(Composition.DEFAULT_CHANNEL).getFirst(); note != null; note = note.next) {
|
||||||
for(Note note = c.getNoteListByChannel(Composition.DEFAULT_CHANNEL).getFirst(); note != null ; note = note.next)
|
if (note instanceof NoteLong) {
|
||||||
{
|
notelong = (NoteLong) note;
|
||||||
if(note instanceof NoteLong)
|
if (notelong.dat[0] == (byte) 0xff && notelong.dat[1] == (byte) 0x51) {
|
||||||
{
|
tmp = 0;
|
||||||
notelong = (NoteLong)note;
|
for (int i = 3; i <= 5; ++i) {
|
||||||
if(notelong.dat[0] == (byte)0xff && notelong.dat[1] == (byte)0x51)
|
tmp = (tmp << 8) | 0xff & notelong.dat[i];
|
||||||
{
|
}
|
||||||
tmp = 0;
|
|
||||||
for (int i = 3; i <= 5; ++i) {
|
|
||||||
tmp = (tmp << 8) | 0xff & notelong.dat[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
tempNotes.addElement(notelong);
|
tempNotes.addElement(notelong);
|
||||||
this.append(getTempoString(note, tmp), null);
|
this.append(getTempoString(note, tmp), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private String getTempoString(Note note,int tempMsPer4)
|
|
||||||
{
|
|
||||||
int tempBPM;
|
|
||||||
int mod = (composition.getTicksPer4()<<2)>>(composition.getDenomE());
|
|
||||||
tempBPM = Composition.getTempBeatPerMin(tempMsPer4);
|
|
||||||
return ""+note.t/tick+":"+(note.t*meterNom/tick)%meterNom+":"+
|
|
||||||
note.t%mod+" - "+ tempBPM;
|
|
||||||
|
|
||||||
}
|
private String getTempoString(Note note, int tempMsPer4) {
|
||||||
private void viewInsertForm(int time,int tempo)
|
int tempBPM;
|
||||||
{
|
int mod = (composition.getTicksPer4() << 2) >> (composition.getDenomE());
|
||||||
Form textBoxTemp = new Form(L.str[L.insertTempo]);
|
tempBPM = Composition.getTempBeatPerMin(tempMsPer4);
|
||||||
final TextField timeField = new TextField(L.str[L.time], ""+time, 4, TextField.NUMERIC);
|
return "" + note.t / tick + ":" + (note.t * meterNom / tick) % meterNom + ":"
|
||||||
textBoxTemp.append(timeField);
|
+ note.t % mod + " - " + tempBPM;
|
||||||
final TextField tempoField = new TextField(L.str[L.tempo], "" + tempo, 4, TextField.NUMERIC);
|
|
||||||
textBoxTemp.append(tempoField);
|
|
||||||
textBoxTemp.addCommand(CompositionForm.ok);
|
|
||||||
textBoxTemp.addCommand(P.comCancel);
|
|
||||||
textBoxTemp.setCommandListener(new CommandListener()
|
|
||||||
{
|
|
||||||
public void commandAction(Command command, Displayable displayable)
|
|
||||||
{
|
|
||||||
if (command == CompositionForm.ok)
|
|
||||||
{
|
|
||||||
if(editNum>=0)
|
|
||||||
delTemp(editNum);
|
|
||||||
editNum = -1;
|
|
||||||
|
|
||||||
int tempMsPer4 = Composition.getMsPer4(Integer.parseInt(tempoField.getString(),
|
|
||||||
10));
|
|
||||||
int time = tick * Integer.parseInt(timeField.getString(), 10);
|
|
||||||
NoteLong noteTemp = composition.addTemp(time, tempMsPer4);
|
|
||||||
Note note;
|
|
||||||
int ind;
|
|
||||||
for (ind = 0; ind < tempNotes.size(); ++ind) {
|
|
||||||
note = (NoteLong) tempNotes.elementAt(ind);
|
|
||||||
if (note.t > time)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
tempNotes.insertElementAt(noteTemp, ind);
|
|
||||||
TempoList.this.insert(ind, getTempoString(noteTemp, tempMsPer4), null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
model.display.setCurrent(TempoList.this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
model.display.setCurrent(textBoxTemp);
|
|
||||||
|
|
||||||
}
|
private void viewInsertForm(int time, int tempo) {
|
||||||
private void delTemp(int ind)
|
Form textBoxTemp = new Form(L.str[L.insertTempo]);
|
||||||
{
|
final TextField timeField = new TextField(L.str[L.time], "" + time, 4, TextField.NUMERIC);
|
||||||
composition.delTemp( (NoteLong) tempNotes.elementAt(ind));
|
textBoxTemp.append(timeField);
|
||||||
tempNotes.removeElementAt(ind);
|
final TextField tempoField = new TextField(L.str[L.tempo], "" + tempo, 4, TextField.NUMERIC);
|
||||||
this.delete(ind);
|
textBoxTemp.append(tempoField);
|
||||||
}
|
textBoxTemp.addCommand(CompositionForm.ok);
|
||||||
|
textBoxTemp.addCommand(P.comCancel);
|
||||||
|
textBoxTemp.setCommandListener(new CommandListener() {
|
||||||
|
|
||||||
/**
|
public void commandAction(Command command, Displayable displayable) {
|
||||||
*
|
if (command == CompositionForm.ok) {
|
||||||
* @param command
|
if (editNum >= 0) {
|
||||||
* @param displayable
|
delTemp(editNum);
|
||||||
*/
|
}
|
||||||
public void commandAction(Command command, Displayable displayable)
|
editNum = -1;
|
||||||
{
|
|
||||||
if(command == instempo)
|
|
||||||
{
|
|
||||||
editNum = -1;
|
|
||||||
viewInsertForm(0,120);
|
|
||||||
|
|
||||||
}
|
int tempMsPer4 = Composition.getMsPer4(Integer.parseInt(tempoField.getString(),
|
||||||
else if(command == deltempo)
|
10));
|
||||||
{
|
int time = tick * Integer.parseInt(timeField.getString(), 10);
|
||||||
|
NoteLong noteTemp = composition.addTemp(time, tempMsPer4);
|
||||||
|
Note note;
|
||||||
|
int ind;
|
||||||
|
for (ind = 0; ind < tempNotes.size(); ++ind) {
|
||||||
|
note = (NoteLong) tempNotes.elementAt(ind);
|
||||||
|
if (note.t > time) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tempNotes.insertElementAt(noteTemp, ind);
|
||||||
|
TempoList.this.insert(ind, getTempoString(noteTemp, tempMsPer4), null);
|
||||||
|
|
||||||
if(tempNotes.size()>1)
|
}
|
||||||
{
|
model.display.setCurrent(TempoList.this);
|
||||||
delTemp(this.getSelectedIndex());
|
}
|
||||||
}
|
});
|
||||||
}
|
model.display.setCurrent(textBoxTemp);
|
||||||
else if(command == CompositionForm.back)
|
|
||||||
{
|
|
||||||
model.display.setCurrent(backForm);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int ind = this.getSelectedIndex();
|
|
||||||
|
|
||||||
NoteLong notelong = (NoteLong)tempNotes.elementAt(ind);
|
}
|
||||||
int tmp = 0;
|
|
||||||
for (int i = 3; i <= 5; ++i) {
|
|
||||||
tmp = (tmp << 8) | 0xff & notelong.dat[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
int mod = (composition.getTicksPer4() << 2) >> (composition.getDenomE());
|
private void delTemp(int ind) {
|
||||||
int tempBPM =Composition.getTempBeatPerMin(tmp);
|
composition.delTemp((NoteLong) tempNotes.elementAt(ind));
|
||||||
int time = notelong.t/tick;
|
tempNotes.removeElementAt(ind);
|
||||||
|
this.delete(ind);
|
||||||
|
}
|
||||||
|
|
||||||
editNum = ind;
|
/**
|
||||||
|
*
|
||||||
|
* @param command
|
||||||
|
* @param displayable
|
||||||
|
*/
|
||||||
|
public void commandAction(Command command, Displayable displayable) {
|
||||||
|
if (command == instempo) {
|
||||||
|
editNum = -1;
|
||||||
|
viewInsertForm(0, 120);
|
||||||
|
|
||||||
viewInsertForm(time,tempBPM);
|
} else if (command == deltempo) {
|
||||||
|
|
||||||
}
|
if (tempNotes.size() > 1) {
|
||||||
}
|
delTemp(this.getSelectedIndex());
|
||||||
|
}
|
||||||
|
} else if (command == CompositionForm.back) {
|
||||||
|
model.display.setCurrent(backForm);
|
||||||
|
} else {
|
||||||
|
int ind = this.getSelectedIndex();
|
||||||
|
|
||||||
|
NoteLong notelong = (NoteLong) tempNotes.elementAt(ind);
|
||||||
|
int tmp = 0;
|
||||||
|
for (int i = 3; i <= 5; ++i) {
|
||||||
|
tmp = (tmp << 8) | 0xff & notelong.dat[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
int mod = (composition.getTicksPer4() << 2) >> (composition.getDenomE());
|
||||||
|
int tempBPM = Composition.getTempBeatPerMin(tmp);
|
||||||
|
int time = notelong.t / tick;
|
||||||
|
|
||||||
|
editNum = ind;
|
||||||
|
|
||||||
|
viewInsertForm(time, tempBPM);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package midedit.io;
|
package midedit.io;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -8,6 +9,7 @@ import java.io.*;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractFile {
|
public abstract class AbstractFile {
|
||||||
|
|
||||||
|
public static final String[] types = {"mid", "midi"};
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -21,22 +23,6 @@ public abstract class AbstractFile {
|
|||||||
*/
|
*/
|
||||||
public abstract String[] list(String pathName);
|
public abstract String[] list(String pathName);
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public final String getLastListPath() {
|
|
||||||
return lastPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param pathName
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public abstract boolean isDirectory(String pathName) throws IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param fileDescriptor
|
* @param fileDescriptor
|
||||||
@ -125,7 +111,7 @@ public abstract class AbstractFile {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected abstract String getPrefix();
|
public abstract String getPrefix();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -138,4 +124,50 @@ public abstract class AbstractFile {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract String getAns();
|
public abstract String getAns();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ïóçûðüêîâàÿ ñîðòèðîâêà.
|
||||||
|
* Ñîðòèðóåò ïî èìåíè, à ïîòîì ïîäûìàåò ïàïêè â íà÷àëî
|
||||||
|
* @param files âåêòîð ñî ñïèñêîì èì¸í ôàéëîâ è ïàïîê
|
||||||
|
* @param reverse true - ñîðòèðîâêà ïî óáûâàíèþ
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected static String[] bubbleSort(Vector files) {
|
||||||
|
String tmp;
|
||||||
|
for (int i = files.size() - 1; i >= 0; i--) {
|
||||||
|
for (int j = 0; j < i; j++) {
|
||||||
|
if ((tmp = (String) files.elementAt(j)).toLowerCase().compareTo(((String) files.elementAt(j + 1)).toLowerCase()) > 0) {
|
||||||
|
files.setElementAt((String) files.elementAt(j + 1), j);
|
||||||
|
files.setElementAt(tmp, j + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String[] arr = sortFiles(files);
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ñîðòèðîâêà ôàéëîâ.
|
||||||
|
* Ïàïêè ïîäíèìàþòñÿ â íà÷àëî ñïèñêà, îñòàëüíûå ôàéëû íå òðîãàþòñÿ.
|
||||||
|
* @param files âåêòîð ñî ñïèñêîì èì¸í ôàéëîâ è ïàïîê
|
||||||
|
* @return ìàññèâ ñ îòñîðòèðîâàííûì ñïèñêîì
|
||||||
|
*/
|
||||||
|
private static String[] sortFiles(Vector files) {
|
||||||
|
int length = files.size();
|
||||||
|
String[] out = new String[length];
|
||||||
|
int i = 0;
|
||||||
|
for (int j = 0; j < length; j++) {
|
||||||
|
if (((String)files.elementAt(j)).indexOf("/") != -1) {
|
||||||
|
out[i] = ((String)files.elementAt(j));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int k = 0; k < length; k++) {
|
||||||
|
if (((String)files.elementAt(k)).indexOf("/") == -1) {
|
||||||
|
out[i] = ((String)files.elementAt(k));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,16 @@ public class JSR75File extends AbstractFile {
|
|||||||
currDir = (FileConnection) Connector.open("file://" + pathName, Connector.READ);
|
currDir = (FileConnection) Connector.open("file://" + pathName, Connector.READ);
|
||||||
en = currDir.list();
|
en = currDir.list();
|
||||||
}
|
}
|
||||||
// Ïåðåìåùàåì ñïèñîê â âåêòîð
|
// Ïåðåìåùàåì ñïèñîê ìèäèøåê â âåêòîð
|
||||||
while(en.hasMoreElements()) {
|
while(en.hasMoreElements()) {
|
||||||
String s1 = (String) en.nextElement();
|
String s1 = (String) en.nextElement();
|
||||||
vector.addElement(s1);
|
for(int i=0; i<types.length; i++) {
|
||||||
|
if ((s1.toLowerCase().endsWith("."+types[i])) || s1.endsWith("/")) {
|
||||||
|
vector.addElement(s1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//vector.addElement(s1);
|
||||||
}
|
}
|
||||||
if (currDir != null) currDir.close();
|
if (currDir != null) currDir.close();
|
||||||
} catch (IOException ion) {
|
} catch (IOException ion) {
|
||||||
@ -48,29 +54,6 @@ public class JSR75File extends AbstractFile {
|
|||||||
return bubbleSort(vector);
|
return bubbleSort(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param pathName
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public boolean isDirectory(String pathName) throws IOException {
|
|
||||||
FileConnection currDir = null;
|
|
||||||
|
|
||||||
if (pathName == null) {
|
|
||||||
throw new IOException("step -4: pathName==null");
|
|
||||||
}
|
|
||||||
|
|
||||||
currDir = (FileConnection) Connector.open(getPrefix() + pathName);
|
|
||||||
|
|
||||||
if (currDir == null) {
|
|
||||||
throw new IOException("step -3:" + getPrefix() + pathName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (currDir.exists() && currDir.isDirectory());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param fileDescriptor
|
* @param fileDescriptor
|
||||||
@ -248,7 +231,7 @@ public class JSR75File extends AbstractFile {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected String getPrefix() {
|
public String getPrefix() {
|
||||||
return "file://";
|
return "file://";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,49 +251,4 @@ public class JSR75File extends AbstractFile {
|
|||||||
return "save ok";
|
return "save ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Ïóçûðüêîâàÿ ñîðòèðîâêà.
|
|
||||||
* Ñîðòèðóåò ïî èìåíè, à ïîòîì ïîäûìàåò ïàïêè â íà÷àëî
|
|
||||||
* @param files âåêòîð ñî ñïèñêîì èì¸í ôàéëîâ è ïàïîê
|
|
||||||
* @param reverse true - ñîðòèðîâêà ïî óáûâàíèþ
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static String[] bubbleSort(Vector files) {
|
|
||||||
String tmp;
|
|
||||||
for (int i = files.size() - 1; i >= 0; i--) {
|
|
||||||
for (int j = 0; j < i; j++) {
|
|
||||||
if ((tmp = (String) files.elementAt(j)).toLowerCase().compareTo(((String) files.elementAt(j + 1)).toLowerCase()) > 0) {
|
|
||||||
files.setElementAt((String) files.elementAt(j + 1), j);
|
|
||||||
files.setElementAt(tmp, j + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String[] arr = sortFiles(files);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ñîðòèðîâêà ôàéëîâ.
|
|
||||||
* Ïàïêè ïîäíèìàþòñÿ â íà÷àëî ñïèñêà, îñòàëüíûå ôàéëû íå òðîãàþòñÿ.
|
|
||||||
* @param files âåêòîð ñî ñïèñêîì èì¸í ôàéëîâ è ïàïîê
|
|
||||||
* @return ìàññèâ ñ îòñîðòèðîâàííûì ñïèñêîì
|
|
||||||
*/
|
|
||||||
private static String[] sortFiles(Vector files) {
|
|
||||||
int length = files.size();
|
|
||||||
String[] out = new String[length];
|
|
||||||
int i = 0;
|
|
||||||
for (int j = 0; j < length; j++) {
|
|
||||||
if (((String)files.elementAt(j)).indexOf("/") != -1) {
|
|
||||||
out[i] = ((String)files.elementAt(j));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int k = 0; k < length; k++) {
|
|
||||||
if (((String)files.elementAt(k)).indexOf("/") == -1) {
|
|
||||||
out[i] = ((String)files.elementAt(k));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package midedit.io;
|
package midedit.io;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.Vector;
|
||||||
import javax.microedition.rms.*;
|
import javax.microedition.rms.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,8 +18,19 @@ public class RMSFile extends AbstractFile {
|
|||||||
private int recordID = 0;
|
private int recordID = 0;
|
||||||
|
|
||||||
public String[] list(String pathName) {
|
public String[] list(String pathName) {
|
||||||
|
Vector vector = new Vector();
|
||||||
String[] fileList = RecordStore.listRecordStores();
|
String[] fileList = RecordStore.listRecordStores();
|
||||||
return fileList;
|
for (int idx = 0; idx < fileList.length; idx++) {
|
||||||
|
String s1 = fileList[idx];
|
||||||
|
for(int i=0; i<types.length; i++) {
|
||||||
|
if (s1.toLowerCase().endsWith("."+types[i])) {
|
||||||
|
vector.addElement(s1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Ñîðòèðóåì è âîçâðàùàåì ñïèñîê
|
||||||
|
return bubbleSort(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int write(int fileDescriptor,
|
public int write(int fileDescriptor,
|
||||||
@ -193,11 +205,7 @@ public class RMSFile extends AbstractFile {
|
|||||||
return isLocal;
|
return isLocal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDirectory(String pathName) throws IOException {
|
public String getPrefix() {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getPrefix() {
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ public class Composition {
|
|||||||
*/
|
*/
|
||||||
public static final int DEFAULT_CHANNEL = 0;
|
public static final int DEFAULT_CHANNEL = 0;
|
||||||
private int timeNoteOff;
|
private int timeNoteOff;
|
||||||
private int volume;
|
|
||||||
private int ticksPer4;
|
private int ticksPer4;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -63,7 +62,6 @@ public class Composition {
|
|||||||
instruments[Constants.DRUMS_CHANNEL] = -1;
|
instruments[Constants.DRUMS_CHANNEL] = -1;
|
||||||
|
|
||||||
isSoloMode = false;
|
isSoloMode = false;
|
||||||
volume = 60;
|
|
||||||
setTicksPer4(240);
|
setTicksPer4(240);
|
||||||
|
|
||||||
undoableAction = new UndoableAction(this);
|
undoableAction = new UndoableAction(this);
|
||||||
@ -408,22 +406,6 @@ public class Composition {
|
|||||||
return ticksPer4 / 8;
|
return ticksPer4 / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param v
|
|
||||||
*/
|
|
||||||
public void setVolume(int v) {
|
|
||||||
volume = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int getVolume() {
|
|
||||||
return volume;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param ch
|
* @param ch
|
||||||
|
56
src/midedit/media/PreviewPlayer.java
Normal file
56
src/midedit/media/PreviewPlayer.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package midedit.media;
|
||||||
|
|
||||||
|
import midedit.MixerModel;
|
||||||
|
import javax.microedition.media.*;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author user
|
||||||
|
*/
|
||||||
|
public class PreviewPlayer implements PlayerListener {
|
||||||
|
|
||||||
|
private boolean isPlaying = false;
|
||||||
|
private Player player;
|
||||||
|
|
||||||
|
public void playerUpdate(Player player, java.lang.String event, java.lang.Object eventData) {
|
||||||
|
if (event.equals(STARTED)) {
|
||||||
|
isPlaying = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.equals(STOPPED) || event.equals(CLOSED) || event.equals(END_OF_MEDIA)) {
|
||||||
|
isPlaying = false;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void play(String path) throws Exception {
|
||||||
|
if (player != null) {
|
||||||
|
player.close();
|
||||||
|
}
|
||||||
|
InputStream is = MixerModel.getLocalFile().getInputStreambyURL(path);
|
||||||
|
player = Manager.createPlayer(is, "audio/midi");
|
||||||
|
player.addPlayerListener(this);
|
||||||
|
player.realize();
|
||||||
|
player.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() throws Exception {
|
||||||
|
if (player != null) {
|
||||||
|
player.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
if (player != null) {
|
||||||
|
player.close();
|
||||||
|
}
|
||||||
|
player = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPlaying() {
|
||||||
|
return isPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package ui;
|
package ui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import util.FWCashe;
|
import util.FWCashe;
|
||||||
import main.P;
|
import main.P;
|
||||||
import main.Main;
|
import main.Main;
|
||||||
@ -9,6 +10,7 @@ import java.util.*;
|
|||||||
import javax.microedition.lcdui.*;
|
import javax.microedition.lcdui.*;
|
||||||
import midedit.CompositionForm;
|
import midedit.CompositionForm;
|
||||||
import midedit.io.AbstractFile;
|
import midedit.io.AbstractFile;
|
||||||
|
import midedit.media.PreviewPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ôàéëîâûé ìåíåäæåð
|
* Ôàéëîâûé ìåíåäæåð
|
||||||
@ -45,6 +47,9 @@ public class FileManager extends Canvas {
|
|||||||
/** Ôàéëîâàÿ ñèñòåìà */
|
/** Ôàéëîâàÿ ñèñòåìà */
|
||||||
private AbstractFile file;
|
private AbstractFile file;
|
||||||
|
|
||||||
|
/** Ïðåäïðîñëóøèâàíèå */
|
||||||
|
private PreviewPlayer pw;
|
||||||
|
|
||||||
/** Èçîáðàæåíèÿ è èêîíêè ãðóïï ôàéëîâ */
|
/** Èçîáðàæåíèÿ è èêîíêè ãðóïï ôàéëîâ */
|
||||||
//private Image folderIcon, imageIcon, fileIcon, fontIcon, videoIcon;
|
//private Image folderIcon, imageIcon, fileIcon, fontIcon, videoIcon;
|
||||||
|
|
||||||
@ -77,6 +82,7 @@ public class FileManager extends Canvas {
|
|||||||
|
|
||||||
pathFile = s;
|
pathFile = s;
|
||||||
file = aFile;
|
file = aFile;
|
||||||
|
pw = new PreviewPlayer();
|
||||||
|
|
||||||
fontCashe = FWCashe.getCache(P.smBold);
|
fontCashe = FWCashe.getCache(P.smBold);
|
||||||
CursorY = startPrintFile = curFiles = numFiles = 0;
|
CursorY = startPrintFile = curFiles = numFiles = 0;
|
||||||
@ -86,10 +92,10 @@ public class FileManager extends Canvas {
|
|||||||
// Ñïèñîê ïóíêòîâ ìåíþ
|
// Ñïèñîê ïóíêòîâ ìåíþ
|
||||||
menu = new String[] {
|
menu = new String[] {
|
||||||
L.str[L.open],
|
L.str[L.open],
|
||||||
L.str[L.play],
|
L.str[L.playStop],
|
||||||
|
L.str[L.delete],
|
||||||
L.str[L.cancel]
|
L.str[L.cancel]
|
||||||
};
|
};
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +111,8 @@ public class FileManager extends Canvas {
|
|||||||
// ìåíþ ñîõðàíåíèÿ
|
// ìåíþ ñîõðàíåíèÿ
|
||||||
menu = new String[] {
|
menu = new String[] {
|
||||||
L.str[L.saveInThisFolder],
|
L.str[L.saveInThisFolder],
|
||||||
// L.str[L.newFolder],
|
L.str[L.newFolder],
|
||||||
|
L.str[L.delete],
|
||||||
L.str[L.cancel]
|
L.str[L.cancel]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -125,15 +132,18 @@ public class FileManager extends Canvas {
|
|||||||
if (menu[0].equals(L.str[L.saveInThisFolder])) {
|
if (menu[0].equals(L.str[L.saveInThisFolder])) {
|
||||||
// Ïóíêòû ïðè ñîõðàíåíèè
|
// Ïóíêòû ïðè ñîõðàíåíèè
|
||||||
vt.addElement(L.str[L.saveInThisFolder]);
|
vt.addElement(L.str[L.saveInThisFolder]);
|
||||||
//vt.addElement(L.str[L.newFolder]);
|
if(!P.isRMSMode) vt.addElement(L.str[L.newFolder]);
|
||||||
} else {
|
} else {
|
||||||
// Ïóíêòû ïðè îòêðûòèè
|
if (numFiles > 0) {
|
||||||
vt.addElement(L.str[L.open]);
|
// Ïóíêòû ïðè îòêðûòèè
|
||||||
if (getType(TypeMid, data[curFiles])) {
|
vt.addElement(L.str[L.open]);
|
||||||
vt.addElement(L.str[L.play]);
|
if (getType(TypeMid, data[curFiles])) {
|
||||||
//vt.addElement(L.str[L.openToBuffer]);
|
vt.addElement(L.str[L.playStop]);
|
||||||
|
//vt.addElement(L.str[L.openToBuffer]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if((numFiles > 0) && !data[curFiles].endsWith("/")) vt.addElement(L.str[L.delete]);
|
||||||
vt.addElement(L.str[L.cancel]);
|
vt.addElement(L.str[L.cancel]);
|
||||||
menu = new String[vt.size()];
|
menu = new String[vt.size()];
|
||||||
vt.copyInto(menu);
|
vt.copyInto(menu);
|
||||||
@ -254,17 +264,39 @@ public class FileManager extends Canvas {
|
|||||||
nextDir(fileSelected);
|
nextDir(fileSelected);
|
||||||
P.path = pathFile;
|
P.path = pathFile;
|
||||||
}
|
}
|
||||||
else if (cur.equals(L.str[L.play])) {
|
else if (cur.equals(L.str[L.playStop])) {
|
||||||
// Ïðîèãðûâàíèå
|
// Ïðîèãðûâàíèå
|
||||||
/*if (getType(TypeMid, fileSelected)) {
|
if (getType(TypeMid, fileSelected)) {
|
||||||
Image img = JSR75.getImage(pathFile, fileSelected);
|
if(pw.isPlaying()) {
|
||||||
PPM.midlet.imgname = fileSelected.substring(0, fileSelected.lastIndexOf('.'));
|
// Îñòàíîâêà ïðîèãðûâàíèÿ
|
||||||
PPM.dsp.setCurrent(new Viewer(img, this));
|
try {
|
||||||
} else if (getType(TypePpf, fileSelected)) {
|
pw.stop();
|
||||||
Image img = JSR75.getPPFImage(pathFile, fileSelected);
|
pw.close();
|
||||||
PPM.dsp.setCurrent(new Viewer(img, this));
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String openPath = fileSelected;
|
||||||
|
if(!P.isRMSMode) openPath = file.getPrefix() + pathFile + fileSelected;
|
||||||
|
try {
|
||||||
|
pw.play(openPath);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cur.equals(L.str[L.delete])) {
|
||||||
|
if(!fileSelected.endsWith("/")) {
|
||||||
|
String fileToDelete = fileSelected;
|
||||||
|
if(!P.isRMSMode) fileToDelete = pathFile + fileSelected;
|
||||||
|
try {
|
||||||
|
file.delete(fileToDelete);
|
||||||
|
update();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
P.path = pathFile;*/
|
|
||||||
}
|
}
|
||||||
else if (cur.equals( L.str[L.cancel])) {
|
else if (cur.equals( L.str[L.cancel])) {
|
||||||
// Îòìåíà
|
// Îòìåíà
|
||||||
@ -289,11 +321,11 @@ public class FileManager extends Canvas {
|
|||||||
|
|
||||||
Main.dsp.setCurrent(new SaveName_frm(this, pathFile));
|
Main.dsp.setCurrent(new SaveName_frm(this, pathFile));
|
||||||
}
|
}
|
||||||
/*else if (cur.equals(L.str[L.newFolder])) {
|
else if (cur.equals(L.str[L.newFolder])) {
|
||||||
// Íîâàÿ ïàïêà
|
// Íîâàÿ ïàïêà
|
||||||
NewFolderForm newFolder = new NewFolderForm(L.str[L.newFolder], this, pathFile);
|
NewFolderForm newFolder = new NewFolderForm(L.str[L.newFolder], this, pathFile);
|
||||||
PPM.dsp.setCurrent(newFolder);
|
Main.dsp.setCurrent(newFolder);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Çàãðóçêà èçîáðàæåíèé */
|
/** Çàãðóçêà èçîáðàæåíèé */
|
||||||
@ -365,7 +397,7 @@ public class FileManager extends Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(int i) {
|
public void keyPressed(int i) {
|
||||||
super.keyPressed(i);
|
|
||||||
int ga = getGameAction(i);
|
int ga = getGameAction(i);
|
||||||
if (showMenu) {
|
if (showMenu) {
|
||||||
// Îòêðûòî ìåíþ - ïåðåìåùàåìñÿ ïî íåìó
|
// Îòêðûòî ìåíþ - ïåðåìåùàåìñÿ ïî íåìó
|
||||||
|
@ -216,7 +216,7 @@ public class Menu extends Canvas {
|
|||||||
}
|
}
|
||||||
// Íàñòðîéêè
|
// Íàñòðîéêè
|
||||||
else if(v.equals(L.str[L.options])) {
|
else if(v.equals(L.str[L.options])) {
|
||||||
Main.dsp.setCurrent(new SettingsUI(this));
|
Main.dsp.setCurrent(new SettingsForm(this));
|
||||||
}
|
}
|
||||||
// Ïîìîùü
|
// Ïîìîùü
|
||||||
else if(v.equals(L.str[L.help])) {
|
else if(v.equals(L.str[L.help])) {
|
||||||
|
60
src/ui/NewFolderForm.java
Normal file
60
src/ui/NewFolderForm.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package ui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.microedition.io.Connector;
|
||||||
|
import javax.microedition.io.file.FileConnection;
|
||||||
|
import javax.microedition.lcdui.*;
|
||||||
|
import main.L;
|
||||||
|
import main.P;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ñîçäàíèå íîâîé ïàïêè
|
||||||
|
* @author aNNiMON
|
||||||
|
*/
|
||||||
|
public class NewFolderForm extends Form implements CommandListener {
|
||||||
|
|
||||||
|
private Command ok, back;
|
||||||
|
private FileManager fm;
|
||||||
|
private String basePath;
|
||||||
|
private TextField newFolderTF;
|
||||||
|
|
||||||
|
public NewFolderForm(String title, FileManager prev, String p) {
|
||||||
|
super(title);
|
||||||
|
basePath = p;
|
||||||
|
fm = prev;
|
||||||
|
newFolderTF = new TextField("", "NewFolder", 60, TextField.ANY);
|
||||||
|
ok = new Command(L.str[L.ok], Command.OK, 1);
|
||||||
|
back = new Command(L.str[L.back], Command.BACK, 3);
|
||||||
|
append(newFolderTF);
|
||||||
|
addCommand(back);
|
||||||
|
addCommand(ok);
|
||||||
|
setCommandListener(NewFolderForm.this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void commandAction(Command c, Displayable d) {
|
||||||
|
if (c == back) {
|
||||||
|
fm.setCurrent(false);
|
||||||
|
} else if ((c == ok || c == List.SELECT_COMMAND)) {
|
||||||
|
makeFile(basePath, newFolderTF.getString());
|
||||||
|
basePath = null;
|
||||||
|
newFolderTF = null;
|
||||||
|
fm.pathFile = P.path;
|
||||||
|
fm.setCurrent(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ñîçäàòü ôàéë èëè ïàïêó
|
||||||
|
* @param path ïóòü
|
||||||
|
* @param name èìÿ ñîçäàâàåìîãî ôàéëà èëè ïàïêè
|
||||||
|
*/
|
||||||
|
private void makeFile(String path, String name) {
|
||||||
|
try {
|
||||||
|
FileConnection fc = (FileConnection) Connector.open("file://" + path + name);
|
||||||
|
fc.mkdir();
|
||||||
|
P.path += name + "/";
|
||||||
|
fc.close();
|
||||||
|
} catch (IOException io) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,7 @@ import main.*;
|
|||||||
* Êëàññ íàñòðîåê
|
* Êëàññ íàñòðîåê
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class SettingsUI extends Form implements CommandListener {
|
public class SettingsForm extends Form implements CommandListener {
|
||||||
|
|
||||||
private static final String[] langAppList = {"English", "Ðóññêèé"};
|
private static final String[] langAppList = {"English", "Ðóññêèé"};
|
||||||
private static final String[] langInstrList = {"English", "Ðóññêèé"};
|
private static final String[] langInstrList = {"English", "Ðóññêèé"};
|
||||||
@ -21,7 +21,7 @@ public class SettingsUI extends Form implements CommandListener {
|
|||||||
private Gauge noteWidthGauge;
|
private Gauge noteWidthGauge;
|
||||||
private TextField tempDirField;
|
private TextField tempDirField;
|
||||||
|
|
||||||
public SettingsUI(Displayable prev) {
|
public SettingsForm(Displayable prev) {
|
||||||
super(L.str[L.options]);
|
super(L.str[L.options]);
|
||||||
previousScreen = prev;
|
previousScreen = prev;
|
||||||
initComponents();
|
initComponents();
|
||||||
@ -35,7 +35,7 @@ public class SettingsUI extends Form implements CommandListener {
|
|||||||
append(tempDirField);
|
append(tempDirField);
|
||||||
addCommand(ok);
|
addCommand(ok);
|
||||||
addCommand(back);
|
addCommand(back);
|
||||||
setCommandListener(SettingsUI.this);
|
setCommandListener(SettingsForm.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
@ -44,18 +44,18 @@ public class SettingsUI extends Form implements CommandListener {
|
|||||||
back = new Command(L.str[L.back], Command.BACK, 3);
|
back = new Command(L.str[L.back], Command.BACK, 3);
|
||||||
|
|
||||||
// ßçûê
|
// ßçûê
|
||||||
langChoice = new ChoiceGroup("Language", ChoiceGroup.EXCLUSIVE, langAppList, null);
|
langChoice = new ChoiceGroup(L.str[L.language], ChoiceGroup.EXCLUSIVE, langAppList, null);
|
||||||
langInstr = new ChoiceGroup("Instruments Language", ChoiceGroup.EXCLUSIVE, langInstrList, null);
|
langInstr = new ChoiceGroup(L.str[L.instrlang], ChoiceGroup.EXCLUSIVE, langInstrList, null);
|
||||||
|
|
||||||
// Íàñòðîéêè ðàçìåðà íîò
|
// Íàñòðîéêè ðàçìåðà íîò
|
||||||
noteHeightGauge = new Gauge("Note Height", true, 10, Rms.noteHeight);
|
noteWidthGauge = new Gauge(L.str[L.noteWidth], true, 10, Rms.noteWidth);
|
||||||
noteWidthGauge = new Gauge("Note Length", true, 10, Rms.noteWidth);
|
noteHeightGauge = new Gauge(L.str[L.noteHeight], true, 10, Rms.noteHeight);
|
||||||
|
|
||||||
// Óïðàâëåíèå
|
// Óïðàâëåíèå
|
||||||
controlChoice = new ChoiceGroup(L.str[L.navigation], ChoiceGroup.MULTIPLE);
|
controlChoice = new ChoiceGroup(L.str[L.navigation], ChoiceGroup.MULTIPLE);
|
||||||
|
|
||||||
// Âðåìåííàÿ ïàïêà
|
// Âðåìåííàÿ ïàïêà
|
||||||
tempDirField = new TextField("Temp Dir", Rms.tempDir, 64, 4);
|
tempDirField = new TextField(L.str[L.tempDir], Rms.tempDir, 64, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setComponentsParameters() {
|
private void setComponentsParameters() {
|
@ -123,6 +123,12 @@ public class TextView extends Canvas {
|
|||||||
protected void keyRepeated(int key) {
|
protected void keyRepeated(int key) {
|
||||||
keyPressed(key);
|
keyPressed(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void pointerPressed(int pix, int piy) {
|
||||||
|
int q = UI.getSoftBarHeight();
|
||||||
|
if(pix>w-2*q && piy>h-q) Main.dsp.setCurrent(dspl);
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Óñòàíîâêà íåîáõîäèìûõ ïàðàìåòðîâ äëÿ òåêñòà
|
* Óñòàíîâêà íåîáõîäèìûõ ïàðàìåòðîâ äëÿ òåêñòà
|
||||||
|
@ -56,34 +56,13 @@ public class UI {
|
|||||||
g.drawString(title, w / 2, softBarHeight, Graphics.HCENTER | Graphics.BOTTOM);
|
g.drawString(title, w / 2, softBarHeight, Graphics.HCENTER | Graphics.BOTTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Îòðèñîâêà èíòåðôåéñà îêíà
|
|
||||||
* @param g êîíòåêñò ãðàôèêè
|
|
||||||
* @param title íàäïèñü çàãîëîâêà
|
|
||||||
* @param rightsoft íàäïèñü íà ïðàâîì ñîôòå
|
|
||||||
*/
|
|
||||||
public static void drawMenuInterface(Graphics g, String title, String rightsoft) {
|
|
||||||
drawTitle(g, title);
|
|
||||||
drawSoftBar(g, "", rightsoft);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Îòðèñîâêà ñîñòîÿíèÿ ïî ìàññèâó (â ýôôåòêàõ)
|
|
||||||
* @param g êîíòåêñò ãðàôèêè
|
|
||||||
* @param dd ìàññèâ ñî çíà÷åíèÿìè
|
|
||||||
*/
|
|
||||||
public static void drawStatusBar(Graphics g, int[] dd) {
|
|
||||||
drawStatusBar(g, Math.abs(dd[0]) + dd[1], Math.abs(dd[2]) + Math.abs(dd[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Отрисовка состояния по массиву (в эффетках)
|
* Отрисовка состояния по массиву (в эффетках)
|
||||||
* @param g контекст графики
|
* @param g контекст графики
|
||||||
* @param cur текущее состояние
|
* @param cur текущее состояние
|
||||||
* @param all всего
|
* @param all всего
|
||||||
*/
|
*/
|
||||||
private static void drawStatusBar(Graphics g, int cur, int all) {
|
public static void drawStatusBar(Graphics g, int cur, int all) {
|
||||||
int w = g.getClipWidth();
|
int w = g.getClipWidth();
|
||||||
int h = g.getClipHeight();
|
int h = g.getClipHeight();
|
||||||
int sw = w / 20;
|
int sw = w / 20;
|
||||||
@ -141,53 +120,6 @@ public class UI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Îðòèñîâêà ïðîçðà÷íîãî ãðàäèåíòà
|
|
||||||
* @param g êîíòåêñò ãðàôèêè
|
|
||||||
* @param color1 âåðõíèé öâåò ãðàäèåíòà
|
|
||||||
* @param color2 íèæíèé öâåò ãðàäèåíòà
|
|
||||||
* @param x1 X
|
|
||||||
* @param y1 Y
|
|
||||||
* @param w øèðèíà
|
|
||||||
* @param h âûñîòà
|
|
||||||
*/
|
|
||||||
private static void drawRGB(Graphics g, int color1, int color2, int x1, int y1, int w, int h) {
|
|
||||||
int a1 = (color1 >> 24) & 0xff;
|
|
||||||
int a2 = (color2 >> 24) & 0xff;
|
|
||||||
if(a1>253 && a2>253) {
|
|
||||||
drawRect(g, color1, color2, x1, y1, w, h);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int r1 = (color1 >> 16) & 0xff;
|
|
||||||
int g1 = (color1 >> 8) & 0xff;
|
|
||||||
int b1 = color1 & 0xff;
|
|
||||||
|
|
||||||
int r2 = (color2 >> 16) & 0xff;
|
|
||||||
int g2 = (color2 >> 8) & 0xff;
|
|
||||||
int b2 = color2 & 0xff;
|
|
||||||
|
|
||||||
int count = h/3;
|
|
||||||
if (count<0) count=-count;
|
|
||||||
if (count<8) count = 8;
|
|
||||||
int crd1, crd2;
|
|
||||||
|
|
||||||
for (int i = count - 1; i >= 0; i--) {
|
|
||||||
crd1 = i * h / count + y1;
|
|
||||||
crd2 = (i + 1) * h / count + y1;
|
|
||||||
if (crd1 == crd2) continue;
|
|
||||||
int[] pixelArray = new int[w * (crd2 - crd1)];
|
|
||||||
int color = (i * (a2 - a1) / (count - 1) + a1) << 24 |
|
|
||||||
((i * (r2 - r1) / (count - 1) + r1) << 16) |
|
|
||||||
((i * (g2 - g1) / (count - 1) + g1) << 8) |
|
|
||||||
(i * (b2 - b1) / (count - 1) + b1);
|
|
||||||
for (int zi = 0; zi < pixelArray.length; zi++) {
|
|
||||||
pixelArray[zi] = color;
|
|
||||||
}
|
|
||||||
g.drawRGB(pixelArray, 0, w, x1, crd1, w, crd2 - crd1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Отрисовка вертикального градиента
|
* Отрисовка вертикального градиента
|
||||||
* @param graphics контекст графики
|
* @param graphics контекст графики
|
||||||
|
@ -27,18 +27,6 @@ public class BufDataInputStream extends InputStream implements DataInput {
|
|||||||
return blen - bpos + is_available;
|
return blen - bpos + is_available;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCapacity() {
|
|
||||||
return capacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void seek(int pos) {
|
|
||||||
bpos = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int tell() throws IOException {
|
|
||||||
return capacity - available();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
if (bpos > buffer.length) {
|
if (bpos > buffer.length) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -46,15 +34,6 @@ public class BufDataInputStream extends InputStream implements DataInput {
|
|||||||
return ((int) buffer[bpos++]) & 0xFF;
|
return ((int) buffer[bpos++]) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int readBack() throws IOException {
|
|
||||||
if (bpos == 0) {
|
|
||||||
if (available() == capacity) return -1;
|
|
||||||
int old = tell();
|
|
||||||
bpos = old;
|
|
||||||
}
|
|
||||||
return ((int) buffer[--bpos]) & 0xFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean readBoolean() throws IOException {
|
public boolean readBoolean() throws IOException {
|
||||||
int r = read();
|
int r = read();
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
@ -151,27 +130,6 @@ public class BufDataInputStream extends InputStream implements DataInput {
|
|||||||
throw new UTFDataFormatException();
|
throw new UTFDataFormatException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public char readCharBackUTF() throws IOException, UTFDataFormatException {
|
|
||||||
int b, c, d;
|
|
||||||
d = readBack();
|
|
||||||
c = readBack();
|
|
||||||
b = readBack();
|
|
||||||
if (d == -1) {
|
|
||||||
return (char) -1;
|
|
||||||
}
|
|
||||||
if ((d & 0x80) == 0) {
|
|
||||||
read();
|
|
||||||
read();
|
|
||||||
return (char) d;
|
|
||||||
} else if ((c & 0xE0) == 0xC0 && (d & 0xC0) == 0x80) {
|
|
||||||
read();
|
|
||||||
return (char) (((c & 0x1F) << 6) | (d & 0x3F));
|
|
||||||
} else if ((b & 0xF0) == 0xE0 && (c & 0xC0) == 0x80 && (d & 0xC0) == 0x80) {
|
|
||||||
return (char) (((b & 0x0F) << 12) | ((c & 0x3F) << 6) | (d & 0x3F));
|
|
||||||
}
|
|
||||||
throw new UTFDataFormatException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkBOM() {
|
public boolean checkBOM() {
|
||||||
try {
|
try {
|
||||||
if (available() < 3 ||
|
if (available() < 3 ||
|
||||||
@ -185,24 +143,4 @@ public class BufDataInputStream extends InputStream implements DataInput {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean find(byte[] b) {
|
|
||||||
if (b == null) return false;
|
|
||||||
int po = 0;
|
|
||||||
for (int i = bpos + 1; i < buffer.length; i++) {
|
|
||||||
po = 0;
|
|
||||||
if (buffer[i] == b[0]) {
|
|
||||||
for (int j = 0; j < b.length; j++) { //System.out.println("b "+b[j]);
|
|
||||||
if (buffer[i + j] == b[j]) {
|
|
||||||
po += 1;
|
|
||||||
} else break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (po == b.length) {
|
|
||||||
bpos = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (po > 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package util;
|
package util;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class StringEncoder {
|
public class StringEncoder {
|
||||||
|
|
||||||
protected static char cp1251[] = {
|
protected static char[] cp1251 = {
|
||||||
'\u0410', '\u0411', '\u0412', '\u0413', '\u0414', '\u0415', '\u0416',
|
'\u0410', '\u0411', '\u0412', '\u0413', '\u0414', '\u0415', '\u0416',
|
||||||
'\u0417', '\u0418', '\u0419', '\u041A', '\u041B', '\u041C', '\u041D',
|
'\u0417', '\u0418', '\u0419', '\u041A', '\u041B', '\u041C', '\u041D',
|
||||||
'\u041E', '\u041F', '\u0420', '\u0421', '\u0422', '\u0423', '\u0424',
|
'\u041E', '\u041F', '\u0420', '\u0421', '\u0422', '\u0423', '\u0424',
|
||||||
@ -30,24 +28,4 @@ public class StringEncoder {
|
|||||||
}
|
}
|
||||||
return (char) ich;
|
return (char) ich;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Êîäèðîâàòü ñèìâîë â windows-1251 */
|
|
||||||
public static byte encodeCharCP1251(char ch) {
|
|
||||||
if (ch > 0 && ch < 128) {
|
|
||||||
return (byte) ch;
|
|
||||||
} else if (ch == 0x401) {
|
|
||||||
return -88; // ¨
|
|
||||||
} else if (ch == 0x404) {
|
|
||||||
return -86; // ª
|
|
||||||
} else if (ch == 0x407) {
|
|
||||||
return -81; // ¯
|
|
||||||
} else if (ch == 0x451) {
|
|
||||||
return -72; // ¸
|
|
||||||
} else if (ch == 0x454) {
|
|
||||||
return -70; // º
|
|
||||||
} else if (ch == 0x457) {
|
|
||||||
return -65; // ¿
|
|
||||||
}
|
|
||||||
return (byte) ((byte) (ch) + 176);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user