示例#1
0
 /// <summary>
 /// Creates a new context with a custom parent (nested, i.e. more local layer).
 /// </summary>
 /// <param name="parentContext">
 /// The parent context for the new context.
 /// </param>
 public ParseContext(ParseContext parentContext)
 {
     _isReadOnly = false;
     _variables = new Dictionary<String, Value>();
     _functions = new Dictionary<String, IFunction>(StringComparer.OrdinalIgnoreCase);
     _constants = new Dictionary<String, IConstants>(StringComparer.OrdinalIgnoreCase);
     _defaultProperties = new Dictionary<String, IDictionary<String, Value>>();
     _parent = parentContext;
     _precision = parentContext.Precision;
     _displayStyle = parentContext._displayStyle;
 }
示例#2
0
 ParseContext(IDictionary<String, Value> shadowVariables)
 {
     _answer = "$";
     _isReadOnly = true;
     _variables = new ReadOnlyDictionary<String, Value>(shadowVariables);
     _functions = new Dictionary<String, IFunction>(StringComparer.OrdinalIgnoreCase);
     _constants = new Dictionary<String, IConstants>(StringComparer.OrdinalIgnoreCase);
     _defaultProperties = new Dictionary<String, IDictionary<String, Value>>();
     _parent = null;
     _precision = 6;
     _displayStyle = DisplayStyle.Default;
     _elements = new Elements(this);
     _elements.RegisterAssembly(this, Assembly.GetExecutingAssembly());
 }
示例#3
0
        public Display(Application application, WinApi.WndProc proc, DisplayStyle style)
        {
            m_application = application;
            m_instance = WinApi.GetModuleHandle(null);

            m_windowProc = new WinApi.WndProc(proc);
            m_className = "GRANITE_" + Guid.NewGuid().ToString("N");

            WinApi.WindowClass wc = new WinApi.WindowClass()
            {
                style = WinApi.CS_OWNDC | WinApi.CS_VREDRAW | WinApi.CS_HREDRAW,
                windowProcedure = Marshal.GetFunctionPointerForDelegate(m_windowProc),
                instance = m_instance,
                cursor = WinApi.LoadCursor(IntPtr.Zero, WinApi.IDC_ARROW),
                className = m_className
            };

            WinApi.RegisterClass(ref wc);

            uint s = WinApi.WS_POPUP;

            switch (style)
            {
                case DisplayStyle.Fixed:
                    s = WinApi.WS_BORDER;
                    break;
                case DisplayStyle.FixedWithTitle:
                    s = WinApi.WS_CAPTION | WinApi.WS_SYSMENU;
                    break;
                case DisplayStyle.Resizeable:
                    s = WinApi.WS_POPUP | WinApi.WS_THICKFRAME;
                    break;
                case DisplayStyle.ResizeableWithTitle:
                    s |= WinApi.WS_CAPTION | WinApi.WS_SYSMENU | WinApi.WS_THICKFRAME | WinApi.WS_MINIMIZEBOX | WinApi.WS_MAXIMIZEBOX;
                    break;
            }

            m_handle = WinApi.CreateWindowEx(
                0,
                m_className,
                "",
                s,
                0, 0, 800, 600,
                IntPtr.Zero, IntPtr.Zero,
                m_instance, IntPtr.Zero
            );

            m_deviceContext = WinApi.GetDC(m_handle);
        }
示例#4
0
        public ToolStripItem CreateItem(bool fLarge, DisplayStyle displayStyle) {
            if(labelTime == null) {
                labelTime = new ToolStripLabel();
                labelTime.DisplayStyle = ToolStripItemDisplayStyle.Text;
                labelTime.AutoSize = true;
                labelTime.Font = new Font("Courier New", labelTime.Font.SizeInPoints);
                labelTime.Alignment = ToolStripItemAlignment.Right;
                labelTime.Padding = new Padding(0, 0, 24, 0);
            }

            if(timer == null) {
                timer = new Timer();
                timer.Interval = 1000;
                timer.Tick += timer_Tick;
            }

            timer.Start();

            return labelTime;
        }
示例#5
0
        public ToolStripItem CreateItem(bool fLarge, DisplayStyle displayStyle)
        {
            if(button == null) {
                button = new ToolStripButton();
                button.Text =
                button.ToolTipText = ResStrs[6];
                button.MouseDown += button_MouseDown;
            }

            switch(displayStyle) {
                case DisplayStyle.NoLabel:
                case DisplayStyle.SelectiveText:
                    button.DisplayStyle = ToolStripItemDisplayStyle.Image;
                    break;
                case DisplayStyle.ShowTextLabel:
                    button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                    break;
            }

            button.Image = fLarge ? Resource.ViewModeButton_large : Resource.ViewModeButton_small;

            return button;
        }
示例#6
0
 public CommandLink(DisplayStyle style, string text, string description)
     : this(style, text)
 {
     this.Description = description;
 }
示例#7
0
 public CommandLink(DisplayStyle style, string text)
     : this(style)
 {
     this.Text = text;
 }
示例#8
0
 public CommandLink(DisplayStyle style)
     : this()
 {
     this.Style = style;
 }
示例#9
0
        public ToolStripItem CreateItem(bool fLarge, DisplayStyle displayStyle) {
            if(this.button == null) {
                this.button = new ToolStripButton();
                this.button.Text =
                this.button.ToolTipText = this.ResStrs[6];
                this.button.MouseDown += new MouseEventHandler(button_MouseDown);
            }

            switch(displayStyle) {
                case DisplayStyle.NoLabel:
                case DisplayStyle.SelectiveText:
                    this.button.DisplayStyle = ToolStripItemDisplayStyle.Image;
                    break;
                case DisplayStyle.ShowTextLabel:
                    this.button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                    break;
            }

            this.button.Image = fLarge ? Resource.ViewModeButton_large : Resource.ViewModeButton_small;

            return this.button;
        }
示例#10
0
        public virtual void ProcessNotification(DisplayStyle.Notification notification, Growl.Daemon.CallbackInfo cbInfo, Growl.Connector.RequestInfo requestInfo)
        {
            try
            {
                bool done = this.display.ProcessNotification(notification, this.ActualName);

                // for any notifications that remain open (essentially, any visual notifications), add them to a list so we
                // can handle their callbacks later
                if (!done)
                {
                    this.notificationsAwaitingCallback.Add(notification.UUID, cbInfo);
                }
            }
            catch(Exception ex)
            {
                // suppress any exceptions here (in case the display fails for some reason)
                Utility.WriteDebugInfo(String.Format("Display failed to process notification: '{0}' - {1}", ex.Message, ex.StackTrace));
            }
        }