예제 #1
0
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
void MkStartRecording (int N)
{
  QString macro = MacroName( MkRecording = N );
  luaP_getglobal("Mk");
  luaP_pushstring (macro.cStr());
  luaP_pushinteger    (TK_EM0+N);
  luaQQ_rawset(-3); luaQn_pop(1);
}
예제 #2
0
void MkStopRecording (void) //- - - - - - - - - - - - - - - - - - - - - - - - -
{                                         // make sure there is no self-refs in
  QString macro = MacroName(MkRecording); // string to avoid infinite recursion
  MkMacro.replace(MkQuoteCmd(macro), ""); // (one such reference is always
  luaP_getglobal("Mk");                   //     recorded just before stopping)
  luaP_pushstring(  macro.cStr());
  luaP_pushstring(MkMacro.uStr()); MkMacro.clear();
  luaQQ_rawset(-3);  luaQn_pop(1); MkRecording = 0;
}
예제 #3
0
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void jdlvFrame::LoadTheWorld (QString filename)
{
  if (isChanged) reLoad->setEnabled(false); isChanged = false;
  if (eM & elModePlay) DoPlayStop(); worldFilename = filename;
  genNo = 0;  playGen->setText("0");
  primeWorld->clearTheWorld();
  primeWorld->pasteFile(filename.cStr()); vista->lookAtThis(primeWorld);
  SetWinTitle();                          vista->resize_to_fit();
}
예제 #4
0
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void elMundo::setRules (QString ruleString)
{
    QString::const_iterator it;
    int B_bitmask = 0, S_bitmask = 0;
    QString digits;
    if (reBrule.indexIn(ruleString) >= 0) {
        digits = reBrule.cap(1);
        for (it = digits.constBegin(); it != digits.constEnd(); it++)
            B_bitmask |= (1 << it->digitValue());
    }
    if (reSrule.indexIn(ruleString) >= 0) {
        digits = reSrule.cap(1);
        for (it = digits.constBegin(); it != digits.constEnd(); it++)
            S_bitmask |= (1 << it->digitValue());
    }
    fprintf(stderr,"Rules(%s=+%x:%x)\n", ruleString.cStr(), B_bitmask,S_bitmask);
    setRules(B_bitmask, S_bitmask);
}
예제 #5
0
//-----------------------------------------------------------------------------
int MkConvertKeyMods (QKeyEvent *event, int &modMask)
{
  bool  keypad = (event->modifiers() &  Qt::KeypadModifier);
  int      key =  event->key();
  QString text =  event->text();
//
// Revert the Qt intelligence: Ctrl should be Ctrl on any platform, I'm too old
// to re-learn the keysequences twice a day switching from Mac to Linux to Win:
//
  modMask = (event->modifiers() & (Qt::AltModifier|Qt::ShiftModifier)) |
#ifdef Q_OS_MAC
            ((event->modifiers() & Qt::MetaModifier)    ? mod_CTRL : 0)|
            ((event->modifiers() & Qt::ControlModifier) ? mod_META : 0);
#else
            ((event->modifiers() & Qt::ControlModifier) ? mod_CTRL : 0)|
            ((event->modifiers() & Qt::MetaModifier)    ? mod_META : 0);
#endif
  if (MiApp_debugKB) { fprintf(stderr, "OnKey(%x", key);
    if (!text.isEmpty()) {
      if (text.at(0).isPrint()) fprintf(stderr, ":%s", text.cStr());
      else for (int i = 0; i < text.size(); i++)
                              fprintf(stderr, ".%02x", text[i].unicode());
    }
    fprintf(stderr, "|%c%c%c%c%c),native=%x:%x:%x",      keypad ? '#' : '.',
        (modMask & mod_META) ? 'M' : '.', (modMask & mod_CTRL)  ? 'c' : '.',
        (modMask & mod_ALT)  ? 'a' : '.', (modMask & mod_SHIFT) ? 's' : '.',
                          event->nativeScanCode(), event->nativeModifiers(),
                                                   event->nativeVirtualKey());
    if (Mk_IsSHIFT(key)) fprintf(stderr, "\n");
  } if (Mk_IsSHIFT(key)) return -1;
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#if defined(Q_OS_MAC) && (QT_VERSION < 0x040500)
    if (key == Qt::Key_unknown)            //    old Qt version (4.3.3) did not
      switch (event->nativeVirtualKey()) { // convert keys F13…F15 correctly on
      case 0x69: key = Qt::Key_F13; break; // Apple new solid aluminum keyboard
      case 0x6b: key = Qt::Key_F14; break; // (model A1243), fixing that, using
      case 0x71: key = Qt::Key_F15; break; // native virtual key (which is Ok)
      }
#endif
  if (keypad) {    // For whatever reasons, Qt always reports arrow keys with
#ifdef Q_OS_MAC    // KeypadMod on Mac, remove it for consistency..
    switch (key) { //
    case Qt::Key_Up:   case Qt::Key_Left:
    case Qt::Key_Down: case Qt::Key_Right: return key;
    }
#else
# ifdef Q_OS_WIN                          // completely ignore Alt+Numpad keys,
    if (modMask  ==  mod_ALT) return  -1; // let Windows handle them by itself
    if (key == Qt::Key_Enter) return key;
# endif
    switch (key) {
    case Qt::Key_Delete:   key = '.'; break; // for consistency, ALWAYS convert
    case Qt::Key_Insert:   key = '0'; break; // base key to digit, so Linux and
    case Qt::Key_End:      key = '1'; break; // Windows behaves the same as Mac
    case Qt::Key_Down:     key = '2'; break; //
    case Qt::Key_PageDown: key = '3'; break; // (for those attached to standard
    case Qt::Key_Left:     key = '4'; break; // OS-specific behavior, feel free
    case Qt::Key_Clear:    key = '5'; break; // to remap command by Lua script)
    case Qt::Key_Right:    key = '6'; break; //
    case Qt::Key_Home:     key = '7'; break;
    case Qt::Key_Up:       key = '8'; break;
    case Qt::Key_PageUp:   key = '9'; break;
    }
#endif
    return key | mod_KyPAD;
  } return key;
}
예제 #6
0
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void elSalvador::flush (QString line)
{
    fprintf(stderr, "%s\n", line.cStr());
}