Example #1
0
        /// <summary>
        ///   ZIMERead: return composition string in IME
        /// </summary>
        protected internal String eval_op_zimeread(int dummy)
        {
            String     strRet     = null;
            UtilImeJpn utilImeJpn = Manager.UtilImeJpn;

            if (utilImeJpn != null)
            {
                strRet = utilImeJpn.StrImeRead;
            }

            return(strRet);
        }
Example #2
0
        internal override void handleEvent(EventType type, Object sender, EventArgs e)
        {
            ControlsMap controlsMap = ControlsMap.getInstance();
            UtilImeJpn  utilImeJpn  = Manager.UtilImeJpn;

            TextBox textCtrl = (TextBox)sender;
            int     start;
            int     end;

            MapData mapData = controlsMap.getMapData(textCtrl);

            if (mapData == null)
            {
                return;
            }

            GuiMgControl guiMgCtrl = mapData.getControl();
            GuiMgForm    guiMgForm = mapData.getForm();

            var contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(guiMgCtrl));

            if (Events.ShouldLog(Logger.LogLevels.Gui))
            {
                Events.WriteGuiToLog("TextBoxHandler(\"" + mapData.getControl().getName(mapData.getIdx()) + "\"): " + type);
            }

            try
            {
                switch (type)
                {
                case EventType.GOT_FOCUS:
                    // check the paste enable. check the clip content.
                    if (mapData != null)
                    {
                        GuiUtils.checkPasteEnable(mapData.getControl(), true);
                        GuiUtils.SetFocusColor(textCtrl);
                    }
                    break;

                case EventType.LOST_FOCUS:
                    // Always disable paste when exiting a text ctrl. (since we might be focusing on a diff type of
                    // ctrl).
                    if (mapData != null)
                    {
                        GuiUtils.disablePaste(mapData.getControl());
                        GuiUtils.ResetFocusColor(textCtrl);
                    }
                    break;

                case EventType.KEY_UP:
                    GuiUtils.enableDisableEvents(sender, mapData.getControl());
                    return;

                case EventType.KEY_DOWN:
                    KeyEventArgs keyEventArgs = (KeyEventArgs)e;

                    if (ShouldBeHandledByTextBox(textCtrl, keyEventArgs))
                    {
                        GuiUtils.checkAutoWide(mapData.getControl(), textCtrl, GuiUtils.getValue(textCtrl));
                        keyEventArgs.Handled = false;
                        return;
                    }
                    break;

                case EventType.IME_EVENT:
                    // (Korean) IME messages (WM_IME_COMPOSITION, etc.) are handled as pseudo-input
                    // where action=MG_ACT_CHAR, text=" ".
                    // To distinguish with real " ", ImeParam im is attached to RuntimeEvent.
                    ImeEventArgs iea = (ImeEventArgs)e;
                    start = textCtrl.SelectionStart;
                    end   = textCtrl.SelectionStart + textCtrl.SelectionLength;
                    Events.OnKeyDown(guiMgForm, guiMgCtrl, Modifiers.MODIFIER_NONE, 0, start, end, " ", iea.im, true, "-1", false, iea.Handled);
                    iea.Handled = true;
                    break;

                case EventType.KEY_PRESS:
                    KeyPressEventArgs keyPressEventArgs = (KeyPressEventArgs)e;
                    // skipp control key
                    if (Char.IsControl(keyPressEventArgs.KeyChar))
                    {
                        return;
                    }

                    start = textCtrl.SelectionStart;
                    end   = textCtrl.SelectionStart + textCtrl.SelectionLength;
                    String pressedChar = "" + keyPressEventArgs.KeyChar;

                    // flag the isActChar to indicate this is MG_ACT_CHAR
                    Events.OnKeyDown(guiMgForm, guiMgCtrl, Modifiers.MODIFIER_NONE, 0, start, end, pressedChar, true, "-1", keyPressEventArgs.Handled);
                    keyPressEventArgs.Handled = true;
                    break;

                case EventType.MOUSE_UP:
                    GuiUtils.enableDisableEvents(sender, mapData.getControl());
                    break;

                case EventType.CUT:
                    Events.CutEvent(mapData.getControl());
                    return;

                case EventType.COPY:
                    Events.CopyEvent(mapData.getControl());
                    return;

                case EventType.PASTE:
                    Events.PasteEvent(mapData.getControl());
                    return;

                case EventType.CLEAR:
                    Events.ClearEvent(mapData.getControl());
                    return;

                case EventType.UNDO:
                    Events.UndoEvent(mapData.getControl());
                    return;



                case EventType.STATUS_TEXT_CHANGED:
                    // JPN: ZIMERead function
                    if (utilImeJpn != null && sender is MgTextBox && !utilImeJpn.IsEditingCompStr((Control)sender))
                    {
                        utilImeJpn.StrImeRead = ((MgTextBox)sender).GetCompositionString();
                    }
                    return;
                }
            }
            finally
            {
                contextIDGuard.Dispose();
            }

            DefaultHandler.getInstance().handleEvent(type, sender, e);
        }
Example #3
0
        /// <summary>
        ///   Make initialization of private elements by found tokens
        /// </summary>
        /// <param name = "tokensVector">found tokens, which consist attribute/value of every found element</param>
        private void fillData(List <String> tokensVector)
        {
            String             attribute;
            String             valueStr;
            Int32              hashKey;
            EnvironmentDetails env;
            UtilImeJpn         utilImeJpn = Manager.UtilImeJpn;

            env = new EnvironmentDetails();

            for (int j = 0; j < tokensVector.Count; j += 2)
            {
                attribute = (tokensVector[j]);
                valueStr  = (tokensVector[j + 1]);
                valueStr  = XmlParser.unescape(valueStr);

                switch (attribute)
                {
                case ConstInterface.MG_ATTR_THOUSANDS:
                    _thousandsSeparator = valueStr[0];
                    break;

                case ConstInterface.MG_ATTR_DECIMAL_SEPARATOR:
                    _decimalSeparator = valueStr[0];
                    break;

                case ConstInterface.MG_ATTR_DATE:
                    _dateSeparator = valueStr[0];
                    DisplayConvertor.Instance.setDateChar(_dateSeparator);
                    break;

                case ConstInterface.MG_ATTR_TIME:
                    _timeSeparator = valueStr[0];
                    break;

                case ConstInterface.MG_ATTR_OWNER:
                    _owner = valueStr;
                    break;

                case ConstInterface.MG_ATTR_SIGNIFICANT_NUM_SIZE:
                    _significantNumSize = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_DEBUG_MODE:
                    _debugMode = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_POINT_TRANSLATION:
                    _canReplaceDecimalSeparator = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_SPECIAL_EXITCTRL:
                    _specialExitCtrl = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_USE_WINDOWS_XP_THEAMS:
                    _useWindowsXpThemes = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_LOWHIGH:
                    _lowHigh = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_ACCESS_TEST:
                    _accessTest = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_SPECIAL_TEXT_SIZE_FACTORING:
                    _specialTextSizeFactoring = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_SPECIAL_FLAT_EDIT_ON_CLASSIC_THEME:
                    _specialFlatEditOnClassicTheme = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_ENCODING:
                    if (!valueStr.Equals(" "))
                    {
                        _codePage = XmlParser.getInt(valueStr);
                    }
                    break;

                case ConstInterface.MG_ATTR_SYSTEM:
                    _system = XmlParser.unescape(valueStr);
                    break;

                case ConstInterface.MG_ATTR_COMPONENT:
                    env.CompIdx = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_DATEMODE:
                    env.DateMode = valueStr[0];
                    break;

                case ConstInterface.MG_ATTR_CENTURY:
                    env.Century = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_IDLETIME:
                    env.IdleTime = XmlParser.getInt(valueStr);
                    //handle the default idle time value
                    if (env.IdleTime == 0)
                    {
                        env.IdleTime = 1;
                    }
                    break;

                case ConstInterface.MG_ATTR_UPD_IN_QUERY:
                    env.UpdateInQueryMode = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_CRE_IN_MODIFY:
                    env.CreateInModifyMode = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_DEFAULT_COLOR:
                    _defaultColor = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_DEFAULT_FOCUS_COLOR:
                    _defaultFocusColor = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_CONTEXT_INACTIVITY_TIMEOUT:
                    _contextInactivityTimeout = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_TOOLTIP_TIMEOUT:
                    _toolitipTimeout = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_CONTEXT_UNLOAD_TIMEOUT:
                    _contextUnloadTimeout = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_IME_AUTO_OFF:
                    _imeAutoOff = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_LOCAL_AS400SET:
                    _localAs400Set = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_LOCAL_EXTRA_GENGO:
                    _localExtraGengo = valueStr;
                    UtilDateJpn.getInstance().addExtraGengo(_localExtraGengo);
                    break;

                case ConstInterface.MG_ATTR_LOCAL_FLAGS:
                    _localFlags = valueStr;
                    break;

                case ConstInterface.MG_ATTR_SPEACIAL_ANSI_EXP:
                    _specialAnsiExpression = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_SPECIAL_SHOW_STATUSBAR_PANES:
                    _specialShowStatusBarPanes = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_SPECIAL_SPECIAL_EDIT_LEFT_ALIGN:
                    _specialEditLeftAlign = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_SPEACIAL_SWF_CONTROL_NAME:
                    _specialSwfControlName = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_LANGUAGE:
                    _language = valueStr[0];
                    break;

                case ConstInterface.MG_ATTR_USERID:
                    _userId = valueStr;
                    break;

                case ConstInterface.MG_TAG_USERNAME:
                    ClientManager.Instance.setUsername(valueStr);
                    break;

                case ConstInterface.MG_ATTR_TERMINAL:
                    _terminal = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_USERINFO:
                    _userInfo = valueStr;
                    break;

                case ConstInterface.MG_ATTR_GUID:
                    _guid = valueStr;
                    break;

                case ConstInterface.MG_ATTR_CONTROLS_PERSISTENCY_PATH:
                    _controlsPersistencyPath = valueStr;
                    break;

                case ConstInterface.MG_ATTR_PROJDIR:
                    env.ProjDir = valueStr;
                    break;

                case ConstInterface.MG_ATTR_CLOSE_TASKS_ON_PARENT_ACTIVATE:
                    _closeTasksOnParentActivate = XmlParser.getBoolean(valueStr);
                    break;

                case ConstInterface.MG_ATTR_DROP_USERFORMATS:
                    _dropUserFormats = valueStr;
                    break;

                default:
                    Logger.Instance.WriteExceptionToLog("in Environment.fillData(): unknown attribute: " + attribute);
                    break;
                }
            }
            hashKey = env.CompIdx;
            _environments[hashKey] = env;

            if (_accessTest)
            {
                Commands.addAsync(CommandType.SET_ENV_ACCESS_TEST, null, 0, _accessTest);
            }

            if (_toolitipTimeout > 0)
            {
                Commands.addAsync(CommandType.SET_ENV_TOOLTIP_TIMEOUT, (object)null, (object)_toolitipTimeout);
            }

            if (_specialTextSizeFactoring)
            {
                Commands.addAsync(CommandType.SET_ENV_SPECIAL_TEXT_SIZE_FACTORING, null, 0, _specialTextSizeFactoring);
            }

            if (_specialFlatEditOnClassicTheme)
            {
                Commands.addAsync(CommandType.SET_ENV_SPECIAL_FLAT_EDIT_ON_CLASSIC_THEME, null, 0, _specialFlatEditOnClassicTheme);
            }

            if (_language != ' ')
            {
                Commands.addAsync(CommandType.SET_ENV_LAMGUAGE, null, 0, (int)_language);
            }
        }
Example #4
0
        /* (non-Javadoc)
         * @see org.eclipse.swt.widgets.Handler#handleEvent(org.eclipse.swt.widgets.Event)
         */
        internal override void handleEvent(EventType type, Object sender, EventArgs e)
        {
            ControlsMap controlsMap  = ControlsMap.getInstance();
            RichTextBox richTextCtrl = (RichTextBox)sender;
            MapData     mapData      = controlsMap.getMapData(richTextCtrl);

            if (mapData == null)
            {
                return;
            }

            GuiMgControl ctrl      = mapData.getControl();
            GuiMgForm    guiMgForm = mapData.getForm();

            UtilImeJpn utilImeJpn = Manager.UtilImeJpn; // JPN: IME support

            var contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(ctrl));

            try
            {
                switch (type)
                {
                case EventType.GOT_FOCUS:
                    // check the paste enable. check the clip content.
                    if (mapData != null)
                    {
                        GuiUtils.checkPasteEnable(mapData.getControl(), true);
                    }

                    // For RichEdit Ctrl, Set AcceptButton(i.e. DefaultButton) to null in order to allow enter key on RichEdit control.
                    if (sender is MgRichTextBox)
                    {
                        Form form = GuiUtils.FindForm(richTextCtrl);
                        form.AcceptButton = null;

                        if (((MgRichTextBox)sender).ReadOnly)
                        {
                            GuiUtils.restoreFocus(form);
                        }
                    }
                    break;

                case EventType.LOST_FOCUS:
                    // Always disable paste when exiting a text ctrl. (since we might be focusing on a diff type of
                    // ctrl).
                    if (mapData != null)
                    {
                        GuiUtils.disablePaste(mapData.getControl());
                    }
                    break;

                case EventType.KEY_UP:
                    // Korean
                    if (sender is MgRichTextBox && ((MgRichTextBox)sender).KoreanInterimSel >= 0)
                    {
                        return;
                    }

                    if (utilImeJpn != null)
                    {
                        if (utilImeJpn.IsEditingCompStr(richTextCtrl)) // JPN: IME support
                        {
                            return;
                        }

                        if (richTextCtrl is MgRichTextBox)           // JPN: ZIMERead function
                        {
                            utilImeJpn.StrImeRead = ((MgRichTextBox)richTextCtrl).GetCompositionString();
                        }
                    }

                    GuiUtils.enableDisableEvents(sender, mapData.getControl());
                    return;

                case EventType.KEY_DOWN:
                    // Korean
                    if (sender is MgRichTextBox && ((MgRichTextBox)sender).KoreanInterimSel >= 0)
                    {
                        return;
                    }

                    if (utilImeJpn != null && utilImeJpn.IsEditingCompStr(richTextCtrl)) // JPN: IME support
                    {
                        return;
                    }

                    KeyEventArgs keyEventArgs = (KeyEventArgs)e;
                    // marking the text (next/prev char or beg/end text) we let the
                    // system to take care of it.
                    // why ? There is no way in windows to set the caret at the beginning of
                    // a selected text. it works only on multi mark for some reason.
                    // also posting a shift+key does not work well since we have no way of knowing
                    // if the shift is already pressed or not.
                    // *** ALL other keys will continue to handleEvent.
                    if ((keyEventArgs.Shift && (keyEventArgs.KeyCode == Keys.Left || keyEventArgs.KeyCode == Keys.Right || keyEventArgs.KeyCode == Keys.Up || keyEventArgs.KeyCode == Keys.Down || keyEventArgs.KeyCode == Keys.Home || keyEventArgs.KeyCode == Keys.End)) ||
                        (keyEventArgs.Control && (keyEventArgs.KeyCode == Keys.Left || keyEventArgs.KeyCode == Keys.Right)))
                    {
                        keyEventArgs.Handled = false;
                        return;
                    }
                    break;

                case EventType.KEY_PRESS:

                    KeyPressEventArgs keyPressEventArgs = (KeyPressEventArgs)e;

                    bool IgnoreKeyPress = ((TagData)richTextCtrl.Tag).IgnoreKeyPress;
                    // should we ignore the key pressed ?
                    if (IgnoreKeyPress)
                    {
                        ((TagData)richTextCtrl.Tag).IgnoreKeyPress = false;

                        return;
                    }

                    // skipp control key
                    if (Char.IsControl(keyPressEventArgs.KeyChar))
                    {
                        return;
                    }

                    int start = richTextCtrl.SelectionStart;
                    int end   = richTextCtrl.SelectionStart + richTextCtrl.SelectionLength;

                    String pressedChar = "" + keyPressEventArgs.KeyChar;

                    // flag the isActChar to indicate this is MG_ACT_CHAR
                    Events.OnKeyDown(guiMgForm, ctrl, Modifiers.MODIFIER_NONE, 0, start, end, pressedChar, true, "-1", keyPressEventArgs.Handled);

                    // keyPressEventArgs.Handled wii stay 'false' in order to let the system put the correct char.
                    // What will happen is 2 things : 1. processKeyDown will add 'MG_ACT_CHAR'. 2. The system will write the char.
                    // In the past, the 'ACT_CHAR' was using sendKeys in order to write the char, but it makes problems in multilanguage systems.
                    // So, in TextMaskEditor for rich , ACT_CHAR will do nothing, just pass there in order to rais the 'control modify'.
                    //keyPressEventArgs.Handled = true;
                    break;

                case EventType.MOUSE_UP:
                    GuiUtils.enableDisableEvents(sender, mapData.getControl());
                    break;
                }
            }
            finally
            {
                contextIDGuard.Dispose();
            }

            DefaultHandler.getInstance().handleEvent(type, sender, e);
        }