--- ./src/locale/SR.java.orig 2006-10-01 12:07:06.000000000 +0300 +++ ./src/locale/SR.java 2006-10-01 12:07:14.000000000 +0300 @@ -230,6 +230,10 @@ public class SR { public static String MS_DISCO_ROOM=loadString("Participants"); public static String MS_CAPS_STATE=loadString("Abc"); + public static String MS_TEXTWRAP=loadString("Text wrap"); + public static String MS_TEXTWRAP_CHARACTER=loadString("Character"); + public static String MS_TEXTWRAP_WORD=loadString("Word"); + public static String MS_STORE_PRESENCE = loadString( "room presences" ); public static String MS_IS_NOW_KNOWN_AS=loadString(" is now known as "); --- ./src/Messages/MessageParser.java.orig 2006-10-01 12:07:06.000000000 +0300 +++ ./src/Messages/MessageParser.java 2006-10-01 12:07:28.000000000 +0300 @@ -16,6 +16,7 @@ import javax.microedition.lcdui.Font; import ui.*; import Client.Msg; +import Client.Config; /** * * @author Eugene Stahov @@ -39,6 +40,7 @@ public final class MessageParser impleme private Vector tasks=new Vector(); private Thread thread; + Config cf; public static MessageParser getInstance() { if (instance==null) instance=new MessageParser("/images/smiles.txt"); @@ -91,6 +93,7 @@ public final class MessageParser impleme } private MessageParser(String resource) { + cf=Config.getInstance(); smileTable=new Vector(); root=new Leaf(); // opening file; @@ -198,6 +201,8 @@ public final class MessageParser impleme while (state<2) { int w=0; StringBuffer s=new StringBuffer(); + StringBuffer oneWord=new StringBuffer(); + int wordWidth=0; ComplexString l=new ComplexString(il); lines.addElement(l); @@ -218,6 +223,7 @@ public final class MessageParser impleme } int pos=0; + while (poswidth || c==0x0d || c==0x0a || c==0xa0) { + if (wordWidth+cw>width || c==0x0d || c==0x0a || c==0xa0) { + // Add current oneWord buffer to s because: + // word is too long to fit in line or character is newline + s.append(oneWord); + w+=wordWidth; + wordWidth=0; + oneWord.setLength(0); + } + if (w+wordWidth+cw>width || c==0x0d || c==0x0a || c==0xa0) { if (underline) l.addUnderline(); l.addElement(s.toString()); // последняя подстрока в l s.setLength(0); w=0; @@ -316,10 +330,24 @@ public final class MessageParser impleme l.setFont(f); } } - if (c>0x1f) { s.append(c); w+=cw; } else if (c==0x09) { s.append((char)0x20); w+=cw; } + if (c==0x09) + c=0x20; + + if (c>0x1f) { + oneWord.append(c); + wordWidth+=cw; + } + if (c==0x20 || cf.textWrap==0) { + s.append(oneWord); + w+=wordWidth; + oneWord.setLength(0); + wordWidth=0; + } } pos++; } + if (oneWord.length()>0) + s.append(oneWord); if (s.length()>0) { if (underline) { l.addUnderline(); --- ./src/Client/Config.java.orig 2006-10-01 12:07:06.000000000 +0300 +++ ./src/Client/Config.java 2006-10-01 12:07:14.000000000 +0300 @@ -108,6 +108,7 @@ public class Config { public int lang=0; //en public boolean capsState=true; + public int textWrap=0; // runtime values public boolean allowMinimize=false; @@ -229,6 +230,8 @@ public class Config { capsState=inputStream.readBoolean(); + textWrap=inputStream.readInt(); + inputStream.close(); } catch (Exception e) { e.printStackTrace(); @@ -295,6 +298,8 @@ public class Config { outputStream.writeBoolean(capsState); + outputStream.writeInt(textWrap); + } catch (IOException e) { e.printStackTrace(); } NvStorage.writeFileRecord(outputStream, "config", 0, true); --- ./src/Client/ConfigForm.java.orig 2006-10-01 12:07:06.000000000 +0300 +++ ./src/Client/ConfigForm.java 2006-10-01 12:07:14.000000000 +0300 @@ -67,6 +67,8 @@ public class ConfigForm implements ChoiceGroup font1; ChoiceGroup font2; + ChoiceGroup textWrap; + NumberField keepAlive; NumberField fieldLoc; NumberField fieldGmt; @@ -184,6 +186,11 @@ public class ConfigForm implements f.append(message); f.append(font2); + String textWraps[]={SR.MS_TEXTWRAP_CHARACTER, SR.MS_TEXTWRAP_WORD}; + textWrap=new ChoiceGroup(SR.MS_TEXTWRAP, ConstMIDP.CHOICE_POPUP, textWraps,null); + textWrap.setSelectedIndex(cf.textWrap, true); + f.append(textWrap); + f.append(sndFile); lang=new ChoiceGroup("Language", ConstMIDP.CHOICE_POPUP); @@ -278,6 +285,8 @@ public class ConfigForm implements FontCache.msgFontSize=cf.font2=font2.getSelectedIndex()*8; FontCache.resetCache(); + cf.textWrap=textWrap.getSelectedIndex(); + //cf.soundVol=sndVol.getValue()*10; cf.lang=lang.getSelectedIndex();