Example #1
0
 /// <summary>
 /// Update Print Preview
 /// </summary>
 /// <param name="prnPrevData">print preview data</param>
 internal void Update(IntPtr prnPrevData)
 {
     _commandType              = CommandType.PRINTPREVIEW_UPDATE;
     _printPreviewData         = new PrintPreviewData();
     _printPreviewData.intPtr1 = prnPrevData;
     GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
 }
Example #2
0
 /// <summary>
 ///  Shows Print Preview Form
 /// </summary>
 /// <param name="hWnd"> Handle of Print Preview form</param>
 internal void Show(IntPtr hWnd)
 {
     _commandType              = CommandType.PRINTPREVIEW_SHOW;
     _printPreviewData         = new PrintPreviewData();
     _printPreviewData.intPtr1 = hWnd;
     GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
 }
Example #3
0
 /// <summary>
 /// Destroys a window
 /// </summary>
 /// <param name="hWndPtr">handle of window</param>
 internal void DestroyGuiWindow(IntPtr hWndPtr)
 {
     _commandType              = CommandType.DESTROY_WINDOW;
     _printPreviewData         = new PrintPreviewData();
     _printPreviewData.intPtr1 = hWndPtr;
     GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
 }
Example #4
0
 /// <summary>
 /// Returns active form
 /// </summary>
 /// <returns></returns>
 internal IntPtr GetActiveForm()
 {
     _commandType      = CommandType.PRINTPREVIEW_GETACTIVEFORM;
     _printPreviewData = new PrintPreviewData();
     GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
     return(_printPreviewData.intPtr1);
 }
Example #5
0
            /// <summary>
            ///   sets the command and values to show document from the specified url, inside a browser control
            ///   on a separate form
            /// </summary>
            /// <param name = "url">document path</param>
            /// <param name = "openAsApplicationModal">open form modally</param>
            internal void ShowContentFromURL(string url, bool openAsApplicationModal)
            {
                _commandType            = COMMAND.SHOW_CONTENT_FROM_URL;
                _url                    = url;
                _openAsApplicationModal = openAsApplicationModal;

                GUIMain.getInstance().invoke(new BrowserInteractiveDelegate(Run));
            }
Example #6
0
        /// <summary>
        /// Set cursor for Print Preview Form
        /// </summary>
        /// <param name="printPreviewDataPtr"></param>
        internal void SetCursor(IntPtr printPreviewDataPtr)
        {
            _commandType              = CommandType.PRINTPREVIEW_SET_CURSOR;
            _printPreviewData         = new PrintPreviewData();
            _printPreviewData.intPtr1 = printPreviewDataPtr;

            GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
        }
Example #7
0
 /// <summary>
 /// Show Print Dialog
 /// </summary>
 /// <param name="prnPrevData">print dialog info</param>
 internal int showPrintDialog(IntPtr gpd)
 {
     _commandType              = CommandType.SHOW_PRINT_DIALOG;
     _printPreviewData         = new PrintPreviewData();
     _printPreviewData.intPtr1 = gpd;
     GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
     return(_printPreviewData.number1);
 }
Example #8
0
 /// <summary>
 /// Closes Print Preview form
 /// </summary>
 /// <param name="hWnd"> Print Preview data</param>
 /// <param name="hWnd"> Handle of Print Preview form</param>
 internal void Close(IntPtr printPreviewData, IntPtr hWnd)
 {
     _commandType              = CommandType.PRINTPREVIEW_CLOSE;
     _printPreviewData         = new PrintPreviewData();
     _printPreviewData.intPtr1 = hWnd;
     _printPreviewData.intPtr2 = printPreviewData;
     GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
 }
Example #9
0
 /// <summary>
 /// Create Rich Edit
 /// </summary>
 /// <param name="contextId"></param>
 /// <param name="ctrlPtr"></param>
 /// <param name="prmPtr"></param>
 /// <param name="style"></param>
 /// <param name="dwExStyle"></param>
 internal void createRichWindow(Int64 contextID, IntPtr ctrlPtr, IntPtr prmPtr, uint style, uint dwExStyle)
 {
     _commandType               = CommandType.CREATE_RICH_WINDOW;
     _printPreviewData          = new PrintPreviewData();
     _printPreviewData.Int64Val = contextID;
     _printPreviewData.intPtr1  = ctrlPtr;
     _printPreviewData.intPtr2  = prmPtr;
     _printPreviewData.style    = (int)style;
     _printPreviewData.number1  = (int)dwExStyle;
     GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
 }
Example #10
0
        /// <summary>
        /// Creates Print Preview Form
        /// </summary>
        /// <param name="contextId">context id</param>
        /// <param name="ioPtr">pointer to current IORT object</param>
        /// <param name="copies">number of copies</param>
        /// <param name="enablePDlg">indicates whether to enable Print dialog</param>
        /// <param name="callerWindow">caller window of Print Preview</param>
        internal void Start(Int64 contextID, IntPtr ioPtr, int copies, bool enablePDlg, Form callerWindow)
        {
            _commandType                   = CommandType.PRINTPREVIEW_START;
            _printPreviewData              = new PrintPreviewData();
            _printPreviewData.Int64Val     = contextID;
            _printPreviewData.intPtr1      = ioPtr;
            _printPreviewData.boolVal      = enablePDlg;
            _printPreviewData.number1      = copies;
            _printPreviewData.callerWindow = callerWindow;

            GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
        }
Example #11
0
 /// <summary>
 ///   returns the single instance of this class
 /// </summary>
 public static GUIMain getInstance()
 {
     if (_instance == null)
     {
         lock (typeof(GUIMain))
         {
             if (_instance == null)
             {
                 _instance = new GUIMain();
             }
         }
     }
     return(_instance);
 }
Example #12
0
        ///<summary>
        ///  Creates a window using win32 API from GUI Thread.
        ///</summary>
        ///<param name="exStyle">!!.</param>
        ///<param name="className">!!.</param>
        ///<param name="windowName">!!.</param>
        ///<param name="style">!!.</param>
        ///<param name="x">!!.</param>
        ///<param name="y">!!.</param>
        ///<param name="width">!!.</param>
        ///<param name="height">!!.</param>
        ///<param name="hwndParent">!!.</param>
        ///<param name="hMenu">!!.</param>
        ///<param name="hInstance">!!.</param>
        ///<param name="lParam">!!.</param>
        ///<returns>handle of window</returns>
        internal IntPtr CreateGuiWindow(uint exStyle, String className, String windowName, uint style, int x, int y, int width, int height,
                                        IntPtr hwndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lParam)
        {
            _commandType      = CommandType.CREATE_WINDOW;
            _printPreviewData = new PrintPreviewData();
            _printPreviewData.extendedStyle = (int)exStyle;
            _printPreviewData.style         = (int)style;
            _printPreviewData.className     = className;
            _printPreviewData.windowName    = windowName;
            _printPreviewData.number1       = x;
            _printPreviewData.number1       = y;
            _printPreviewData.number1       = width;
            _printPreviewData.number1       = height;
            _printPreviewData.intPtr1       = hwndParent;
            _printPreviewData.intPtr2       = hMenu;
            _printPreviewData.intPtr3       = hInstance;
            _printPreviewData.intPtr4       = lParam;

            GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
            return(_printPreviewData.intPtr1);
        }
Example #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal override void handleEvent(EventType type, Object sender, EventArgs e)
        {
            Control   clientPanel;
            MapData   mapData;
            GuiMgForm guiMgForm;

            // When modal window is opened and if we close the form Modal form using external event (i.e. Stop RTE from studio / Exit System event)
            // We are getting closed event 2 times for a modal window :
            //          1) First time from GuiCommandsQueue.closeForm() due to form.close() and
            //          2) We are not able to figure out from where we are getting the second closed event.
            // When we come here to process closed event second time the object is already disposed, hence we should not process any events.
            if (GuiUtils.isDisposed((Control)sender))
            {
                return;
            }

            clientPanel = ((TagData)((Control)sender).Tag).ClientPanel;
            if (clientPanel == null)
            {
                clientPanel = (Control)sender;
            }
            mapData   = ControlsMap.getInstance().getMapData(clientPanel);
            guiMgForm = mapData.getForm();
            GuiForm form = (GuiForm)sender;


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

            try
            {
                switch (type)
                {
                case EventType.LOAD:
#if !PocketPC
                    // #919192: Icon displayed for an maximised MDI Child is not the one set in
                    // form's Icon property before loading the form.
                    // This is a framework bug. The workaround is to set the icon for Maximised MDI Child again in load handler.
                    if (form.IsMdiChild && form.WindowState == FormWindowState.Maximized)
                    {
                        Icon originalIcon = form.Icon;
                        form.Icon = null;
                        form.Icon = originalIcon;
                    }
                    ContextForms.AddForm(form);
#endif
                    form.Activate();
                    break;

                case EventType.CAN_REPOSITION:

                    if (form.IsMdiChild && OldZorderManager.getInstance().UseOldZorderAlgorithm)
                    {
                        if (!ContextForms.IsLastForm(form))
                        {
                            GuiForm nextForm = ContextForms.GetNextForm(form);
                            if (nextForm.Handle != ((RepositionEventArgs)e).HwndInsertAfter)
                            {
                                ((RepositionEventArgs)e).CanReposition = false;
                            }
                        }
                    }
                    break;

                case EventType.ACTIVATED:
                    //ClientManager.Instance.RefreshMenu(mgForm.getTask().getMgdID());
                    OnFormActivate(form);
                    //Defect 124155 - if form is ancestor to blocking batch form - return activation to the batch
                    if (form.IsMdiChild && ContextForms.IsBlockedByMdiForm(form))
                    {
                        GuiForm formToActivate = ContextForms.GetBlockingFormToActivate(form);
                        if (formToActivate != null && !formToActivate.IsClosing)
                        {
                            formToActivate.Activate();
                        }
                    }

                    break;

                case EventType.WMACTIVATE:
                    OnWmActivate(form, e);

                    break;

#if !PocketPC
                case EventType.SHOWN:
                    if (form.WindowState == FormWindowState.Normal &&
                        ((TagData)form.Tag).WindowType != WindowType.FitToMdi &&
                        ((TagData)form.Tag).WindowType != WindowType.Sdi &&
                        ((TagData)form.Tag).WindowType != WindowType.MdiFrame)
                    {
                        Rectangle?savedbounds = GuiUtils.getSavedBounds(form);
                        if (savedbounds != null)
                        {
                            Rectangle rect = (Rectangle)savedbounds;

                            if (rect.Size != form.ClientSize)
                            {
                                GuiUtils.setBounds(form, rect);
                            }
                        }
                    }

                    GuiUtils.saveFormBounds(form);
                    form.Resize += FormHandler.getInstance().ResizeHandler;

                    // form is shown, so set the flag as false
                    PrintPreviewFocusManager.GetInstance().IsInModalFormOpening = false;
                    ((TagData)form.Tag).IsShown = true;
                    break;
#endif
                case EventType.MDI_CHILD_ACTIVATED:

                    Events.OnFormActivate(guiMgForm);


                    break;

                case EventType.RESIZE:
                    if (((TagData)form.Tag).IgnoreWindowResizeAndMove)
                    {
                        return;
                    }
                    onResize(form, guiMgForm);
                    break;

                case EventType.RESIZE_BEGIN:
                    OnResizeBegin(form);
                    break;

                case EventType.RESIZE_END:
                    OnResizeEnd(form);
                    break;

                case EventType.LAYOUT:
#if !PocketPC
                    if (GuiUtils.IsFormMinimized(form))
                    {
                        ((TagData)form.Tag).Minimized = true;
                    }
                    else if (!((TagData)form.Tag).IsShown)
                    {
                        ((TagData)form.Tag).Minimized = false;
                    }
#endif
                    if (((TagData)form.Tag).WindowType == WindowType.Sdi)
                    {
                        SDIFormLayout(form);
                    }
                    return;

                case EventType.SIZING:
                    OnSizing(form, (SizingEventArgs)e);
                    break;

#if !PocketPC //tmp
                case EventType.COPY_DATA:
                    Events.OnCopyData(guiMgForm, ((CopyDataEventArgs)e).Copydata);
                    return;

                case EventType.MOVE:
                    if (((TagData)form.Tag).WindowType == WindowType.ChildWindow)
                    {
                        Control parent = form.Parent;


                        Debug.Assert(parent is Panel);
                        Form parentform = GuiUtils.FindForm(parent);
                        if (GuiUtils.IsFormMinimized(parentform))
                        {
                            return;
                        }

                        EditorSupportingPlacementLayout placementLayout = ((TagData)parent.Tag).PlacementLayout;
                        if (placementLayout != null)
                        {
                            //TODO: If the child window is moved due to scrolling of the parent window,
                            //computeAndUpdateLogicalSize() should not be called.
                            placementLayout.computeAndUpdateLogicalSize(parent);
                        }
                    }

                    if (((TagData)form.Tag).IgnoreWindowResizeAndMove)
                    {
                        return;
                    }
                    onMove(form, guiMgForm);
                    break;
#endif
                case EventType.CLOSING:
                    //handle the event only if it was not canceled.
                    if (((CancelEventArgs)e).Cancel == false)
                    {
                        bool clrHandledEvent = false;
#if !PocketPC
                        //When MDI Frame is closing, We should not put ACT_EXIT on each it's child windows.
                        //This causes invokation of confirmation dialog, which should be avoided.
                        WindowType windowType = ((TagData)form.Tag).WindowType;
                        if (((FormClosingEventArgs)e).CloseReason == System.Windows.Forms.CloseReason.MdiFormClosing &&
                            (windowType == WindowType.MdiChild || windowType == WindowType.FitToMdi))
                        {
                            return;
                        }
#endif
                        clrHandledEvent = Events.OnFormClose(guiMgForm);


#if !PocketPC //tmp
                        // If CloseReason is UserClosing, then only set Cancel.
                        if (((FormClosingEventArgs)e).CloseReason == System.Windows.Forms.CloseReason.UserClosing)
#endif
                        //If clrHandledEvent is true then 'Cancel' should be false else true.
                        ((CancelEventArgs)e).Cancel = !clrHandledEvent;
                    }
                    return;

                case EventType.CLOSED:
#if PocketPC
                    GUIMain.getInstance().MainForm.closeSoftKeyboard();
#endif
                    break;

                case EventType.NCMOUSE_DOWN:
                    if (!IsClickOnCloseButton((NCMouseEventArgs)e))
                    {
#if !PocketPC
                        // QCR #414516. Click on title bar mustn't move cursor to the parent task.
                        Form previousActiveForm = Form.ActiveForm ?? lastActiveTopLevelForm;

                        //defect 120508 : if the form was already active - we should not process the mouse down
                        if (GuiUtils.FindTopLevelForm(form) != previousActiveForm)
#endif
                        Events.OnMouseDown(guiMgForm, null, null, true, 0, true, true);
                    }
                    break;

                case EventType.NCACTIVATE:
                    Events.OnNCActivate(guiMgForm);
                    break;

                case EventType.DISPOSED:
                    Events.OnDispose(guiMgForm);
                    ContextForms.RemoveForm(form);

                    clientPanel.Tag = null;
                    form.Tag        = null;

                    return;

                case EventType.DEACTIVATED:
                    Events.OnCloseHelp(guiMgForm);
                    break;

#if PocketPC
                case EventType.KEY_DOWN:
                    // Key event preview - KeyDown with 'tab' key is usually used by the system to move the focus
                    // between controls. We want to do it ourselves, so we intercept it here and pass it to the control
                    // in focus.
                    if (((KeyEventArgs)e).KeyCode == Keys.Tab)
                    {
                        // get the tagdata and look for the control that has the focus
                        TagData tagData = (TagData)((Control)sender).Tag;

                        // If the control is one of those for which we need to raise the event, aise it and mark the
                        // event as handled.
                        if (tagData.LastFocusedControl is MgTextBox)
                        {
                            ((MgTextBox)tagData.LastFocusedControl).CallKeyDown((KeyEventArgs)e);
                            ((KeyEventArgs)e).Handled = true;
                        }
                        else if (tagData.LastFocusedControl is MgCheckBox)
                        {
                            ((MgCheckBox)tagData.LastFocusedControl).CallKeyDown((KeyEventArgs)e);
                            ((KeyEventArgs)e).Handled = true;
                        }
                        else if (tagData.LastFocusedControl is MgComboBox)
                        {
                            ((MgComboBox)tagData.LastFocusedControl).CallKeyDown((KeyEventArgs)e);
                            ((KeyEventArgs)e).Handled = true;
                        }
                        else if (tagData.LastFocusedControl is MgButtonBase)
                        {
                            ((MgButtonBase)tagData.LastFocusedControl).CallKeyDown((KeyEventArgs)e);
                            ((KeyEventArgs)e).Handled = true;
                        }
                        else if (tagData.LastFocusedControl is MgTabControl)
                        {
                            ((MgTabControl)tagData.LastFocusedControl).CallKeyDown((KeyEventArgs)e);
                            ((KeyEventArgs)e).Handled = true;
                        }
                    }
                    return;
#endif
                }
            }
            finally
            {
                contextIDGuard.Dispose();
            }
            DefaultHandler.getInstance().handleEvent(type, sender, e, mapData);
        }
Example #14
0
 /// <summary>
 /// Activates Print preview form
 /// </summary>
 internal void Activate()
 {
     _commandType = CommandType.ACTIVATE_PRINT_PREVIEW;
     GUIMain.getInstance().invoke(new PrintPreviewDelegate(Run));
 }