12,11 → 12,12 |
|
import java.io.*; |
|
public class DUBwiseSettings |
public class DUBwiseSettings |
extends org.ligi.ufo.ParamsClass |
implements org.ligi.ufo.DUBwiseDefinitions,DUBwiseUIDefinitions |
{ |
// name/handle for the recordStore to memorize some stuff |
private final static String RECORD_STORE_NAME="DUBSETT_V3"; |
private final static String RECORD_STORE_NAME="DUBSETT_V4"; |
|
/* all settings hold here */ |
//holds id of actual skin |
36,8 → 37,88 |
public byte speed_format=SPEED_FORMAT_KMH; |
|
|
public byte[] default_extern_control=default_extern_keycontrol ; |
int[] settings_field; |
|
public int get_field_from_act(int pos) { return settings_field[pos];} |
public void set_field_from_act(int pos,int val){ |
|
settings_field[pos]=val; |
field2setting(pos,val); |
} |
|
public void toggle_fullscreen() |
{ |
// fullscreen=!fullscreen; |
set_field_from_act(1,settings_field[1]^1); |
// if (fullscreen)canvas.setFullScreenMode(true); |
} |
public void field2setting(int pos,int val) |
{ |
|
if (pos==0) |
{ |
act_skin=(byte)val; |
canvas.load_images(); |
} |
|
if ((pos==1)&&((val&1)==1)&&(!fullscreen)) |
{ |
fullscreen=true; |
canvas.setFullScreenMode(fullscreen); |
} |
|
if ((pos==1)&&((val&1)==0)&&(fullscreen)) |
{ |
fullscreen=false; |
canvas.setFullScreenMode(fullscreen); |
} |
|
if ((pos==1)&&((val&2)==2)&&(!do_scrollbg)) |
{ |
do_scrollbg=true; |
canvas.load_images(); |
} |
|
if ((pos==1)&&((val&2)==0)&&(do_scrollbg)) |
{ |
do_scrollbg=false; |
canvas.load_images(); |
} |
|
if (pos==1) |
do_sound=((val&4)!=0); |
|
if (pos==1) |
do_vibra=((val&8)!=0); |
|
if (pos==1) |
expert_mode=((val&16)!=0); |
|
if (pos==2) |
gps_format=(byte)val; |
|
if (pos==3) |
speed_format=(byte)val; |
|
if (pos==4) |
default_extern_control[EXTERN_CONTROL_NICK]=(byte)val; |
|
if (pos==5) |
default_extern_control[EXTERN_CONTROL_ROLL]=(byte)val; |
|
if (pos==6) |
default_extern_control[EXTERN_CONTROL_GIER]=(byte)val; |
|
if (pos==7) |
default_extern_control[EXTERN_CONTROL_GAS]=(byte)val; |
|
if (pos==8) |
default_extern_control[EXTERN_CONTROL_HIGHT]=(byte)val; |
} |
|
|
public byte[] default_extern_control;//=default_extern_keycontrol ; |
|
//#if devicecontrol=="on" |
public boolean keep_lighton=false; |
//#endif |
47,8 → 128,39 |
|
/* end of all settings hold here */ |
|
public DUBwiseSettings() |
public String[] _tab_names={"User Interface","GPS","Keycontrol","Special Keys","Other" }; |
|
public String[][] _field_names={ { "Skin","Fullscreen","Scroll Background" } , {"GPS Format","Speed Format"},{"Nick","Roll","Gier","Gas Increase","Height Increase"},{"Back","Fullscreen","Clear"},{"Sound","Vibra","Expert-Mode"} }; |
|
public String[][] _choice_strings={ { "Dark","Light" } , {"mp/h","km/h","cm/s"},{"decimal","min sec"}} ; |
public int[][] _field_positions={ {0,8,9} , {2,3} , {4,5,6,7,8} , {13,14,15}, {10,11,12}}; |
public int[][] _field_types={ {PARAMTYPE_CHOICE+0,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH} , {PARAMTYPE_CHOICE+1,PARAMTYPE_CHOICE+2} , {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, {PARAMTYPE_KEY,PARAMTYPE_KEY,PARAMTYPE_KEY} , {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH}}; |
DUBwiseCanvas canvas; |
|
|
public final static int SETTINGS_FIELD_LENGTH=42; |
public DUBwiseSettings(DUBwiseCanvas _canvas) |
{ |
canvas= _canvas; |
settings_field=new int[SETTINGS_FIELD_LENGTH]; |
default_extern_control=new byte[11]; |
// set defaults |
settings_field[4]=42; // nick |
settings_field[5]=42; // roll |
settings_field[6]=42; // gier |
settings_field[7]=1; // fas |
settings_field[8]=1; // hight |
|
} |
|
public void load() |
{ |
|
tab_names=_tab_names; |
field_names=_field_names; |
field_positions=_field_positions; |
field_types=_field_types; |
choice_strings=_choice_strings; |
try |
{ |
RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME , true ); |
61,35 → 173,18 |
|
connection_url=din.readUTF(); |
connection_name=din.readUTF(); |
act_skin=din.readByte(); |
// reserve utf's |
din.readUTF(); |
din.readUTF(); |
din.readUTF(); |
|
do_sound=din.readBoolean(); |
do_vibra=din.readBoolean(); |
do_scrollbg=din.readBoolean(); |
fullscreen=din.readBoolean(); |
//#if devicecontrol=="on" |
keep_lighton=din.readBoolean(); |
//#else |
din.readBoolean(); |
//#endif |
|
|
gps_format=din.readByte(); |
speed_format=din.readByte(); |
for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
settings_field[i]=din.readInt(); |
|
expert_mode=din.readBoolean(); |
// reserve |
for ( int i=0;i<5;i++) |
|
din.readBoolean(); |
din.readBoolean(); |
din.readByte(); |
din.readByte(); |
din.readByte(); |
din.readUTF(); |
din.readUTF(); |
din.readUTF(); |
|
for ( int i=0;i<5;i++) |
{ |
act_proxy_ip[i]=din.readInt(); |
act_conn_ip[i]=din.readInt(); |
101,8 → 196,11 |
catch (Exception e) |
{ } |
|
|
for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
field2setting(i,settings_field[i]); |
|
} |
|
|
|
public void save() |
122,32 → 220,14 |
|
dout.writeUTF(connection_url); |
dout.writeUTF(connection_name); |
dout.writeByte(act_skin); |
dout.writeBoolean(do_sound); |
dout.writeBoolean(do_vibra); |
dout.writeBoolean(do_scrollbg); |
dout.writeBoolean(fullscreen); |
//#if devicecontrol=="on" |
dout.writeBoolean(keep_lighton); |
//#else |
dout.writeBoolean(false); |
//#endif |
|
dout.writeByte(gps_format); |
dout.writeByte(speed_format); |
|
dout.writeBoolean( expert_mode); |
dout.writeBoolean(false); |
dout.writeBoolean(false); |
dout.writeByte(0); |
dout.writeByte(0); |
dout.writeByte(0); |
dout.writeUTF(""); |
dout.writeUTF(""); |
dout.writeUTF(""); |
|
|
|
for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
dout.writeInt(settings_field[i]); |
for ( int i=0;i<5;i++) |
{ |
dout.writeInt(act_proxy_ip[i]); |