Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="se"></param>
        /// <param name="strScript"></param>
        public ScriptEditor(ScriptEngine se, string strScript)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Non-Designer initialization

            m_se = se;
            m_se.CompileError += new CompileErrorEventHandler(OnCompileError);
            Script = strScript;

            m_tbwtr = new TextBoxWriter(rtbOutput);
            //			m_tbwtr.WriteLine("s: {0}, l: {1}", rtbEdit.SelectionStart, rtbEdit.SelectionLength);
        }
Пример #2
0
        /// <summary>
        /// 
        /// </summary>
        public Gui(AnimSet anis)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Non-Designer initialization

            m_strAedDir = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
            try {
                // UNDONE: problems with this approach to settings:
                // 1. proper location of .config file? Documents and Settings?
                // 2. default values
                // 3. maintenance of Settings class
                // 4. what happens if member isn't present?
                // 5. order-dependent?
                // 6. XML file less readable than .ini
                // 7. more code/maintenance than ini.write(m_nScale), etc w/ overloads
                // 8. doesn't handle Color and other types
                TextReader trdr = new StreamReader(m_strAedDir + @"\AED.config");
                XmlSerializer xser = new XmlSerializer(typeof(Settings));
                Settings settings = (Settings)xser.Deserialize(trdr);

                m_nScale = settings.nPreviewSize;
                m_fShowOrigin = settings.fShowOrigin;
                m_fShowGrid = settings.fShowGrid;
                m_fShowBOverA = settings.fShowBOverA;
                m_clrBackground = Color.FromArgb(settings.nArgbBackground);
                m_fMapSideColors = settings.fMapSideColors;
                // UNDONE: default frame rate
                trdr.Close();
            } catch {
            }

            // Initialize frame rate dependent components

            SetFrameRate(80);

            // UNDONE: doesn't work because panel1 can't accept Focus
            panel1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseWheel);
            trackBar1.Value = m_nScale;
            SetPreviewPanelBackColor(m_clrBackground);

            if (anis != null) {
                m_anis = anis;
                ResetTreeView();
                ShowFirstFrame();
            }

            // Script stuff

            m_se = new ScriptEngine();
            m_se.ScriptDone += new EventHandler(OnScriptDone);
            m_se.AddGlobal("AED", this);
        }