Example #1
0
 public static void CreateStringBind(String in) {
   StringRef line = new StringRef(in.trim());
   String eventname = StringHelper.StripWord(line);
   CEvent event = null;
   for (CEvent it : events) {
     if (it.GetName().equals(eventname)) {
       event = it;
       break;
     }
   }
   if (event == null) {
     Log.log_msg("Can't find matching event for " + eventname);
     return;
   }
   CBind bind;
   while (true) {
     if (line.value.length() == 0) break;
     StringRef bindline = new StringRef(StringHelper.StripWord(line));
     for (CBindGroup it : bindgroups) {
       bind = it.CreateConfigBind(bindline);
       if (bind != null) {
         event.AddBind(bind);
         bind.SetFlags(bindline.value);
         break;
       }
     }
   }
 }
Example #2
0
 private static void MAPPER_SaveBinds() {
   String fileName = JavaMapper.mapperfile;
   try {
     RandomAccessFile saveFile = new RandomAccessFile(fileName, "rw");
     for (CEvent event : events) {
       saveFile.write(event.GetName().getBytes());
       for (CBind bind : event.bindlist) {
         String buf = " \"" + bind.ConfigName() + bind.AddFlags() + "\"";
         saveFile.write(buf.getBytes());
       }
       saveFile.writeByte((byte) '\n');
     }
     saveFile.close();
     // change_action_text("Mapper file saved.",CLR_WHITE);
   } catch (Exception e) {
     Log.log_msg("Can't open " + fileName + " for saving the mappings");
   }
 }
Example #3
0
 void ActivateBindList(CBindList list, Object key, int value, boolean ev_trigger) {
   int validmod = 0;
   for (CBind it : list) {
     if ((it.mods & mapper.mods) == it.mods) {
       if (validmod < it.mods) validmod = it.mods;
     }
   }
   for (CBind it : list) {
     /*BUG:CRASH if keymapper key is removed*/
     if (validmod == it.mods && (!it.isLeft() && !it.isRight() && !it.isNumpad())
         || (it.isLeft() && KeyboardKey.isLeft(key))
         || (it.isRight() && KeyboardKey.isRight(key))
         || (it.isNumpad() && KeyboardKey.isNumPad(key))) it.ActivateBind(value, ev_trigger);
   }
 }
Example #4
0
 private static void SetActiveBind(CBind _bind) {
   mapper.abind = _bind;
   if (_bind != null) {
     bind_but.bind_title.Enable(true);
     bind_but.bind_title.Change("BIND:" + _bind.BindName(), null);
     bind_but.del.Enable(true);
     bind_but.next.Enable(true);
     bind_but.mod1.Enable(true);
     bind_but.mod2.Enable(true);
     bind_but.mod3.Enable(true);
     bind_but.hold.Enable(true);
   } else {
     bind_but.bind_title.Enable(false);
     bind_but.del.Enable(false);
     bind_but.next.Enable(false);
     bind_but.mod1.Enable(false);
     bind_but.mod2.Enable(false);
     bind_but.mod3.Enable(false);
     bind_but.hold.Enable(false);
   }
 }
Example #5
0
 void DeactivateBindList(CBindList list, boolean ev_trigger) {
   for (CBind it : list) {
     it.DeActivateBind(ev_trigger);
   }
 }
Example #6
0
 public void DeActivateAll() {
   for (CBind bit : bindlist) {
     bit.DeActivateBind(true);
   }
 }
Example #7
0
 public void AddBind(CBind bind) {
   bindlist.add(bind);
   bind.event = this;
 }