Пример #1
0
 private void giveUp()
 {
     EngineManager.GiveUpGuessingGame();
     updateHealthBar();
     exposeFriendName();
     prepareNextRound();
 }
Пример #2
0
        private void filterFriends()
        {
            string cityFilter;

            User.eGender           gender;
            bool                   genderFilterChosen = true;
            LinkedList <UserProxy> filteredFriendsList;

            if (checkBoxFilterHomeTown.Checked)
            {
                cityFilter = textBoxHomeTown.Text;
            }
            else
            {
                cityFilter = "all";
            }

            if (!radioButtonMale.Checked && !radioButtonFemale.Checked)
            {
                MessageBox.Show("Please choose a gender filter");
                genderFilterChosen = false;
            }

            if (genderFilterChosen)
            {
                gender = radioButtonMale.Checked ? User.eGender.male : User.eGender.female;
                filteredFriendsList = EngineManager.MatchMe(cityFilter, gender);
                userProxyBindingSource.DataSource = filteredFriendsList;
            }
        }
Пример #3
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (EngineManager game = new EngineManager())
     {
         game.Run();
     }
 }
Пример #4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //GraphicsDevice
            //engine components created
            tileMapM = new TileMapManager(this);
            audioM   = new AudioManager(this);
            inputM   = new InputManager(this);
            //engine helpers created

            textM = new TextManager(screenSize.Width);
            menuM = new MenuManager(this, textM);
            //create engine manager
            engineM = new EngineManager(this, tileMapM, eventM, textM, /*fontB,*/ audioM);
            //load manager
            loadM = new Loader(this);//, textureProcessor);
            //associate components with the game
            Components.Add(eventM);
            Components.Add(menuM);
            Components.Add(tileMapM);
            Components.Add(audioM);
            Components.Add(loadM);
            Components.Add(inputM);
            Components.Add(engineM);
            //add services for storage - disabled for now until missing component fix in place
            //Components.Add(new GamerServicesComponent(this));

            //create an event to handle exit command
            this.Exiting += new EventHandler <EventArgs>(GM_Exiting);

            base.Initialize();
        }
Пример #5
0
        public EntraResult CheckPlayability(EngineManager engineState)
        {
            SetMembers(engineState);
            List <List <IntPoint> > reachableSpace = new List <List <IntPoint> >();

            FindWorkingSpace(ref reachableSpace);
            var frogEntity = new FrogEntityPoly(this, StaticData.EngineManager.FrogRB);
            List <List <IntPoint> > frogCompsInter = EntraSolver.GetPolySolution(reachableSpace, frogEntity.GetDefPoly(),
                                                                                 ClipType.ctIntersection);

            if (frogCompsInter.Count > 0)
            {
                //if (CanCookieFitInIntersection(StaticData.EngineManager.CookieRB, solution))
                //MessageBox.Show("The level is playable, recognized by Entra Agent.");
                return(new EntraResult(StaticData.EngineManager.FrogRB.PositionXNACenter2D,
                                       frogEntity.GetDefPoly(),
                                       frogCompsInter,
                                       reachableSpace,
                                       true));
            }
            return(new EntraResult(StaticData.EngineManager.FrogRB.PositionXNACenter2D,
                                   frogEntity.GetDefPoly(),
                                   frogCompsInter,
                                   reachableSpace,
                                   false));
        }
Пример #6
0
        private void LoadEnginesLists()
        {
            EngineManager objEngineManager = new EngineManager();

            lstEngine = objEngineManager.LoadEngines();

            lstActiveEngine = new List <InfinitySettings.EngineManager.Engine>();
            lstActiveEngine = lstEngine.Where(x => x.IsActive == true).ToList();

            lstDeActiveEngine = new List <InfinitySettings.EngineManager.Engine>();
            lstDeActiveEngine = lstEngine.Where(x => x.IsActive == false).ToList();

            if (lstActiveEngine.Count > 0)
            {
                lstActivateEngine.DisplayMember = "Name";
                lstActivateEngine.ValueMember   = "EngineTitle";
                lstActivateEngine.DataSource    = lstActiveEngine;
                lstActivateEngine.SelectedIndex = lstActivateEngine.Items.Count - 1;
            }
            if (lstDeActiveEngine.Count > 0)
            {
                lstDeActivateEngine.DisplayMember = "Name";
                lstDeActivateEngine.ValueMember   = "EngineTitle";
                lstDeActivateEngine.DataSource    = lstDeActiveEngine;
                lstDeActivateEngine.SelectedIndex = lstDeActivateEngine.Items.Count - 1;
            }
        }
Пример #7
0
 private void FormFacebookApp_Load(object sender, EventArgs e)
 {
     EngineManager.initGuessingGame();
     new Thread(updateProfilePictureBox).Start();
     new Thread(updateUserNameLables).Start();
     initGuessingGame();
 }
Пример #8
0
        private void exposeFriendName()
        {
            string friendName = EngineManager.GetFriendToGuess().Name;

            labelUserInteraction.ForeColor = Color.Red;
            labelUserInteraction.Text      = string.Format("The friend's name is: {0}", friendName);
        }
Пример #9
0
        private void listBoxPosts_SelectedIndexChanged(object sender, EventArgs e)
        {
            Post selected = EngineManager.GetUserPosts()[listBoxPosts.SelectedIndex];

            listBoxPostComments.DisplayMember = "Message";
            listBoxPostComments.DataSource    = selected.Comments;
        }
Пример #10
0
    public void Login(string user, string password, string apn, string mac, string model, int channel, int subChanner,
                      int sdkId)
    {
        EngineManager engine = EngineManager.GetInstance();
        cs_login      login  = new cs_login();

        login.uid      = user;
        login.password = string.IsNullOrEmpty(password) ? new byte[0] : TextUtils.GetBytes(password);
        //UtilTools.ShowMessage(LoginGameData.accountServerVerificationMD5());

        login.sz_param = LoginGameData.accountServerVerificationMD5();
        LogSys.LogError("content=" + login.sz_param);
        login.version      = engine.Message.GetAttribute("newVersions");
        login.network_type = apn;
        login.sys_type     = (uint)engine.SysType;
        login.ios_idfa     = "";
        login.ios_idfv     = "";
        login.mac_address  = mac;
        login.device_type  = model;

        login.platform_flag = (uint)sdkId;
        login.chnid         = (uint)channel;
        login.sub_chnid     = (uint)subChanner;
//        UtilTools.ShowWaitWin(WaitFlag.LoginFirst);
        ClientNetwork.Instance.SendMsg(ProtoID.CS_LOGIN, login);
    }
Пример #11
0
        /// <summary>
        /// Implements the OnDisconnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being unloaded.
        /// </summary>
        /// <param name="disconnectMode">Describes how the Add-in is being unloaded.</param>
        /// <param name="custom">Array of parameters that are host application specific.</param>
        /// <seealso cref="IDTExtensibility2"/>
        public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
        {
            try
            {
                EngineManager.Dispose();

                if (disconnectMode == ext_DisconnectMode.ext_dm_UserClosed)
                {
                    // Delete the Commands
                    CommandHelper.RemoveCommand(this.App, COMMANDNAMESPACE + "." + POPUP_MENU_NAME_MINIFIER);
                    CommandHelper.RemoveCommand(this.App, COMMANDNAMESPACE + "." + POPUP_MENU_NAME_JSHINT);
                    CommandHelper.RemoveCommand(this.App, COMMANDNAMESPACE + "." + POPUP_MENU_NAME_CSSLINT);
                    CommandHelper.RemoveCommand(this.App, COMMANDNAMESPACE + "." + POPUP_MENU_NAME_TYPESCRIPT);

                    // Remove the controls from the CommandBars
                    CommandHelper.RemoveCommandControl(this.App, "Item", POPUP_MENU_NAME_MINIFIER);
                    CommandHelper.RemoveCommandControl(this.App, "Item", POPUP_MENU_NAME_JSHINT);
                    CommandHelper.RemoveCommandControl(this.App, "Item", POPUP_MENU_NAME_CSSLINT);
                    CommandHelper.RemoveCommandControl(this.App, "Item", POPUP_MENU_NAME_TYPESCRIPT);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #12
0
        static void Main(string[] args)
        {
            using (var engineMgr = new EngineManager())
            {
                /*
                 *         var battleMgr = new BattleModuleManager(engineMgr);
                 *          battleMgr.Register();
                 *
                 *          var miniGameMgr = new MiniGameModuleManager(engineMgr);
                 *          miniGameMgr.Register();
                 *
                 *          var menuMgr = new MenuModuleManager(engineMgr);
                 *          menuMgr.Register();
                 *
                 *          var worldMgr = new WorldModuleManager(engineMgr, menuMgr, battleMgr);
                 *          worldMgr.Register();
                 *
                 *          var fieldMgr = new FieldModuleManager(engineMgr, menuMgr, battleMgr);
                 *          fieldMgr.Register();
                 */

                if (!engineMgr.CreateWindow(800, 600, "OpenVII"))
                {
                    Console.WriteLine("Failed to initialize OpenVII window");
                }

                var testingModule = new TestingModuleManager(engineMgr);
                testingModule.Register();

                engineMgr.Run();
            }
        }
Пример #13
0
        static void Main(string[] args)
        {
            KnowledgeManager knowledgeManager = new KnowledgeManager(@"C:\Users\ShichiKi\AppData\Roaming\Skype\My Skype Received Files\SimpleOwlOntology(5).owl");
            EngineManager    engineManager    = new EngineManager(knowledgeManager);
            // Input nguoi dung
            List <Fact> inputs = CreateMockInputs();

            // Yeu cau nguoi dung
            List <Request> outputs = CreateMockRequests();

            // Suy dien tien
            engineManager.CompleteInfer(inputs, outputs);

            // Hoi y kien nguoi dung va them su kien
            List <CrispFact> newFacts   = engineManager.MakeFactsFromIncompleteRules(outputs);
            List <Fact>      choseFacts = new List <Fact>()
            {
                newFacts[0]
            };                                                      // workaround, chon dai 1 sk dau tien trong tap su kien moi bo sung cho luat ko day du

            engineManager.AddNewFacts(choseFacts);

            // Suy dien tien lai voi su kien moi
            engineManager.CompleteInfer(inputs, outputs);

            // Suy dien tien khong day du
            engineManager.IncompleteInfer(inputs, outputs);
        }
Пример #14
0
	public void Init(EngineManager engineManager, string name)
	{
		if (name != "")
		{
			gameObject.name = name;
		}
	}
Пример #15
0
        public void LoadActions()
        {
            try
            {
                if (this.engineManager == null || this.engineManager.IsDisposed)
                {
                    this.engineManager = new EngineManager(this);
                }

                this.engineManager.Clear();
                this.engineManager.Add(YuiCssEngine            = new YuiCssEngine());
                this.engineManager.Add(YuiJsEngine             = new YuiJsEngine());
                this.engineManager.Add(DeanEdwardsPackerEngine = new DeanEdwardsPackerEngine());
                this.engineManager.Add(ClosureCompilerEngine   = new ClosureCompilerEngine());
                this.engineManager.Add(LessEngine         = new LessEngine());
                this.engineManager.Add(MsJsEngine         = new MsJsEngine());
                this.engineManager.Add(MsCssEngine        = new MsCssEngine());
                this.engineManager.Add(ConfigEngine       = new ConfigEngine());
                this.engineManager.Add(ViewEngine         = new ViewEngine());
                this.engineManager.Add(T4Engine           = new T4Engine());
                this.engineManager.Add(CoffeeScriptEngine = new CoffeeScriptEngine());
                this.engineManager.Add(UglifyEngine       = new UglifyEngine());
                this.engineManager.Add(JSHintEngine       = new JSHintEngine());
                this.engineManager.Add(CSSLintEngine      = new CSSLintEngine());
                this.engineManager.Add(TypeScriptEngine   = new TypeScriptEngine());
                this.engineManager.Add(SassEngine         = new SassEngine());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #16
0
	public static void ConvertParameters(EngineManager manager, ParameterInfo[] parameterInfo, ref object[] parameters)
	{
		for (int i = 0; i < parameterInfo.Length; i++)
		{
			if (Common.TypeInheritsFrom(parameterInfo[i].ParameterType, typeof(EngineObject)) && parameters[i].GetType() == typeof(int))
			{
				parameters[i] = manager.GetObject<EngineObject>((int)parameters[i]);
			}

			if (parameterInfo[i].ParameterType == typeof(object[]))
			{
				object[] tempObjects = new object[parameters.Length - i];

				for (int j = 0; j < tempObjects.Length; j++)
				{
					tempObjects[j] = parameters[i + j];
				}

				parameters[i] = tempObjects;

				object[] newParameters = new object[i + 1];
				for (int j = 0; j < newParameters.Length; j++)
				{
					newParameters[j] = parameters[j];
				}

				parameters = newParameters;
			}
		}
	}
        public void Start()
        {
            engineManager = GetComponent <EngineManager>();
            if (engineManager == null)
            {
                Utilities.Log.Error("CyclopsEngineStateChangedCallouts can not find EngineManager - deleting");
                Destroy(this);
            }

            if (EntryPoint.LOAD_DEFAULT_CYCLOPS_ASSETS)
            {
                if (SilentRunningCallout == null)
                {
                    SilentRunningCallout = CyclopsDefaultAssets.ENGINE_STATE_SILENT_RUNNING;
                }

                if (NormalCallout == null)
                {
                    NormalCallout = CyclopsDefaultAssets.ENGINE_STATE_AHEAD_STANDARD;
                }

                if (SlowCallout == null)
                {
                    SlowCallout = CyclopsDefaultAssets.ENGINE_STATE_AHEAD_SLOW;
                }

                if (FastCallout == null)
                {
                    FastCallout = CyclopsDefaultAssets.ENGINE_STATE_AHEAD_FAST;
                }
            }
        }
Пример #18
0
        private void timerForwardingFacebook_Tick(object sender, EventArgs e)
        {
            bool isUserLoggedIn, isUserWantToRetryLogin = true;

            timerForwardingFacebook.Enabled = false;
            if (ApplicationSettings.LastAccessToken == null)
            {
                EngineManager.LoginToFacebook();
                isUserLoggedIn = isLoginSuccessed();
                while (!isUserLoggedIn && isUserWantToRetryLogin)
                {
                    isUserWantToRetryLogin = isUserWantToTryLoginAgain();
                    if (isUserWantToRetryLogin)
                    {
                        EngineManager.LoginToFacebook();
                        isUserLoggedIn = isLoginSuccessed();
                    }
                }
            }
            else
            {
                EngineManager.ConnectToFacebookWithLastAccessToken(ApplicationSettings.LastAccessToken);
            }

            Close();
        }
Пример #19
0
        private void LoadEnginesList()
        {
            EngineManager objEngineManager = new EngineManager();

            InfinitySettings.EngineManager.Engine        _defaultEngine = objEngineManager.LoadDefaultEngine();
            List <InfinitySettings.EngineManager.Engine> engines        = objEngineManager.LoadEngines();

            engines = engines.Where(x => x.IsActive == true).ToList();

            for (int i = 0; i < TournamentInfo.ParticipitantList.Count; i++)
            {
                for (int j = 0; j < engines.Count; j++)
                {
                    if (engines[j].Name == TournamentInfo.ParticipitantList[i].ToString())
                    {
                        engines.Remove(engines[j]);
                    }
                }
            }

            if (isWhite) // remove engine from list, if it is already selected for black engine
            {
                if (App.Win.EngineVsEngine.UCIEngineBlack != null)
                {
                    for (int i = 0; i < engines.Count; i++)
                    {
                        if (engines[i].TitleOnly == App.Win.EngineVsEngine.UCIEngineBlack.EngineName)
                        {
                            engines.Remove(engines[i]);
                        }
                    }
                }
            }
            else // remove engine from list, if it is already selected for white engine
            {
                if (App.Win.EngineVsEngine.UCIEngineWhite != null)
                {
                    for (int i = 0; i < engines.Count; i++)
                    {
                        if (engines[i].TitleOnly == App.Win.EngineVsEngine.UCIEngineWhite.EngineName)
                        {
                            engines.Remove(engines[i]);
                        }
                    }
                }
            }

            if (engines.Count > 0)
            {
                lstEngines.DisplayMember = "Name";
                lstEngines.ValueMember   = "FilePath";
                lstEngines.DataSource    = engines;
                if (!String.IsNullOrEmpty(_defaultEngine.FilePath))
                {
                    lstEngines.SelectedValue = _defaultEngine.FilePath;
                }

                SetSelectedEngine();
            }
        }
Пример #20
0
        public static void Quit()
        {
            if (_FrontendManager != null)
            {
                _FrontendManager.IsFrontendDisconnecting = true;
                if (IsLocalEngine)
                {
                    try {
                        // we don't shutdown the remote session
                        Session.Shutdown();
                    } catch (Exception ex) {
#if LOG4NET
                        _Logger.Error("Quit(): Exception", ex);
#endif
                    }
                }
                else if (EngineManager != null)
                {
                    EngineManager.Disconnect();
                }
            }

            /*
             * BUG: don't do this, the access to config is lost and the entry will
             * throw an exception then.
             * if (_FrontendManager != null) {
             *  DisconnectEngineFromGUI();
             * }
             */

            MainWindow.Reset();
            Environment.Exit(0);
        }
Пример #21
0
        public static List <List <IntPoint> > GetRopePoly(SpringService service, EngineManager engineManager)
        {
            int verticalLineLength, halfFarWidth;

            SetProperHalfFarWidth(service, engineManager.CookieRB, out verticalLineLength, out halfFarWidth);
            var polySemiCircle = PolysHelper.GetShapeSemiCirclePoly(service.Masses[0].PositionXNACenter2D,
                                                                    ropeNearWidth,
                                                                    verticalLineLength,
                                                                    halfFarWidth);
            List <IntPoint> polyAdded = GetAddedGravityRectanglePoly(service, engineManager);
            var             polyFinal = EntraSolver.GetPolySolution(polySemiCircle, polyAdded, ClipType.ctUnion);

            // Cut upper rectangle
            int             cY   = (int)StaticData.EngineManager.CookieRB.PositionXNACenter2D.Y;
            List <IntPoint> poly = new List <IntPoint>()
            {
                new IntPoint(0, 0),
                new IntPoint(StaticData.LevelFarWidth, 0),
                new IntPoint(StaticData.LevelFarWidth, cY),
                new IntPoint(0, cY),
            };

            polyFinal = EntraSolver.GetPolySolution(polyFinal, poly, ClipType.ctDifference);
            return(polyFinal);
        }
Пример #22
0
        public static void InitRemoteEngine(string engine)
        {
            EngineManager = new EngineManager(_FrontendConfig,
                                              _MainWindow.UI);
            try {
                try {
                    Console.WriteLine(
                        _("Connecting to remote engine '{0}'..."), engine
                        );
                    EngineManager.Connect(engine);
                    Console.WriteLine(_("Connection established"));
                } catch (Exception ex) {
#if LOG4NET
                    _Logger.Error(ex);
#endif
                    Console.WriteLine(
                        _("Connection failed! Error: {1}"),
                        engine,
                        ex.Message
                        );
                    Environment.Exit(1);
                }

                Session     = EngineManager.Session;
                _UserConfig = EngineManager.UserConfig;
                ConnectEngineToGUI();
            } catch (Exception ex) {
#if LOG4NET
                _Logger.Error(ex);
#endif
                EngineManager.Disconnect();
                throw;
            }
        }
Пример #23
0
        static void Main(string[] args)
        {
            KnowledgeManager knowledgeManager = new KnowledgeManager(@"C:\Users\ShichiKi\Desktop\SimpleOwlOntology.owl");
            EngineManager    engineManager    = new EngineManager(knowledgeManager);

            // Input nguoi dung
            List <Fact> inputs = CreateMockInputs();

            // Yeu cau nguoi dung
            List <Request> outputs = CreateMockOutputs();

            // Suy dien tien
            engineManager.CompleteInfer(inputs, outputs);

            // Hoi y kien nguoi dung va them su kien
            List <CrispFact> newFacts = engineManager.MakeFactsFromIncompleteRules(outputs);
            //List<Fact> choseFacts = new List<Fact>() {newFacts[0], newFacts[1]};
            //engine.AddNewFacts(choseFacts);

            // Suy dien tien lai voi su kien moi
            //engine.CompleteInfer(inputs, outputs);

            // Suy dien tien khong day du
            //engine.IncompleteInfer(inputs, outputs);
        }
Пример #24
0
        public JavaScriptGlobalScript(Plugin plugin, ScriptConfiguration configuration) : base(configuration)
        {
            ScriptConfiguration.ScriptContentChanged += ConfigurationOnScriptContentChanged;

            EngineManager = plugin.Kernel !.Get <EngineManager>(new ConstructorArgument("script", this));
            EngineManager.ExecuteScript();
        }
Пример #25
0
        private void LoadNewEngine()
        {
            if (!IsNewEngineSelected)
            {
                return;
            }

            EngineManager objEngineManager = new EngineManager();

            objEngineManager.SaveDefaultEngine(lstEngines.SelectedValue.ToString());

            int hashTableSize = Convert.ToInt32(cmbHashTableSize.SelectedValue);

            InfinitySettings.Settings.DefaultEngineXml = objEngineManager.LoadDefaultEngine();
            string engineFile = InfinitySettings.Settings.DefaultEngineXml.FilePath;

            selectedEngine = new UCIEngine(engineFile, hashTableSize, this.Game);
            if (engineParameters != null)
            {
                engineParameters.SetEngineParameters(selectedEngine);
            }

            UCIEngine oldEngine = this.Game.DefaultEngine;

            if (oldEngine != null)
            {
                oldEngine.Close();
            }
            selectedEngine.UseTablebases = chkUseTablebases.Checked;
            selectedEngine.Load();
        }
        } // GenerateMask

        #endregion

        #region Blend Foliage

        /// <summary>
        /// Blend Foliage with the opaque objects.
        /// </summary>
        public static void BlendFoliage(RenderTarget foliageColorTexture, RenderTarget lightMap)
        {
            if (Effect == null)
            {
                LoadShader();
            }
            try
            {
                Effect.CurrentTechnique = Effect.Techniques["FinalColor"];
                // Set render states
                EngineManager.Device.BlendState        = BlendState.NonPremultiplied;
                EngineManager.Device.DepthStencilState = DepthStencilState.None;
                // Set parameters
                SetHalfPixel(new Vector2(-1f / foliageColorTexture.Width, 1f / foliageColorTexture.Height));
                SetFoliageColorTexture(foliageColorTexture);
                SetMaskTexture(Mask);
                SetLightMapTexture(lightMap);

                Effect.CurrentTechnique.Passes[0].Apply();
                ScreenPlane.Render();

                EngineManager.SetDefaultRenderStates();
            } // try
            catch (Exception e)
            {
                throw new Exception("Unable to render the screen space alpha masking shader" + e.Message);
            }
        } // BlendFoliage
Пример #27
0
        public EngineManagerDialog(EngineManager engineManager)
        {
            Trace.Call(engineManager);

            if (engineManager == null) {
                throw new ArgumentNullException("engineManager");
            }

            _EngineManager = engineManager;

            Modal = true;
            Title = "Smuxi - " + _("Engine Manager");
            SetPosition(Gtk.WindowPosition.CenterAlways);

            Gtk.HBox connect_hbox = new Gtk.HBox();
            Gtk.Image connect_image = new Gtk.Image(
                new Gdk.Pixbuf(null, "connect-button.svg", 22, 22));
            connect_hbox.Add(connect_image);
            connect_hbox.Add(new Gtk.Label(_("_Connect")));
            AddActionWidget(new Gtk.Button(connect_hbox), 1);

            AddActionWidget(new Gtk.Button(Gtk.Stock.New), 3);

            Gtk.Button edit_button = new Gtk.Button(Gtk.Stock.Edit);
            _EditButton = edit_button;
            AddActionWidget(edit_button, 2);

            _DeleteButton = new Gtk.Button(Gtk.Stock.Delete);
            AddActionWidget(_DeleteButton, 4);
            AddActionWidget(new Gtk.Button(Gtk.Stock.Quit), 5);
            Response += new Gtk.ResponseHandler(_OnResponse);

            Gtk.VBox vbox = new Gtk.VBox();
            Gtk.Label label = new Gtk.Label("<b>" +
                                            _("Select which Smuxi engine you want to connect to") +
                                            "</b>");
            label.UseMarkup = true;
            vbox.PackStart(label, false, false, 5);

            Gtk.HBox hbox = new Gtk.HBox();
            hbox.PackStart(new Gtk.Label(_("Engine:")), false, false, 5);

            _ListStore = new Gtk.ListStore(typeof(string));
            _ComboBox = new Gtk.ComboBox();
            Gtk.CellRendererText cell = new Gtk.CellRendererText();
            _ComboBox.PackStart(cell, false);
            _ComboBox.AddAttribute(cell, "text", 0);
            _ComboBox.Changed += new EventHandler(_OnComboBoxChanged);
            _ComboBox.Model = _ListStore;
            _InitEngineList();

            hbox.PackStart(_ComboBox, true, true, 10);

            vbox.PackStart(hbox, false, false, 10);

            VBox.Add(vbox);

            ShowAll();
        }
Пример #28
0
 /// <summary>
 ///     Start creating a new profile
 /// </summary>
 private void bCreate_Click(object sender, EventArgs e)
 {
     if (EngineManager.CurrentEngineType != Engines.Engines.None)
     {
         return;
     }
     EngineManager.StartProfileCreation();
 }
Пример #29
0
 /// <summary>
 ///     Save the profile or cancel
 /// </summary>
 private void bSave_Click(object sender, EventArgs e)
 {
     if (EngineManager.CurrentEngineType != Engines.Engines.ProfileCreation)
     {
         return;
     }
     EngineManager.StopCurrentEngine();
 }
Пример #30
0
 /// <summary>
 ///     Clear the list of items we should restock
 /// </summary>
 private void bClearRestockItems_Click(object sender, EventArgs e)
 {
     if (EngineManager.CurrentEngineType != Engines.Engines.ProfileCreation)
     {
         return;
     }
     EngineManager.EngineAs <ProfileCreator>().ClearRestockItems();
 }
Пример #31
0
 private void bClearGhostHotspots_Click(object sender, EventArgs e)
 {
     if (EngineManager.CurrentEngineType != Engines.Engines.ProfileCreation)
     {
         return;
     }
     EngineManager.EngineAs <ProfileCreator>().ClearGhostWaypoints();
 }
Пример #32
0
 private void bAddGhostHotspot_Click(object sender, EventArgs e)
 {
     if (EngineManager.CurrentEngineType != Engines.Engines.ProfileCreation)
     {
         return;
     }
     EngineManager.EngineAs <ProfileCreator>().AddGWP();
 }
Пример #33
0
 /// <summary>
 ///     Load a profile
 /// </summary>
 private void bGrindLoadProfile_Click(object sender, EventArgs e)
 {
     if (EngineManager.CurrentEngineType != Engines.Engines.None)
     {
         return;
     }
     EngineManager.StartGrinder(cbLoadLastProfile.Checked);
 }
Пример #34
0
	public void Init(EngineManager instance, string eventName, double time, Vector3 position, params object[] parameters)
	{
		mTime = time;
		mPosition = position;
		mFunctionName = eventName;
		mParameters = new object[parameters.Length];
		Array.Copy(parameters, mParameters, parameters.Length);
		mEngineManager = instance;
	}
	//This needs to be OnRecievedID, or something
	void Start()
	{
		PhysicObject tempObject = gameObject.GetComponent<PhysicObject>();

		if (tempObject != null)
		{
			mThisManager = tempObject.GetInstance();

			if (tempObject.GetInstance().GetSyncedClient() != null)
			{
				int objectID = tempObject.GetObjectID();

				tempObject = tempObject.GetInstance().GetSyncedClient().GetObject<PhysicObject>(objectID);

				mSyncedObject = tempObject.transform;
				mSyncedPhysics = tempObject;
				mSyncedPathing = tempObject.GetComponent<Pathing>();
				mSyncedRigidbody = tempObject.rigidbody2D;
			}
		}
	}
Пример #36
0
	static public Script NewScript(GameObject parent, EngineManager engineManager, string name = "")
	{
		return NewObject<Script>(parent, engineManager, name);
	}
Пример #37
0
	public void Init(EngineManager instance)
	{
		mCurrentInstance = instance;

		Init(null, null, "", null);
	}
Пример #38
0
	void Start () 
	{
		UICamera.fallThrough = gameObject;
		mManager = GetComponent<EngineManager>();
	}
Пример #39
0
        public static void InitRemoteEngine(string engine)
        {
            var manager = new EngineManager(_FrontendConfig,
                                            _MainWindow.UI);
            try {
                try {
                    Console.WriteLine(
                        _("Connecting to remote engine '{0}'..."), engine
                    );
                    manager.Connect(engine);
                    Console.WriteLine(_("Connection established"));
                } catch (Exception ex) {
            #if LOG4NET
                    _Logger.Error(ex);
            #endif
                    Console.WriteLine(
                        _("Connection failed! Error: {1}"),
                        engine,
                        ex.Message
                    );
                    Environment.Exit(1);
                }

                _Session = manager.Session;
                _UserConfig = manager.UserConfig;
                _EngineVersion = manager.EngineVersion;
                ConnectEngineToGUI();
            } catch (Exception ex) {
            #if LOG4NET
                _Logger.Error(ex);
            #endif
                manager.Disconnect();
                throw;
            }
        }
Пример #40
0
        public MainWindow()
            : base("Smuxi")
        {
            // restore window size / position
            int width, heigth;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"] != null) {
                width  = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"];
            } else {
                width = 800;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"] != null) {
                heigth = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"];
            } else {
                heigth = 600;
            }
            if (width == -1 && heigth == -1) {
                SetDefaultSize(800, 600);
                Maximize();
            } else if (width == 0 && heigth == 0) {
                // HACK: map 0/0 to default size as it crashes on Windows :/
                SetDefaultSize(800, 600);
            } else {
                SetDefaultSize(width, heigth);
            }

            int x, y;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"] != null) {
                x = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"];
            } else {
                x = 0;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"] != null) {
                y = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"];
            } else {
                y = 0;
            }
            if (x == 0 && y == 0) {
                SetPosition(Gtk.WindowPosition.Center);
            } else {
                Move(x, y);
            }

            DeleteEvent += OnDeleteEvent;
            FocusInEvent += OnFocusInEvent;
            FocusOutEvent += OnFocusOutEvent;
            WindowStateEvent += OnWindowStateEvent;

            Gtk.AccelGroup agrp = new Gtk.AccelGroup();
            Gtk.AccelKey   akey;
            AddAccelGroup(agrp);

            // Menu
            _MenuBar = new Gtk.MenuBar();
            Gtk.Menu menu;
            Gtk.MenuItem item;
            Gtk.ImageMenuItem image_item;

            // Menu - File
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_File"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            item = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, agrp);
            item.Activated += new EventHandler(_OnPreferencesButtonClicked);
            menu.Append(item);

            menu.Append(new Gtk.SeparatorMenuItem());

            item = new Gtk.ImageMenuItem(Gtk.Stock.Quit, agrp);
            item.Activated += new EventHandler(_OnQuitButtonClicked);
            menu.Append(item);

            // Menu - Server
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Server"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            image_item = new Gtk.ImageMenuItem(_("_Quick Connect"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Connect, Gtk.IconSize.Menu);
            image_item.Activated += OnServerQuickConnectButtonClicked;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(Gtk.Stock.Add, agrp);
            image_item.Activated += OnServerAddButtonClicked;
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Manage"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Edit, Gtk.IconSize.Menu);
            image_item.Activated += OnServerManageServersButtonClicked;
            menu.Append(image_item);

            // Menu - Chat
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Chat"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            _OpenChatMenuItem = new Gtk.ImageMenuItem(_("Open / Join Chat"));
            _OpenChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open, Gtk.IconSize.Menu);
            _OpenChatMenuItem.Activated += OnChatOpenChatButtonClicked;
            _OpenChatMenuItem.Sensitive = false;
            menu.Append(_OpenChatMenuItem);

            _FindGroupChatMenuItem = new Gtk.ImageMenuItem(_("_Find Group Chat"));
            _FindGroupChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Find, Gtk.IconSize.Menu);
            _FindGroupChatMenuItem.Activated += OnChatFindGroupChatButtonClicked;
            _FindGroupChatMenuItem.Sensitive = false;
            menu.Append(_FindGroupChatMenuItem);

            image_item = new Gtk.ImageMenuItem(_("C_lear All Activity"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Clear, Gtk.IconSize.Menu);
            image_item.Activated += OnChatClearAllActivityButtonClicked;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(_("_Next Chat"));
            image_item.Image = new Gtk.Image(Gtk.Stock.GoForward, Gtk.IconSize.Menu);
            image_item.Activated += OnNextChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.Page_Down;
            image_item.AddAccelerator("activate", agrp, akey);
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Previous Chat"));
            image_item.Image = new Gtk.Image(Gtk.Stock.GoBack, Gtk.IconSize.Menu);
            image_item.Activated += OnPreviousChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.Page_Up;
            image_item.AddAccelerator("activate", agrp, akey);
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            /*
            // TODO: make a radio item for each chat hotkey
            Gtk.RadioMenuItem radio_item;
            radio_item = new Gtk.RadioMenuItem();
            radio_item = new Gtk.RadioMenuItem(radio_item);
            radio_item = new Gtk.RadioMenuItem(radio_item);

            menu.Append(new Gtk.SeparatorMenuItem());
            */

            /*
            image_item = new Gtk.ImageMenuItem(Gtk.Stock.Find, agrp);
            image_item.Activated += OnFindChatMenuItemActivated;
            menu.Append(image_item);

            item = new Gtk.MenuItem(_("Find _Next"));
            item.Activated += OnFindNextChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.G;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            item = new Gtk.MenuItem(_("Find _Previous"));
            item.Activated += OnFindPreviousChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask;
            akey.Key = Gdk.Key.G;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);
            */

            // ROFL: the empty code statement below is needed to keep stupid
            // gettext away from using all the commented code from above as
            // translator comment
            ;
            _OpenLogChatMenuItem = new Gtk.ImageMenuItem(_("Open Log"));
            _OpenLogChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open,
                                                       Gtk.IconSize.Menu);
            _OpenLogChatMenuItem.Activated += OnOpenLogChatMenuItemActivated;
            _OpenLogChatMenuItem.Sensitive = false;
            _OpenLogChatMenuItem.NoShowAll = true;
            menu.Append(_OpenLogChatMenuItem);

            _CloseChatMenuItem = new Gtk.ImageMenuItem(Gtk.Stock.Close, agrp);
            _CloseChatMenuItem.Activated += OnCloseChatMenuItemActivated;
            menu.Append(_CloseChatMenuItem);

            // Menu - Engine
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Engine"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            item = new Gtk.MenuItem(_("_Use Local Engine"));
            item.Activated += new EventHandler(_OnUseLocalEngineButtonClicked);
            menu.Append(item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(_("_Add Remote Engine"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Menu);
            image_item.Activated += new EventHandler(_OnAddRemoteEngineButtonClicked);
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Switch Remote Engine"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu);
            image_item.Activated += new EventHandler(_OnSwitchRemoteEngineButtonClicked);
            menu.Append(image_item);

            // Menu - View
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_View"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            item = new Gtk.CheckMenuItem(_("_Caret Mode"));
            item.Activated += new EventHandler(_OnCaretModeButtonClicked);
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F7;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            item = new Gtk.CheckMenuItem(_("_Browse Mode"));
            item.Activated += delegate {
                try {
                    _Notebook.IsBrowseModeEnabled = !_Notebook.IsBrowseModeEnabled;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F8;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            _ShowMenuBarItem = new Gtk.CheckMenuItem(_("Show _Menubar"));
            _ShowMenuBarItem.Active = true;
            _ShowMenuBarItem.Activated += delegate {
                try {
                    _MenuBar.Visible = !_MenuBar.Visible;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            menu.Append(_ShowMenuBarItem);

            item = new Gtk.ImageMenuItem(Gtk.Stock.Fullscreen, agrp);
            item.Activated += delegate {
                try {
                    IsFullscreen = !IsFullscreen;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F11;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            // Menu - Help
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Help"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            image_item = new Gtk.ImageMenuItem(Gtk.Stock.About, agrp);
            image_item.Activated += new EventHandler(_OnAboutButtonClicked);
            menu.Append(image_item);

            // TODO: network treeview
            _Notebook = new Notebook();
            _Notebook.SwitchPage += OnNotebookSwitchPage;

            _ChatViewManager = new ChatViewManager(_Notebook, null);
            Assembly asm = Assembly.GetExecutingAssembly();
            _ChatViewManager.Load(asm);
            _ChatViewManager.LoadAll(System.IO.Path.GetDirectoryName(asm.Location),
                                     "smuxi-frontend-gnome-*.dll");
            _ChatViewManager.ChatAdded += OnChatViewManagerChatAdded;
            _ChatViewManager.ChatRemoved += OnChatViewManagerChatRemoved;

            #if GTK_SHARP_2_10
            _StatusIconManager = new StatusIconManager(this, _ChatViewManager);
            #endif
            #if INDICATE_SHARP
            _IndicateManager = new IndicateManager(this, _ChatViewManager);
            #endif
            #if NOTIFY_SHARP
            _NotifyManager = new NotifyManager(this, _ChatViewManager);
            #endif

            _UI = new GnomeUI(_ChatViewManager);

            // HACK: Frontend.FrontendConfig out of scope
            _EngineManager = new EngineManager(Frontend.FrontendConfig, _UI);

            _Entry = new Entry(_Notebook);

            _ProgressBar = new Gtk.ProgressBar();

            Gtk.VBox vbox = new Gtk.VBox();
            vbox.PackStart(_MenuBar, false, false, 0);
            vbox.PackStart(_Notebook, true, true, 0);
            vbox.PackStart(_Entry, false, false, 0);

            _NetworkStatusbar = new Gtk.Statusbar();
            _NetworkStatusbar.WidthRequest = 300;
            _NetworkStatusbar.HasResizeGrip = false;

            _Statusbar = new Gtk.Statusbar();
            _Statusbar.HasResizeGrip = false;

            Gtk.HBox status_bar_hbox = new Gtk.HBox();
            status_bar_hbox.Homogeneous = true;
            status_bar_hbox.PackStart(_NetworkStatusbar, false, true, 0);
            status_bar_hbox.PackStart(_Statusbar, true, true, 0);

            Gtk.HBox status_hbox = new Gtk.HBox();
            status_hbox.PackStart(status_bar_hbox);
            status_hbox.PackStart(_ProgressBar, false, false, 0);

            vbox.PackStart(status_hbox, false, false, 0);
            Add(vbox);
        }
Пример #41
0
        public MainWindow()
            : base("Smuxi")
        {
            // restore window size / position
            int width, heigth;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"] != null) {
                width  = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"];
            } else {
                width = 800;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"] != null) {
                heigth = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"];
            } else {
                heigth = 600;
            }
            if (width < -1 || heigth < -1) {
                width = -1;
                heigth = -1;
            }
            if (width == -1 && heigth == -1) {
                SetDefaultSize(800, 600);
                Maximize();
            } else if (width == 0 && heigth == 0) {
                // HACK: map 0/0 to default size as it crashes on Windows :/
                SetDefaultSize(800, 600);
            } else {
                SetDefaultSize(width, heigth);
            }

            int x, y;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"] != null) {
                x = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"];
            } else {
                x = 0;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"] != null) {
                y = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"];
            } else {
                y = 0;
            }
            if (x < 0 || y < 0) {
                x = 0;
                y = 0;
            }
            if (x == 0 && y == 0) {
                SetPosition(Gtk.WindowPosition.Center);
            } else {
                Move(x, y);
            }

            DeleteEvent += OnDeleteEvent;
            FocusInEvent += OnFocusInEvent;
            FocusOutEvent += OnFocusOutEvent;
            WindowStateEvent += OnWindowStateEvent;

            Gtk.AccelGroup agrp = new Gtk.AccelGroup();
            Gtk.AccelKey   akey;
            AddAccelGroup(agrp);

            // Menu
            MenuBar = new Gtk.MenuBar();
            Gtk.Menu menu;
            Gtk.MenuItem item;
            Gtk.ImageMenuItem image_item;

            // Menu - File
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_File"));
            item.Submenu = menu;
            MenuBar.Append(item);

            item = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, agrp);
            item.Activated += new EventHandler(_OnPreferencesButtonClicked);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            menu.Append(new Gtk.SeparatorMenuItem());

            item = new Gtk.ImageMenuItem(Gtk.Stock.Quit, agrp);
            item.Activated += new EventHandler(_OnQuitButtonClicked);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            // Menu - Server
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Server"));
            item.Submenu = menu;
            MenuBar.Append(item);

            image_item = new Gtk.ImageMenuItem(_("_Quick Connect"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Connect, Gtk.IconSize.Menu);
            image_item.Activated += OnServerQuickConnectButtonClicked;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(Gtk.Stock.Add, agrp);
            image_item.Activated += OnServerAddButtonClicked;
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Manage"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Edit, Gtk.IconSize.Menu);
            image_item.Activated += OnServerManageServersButtonClicked;
            menu.Append(image_item);

            // Menu - Chat
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Chat"));
            item.Submenu = menu;
            MenuBar.Append(item);

            _OpenChatMenuItem = new Gtk.ImageMenuItem(_("Open / Join Chat"));
            _OpenChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open, Gtk.IconSize.Menu);
            _OpenChatMenuItem.Activated += OnOpenChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.L;
            _OpenChatMenuItem.AddAccelerator("activate", agrp, akey);
            _OpenChatMenuItem.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(_OpenChatMenuItem);

            _FindGroupChatMenuItem = new Gtk.ImageMenuItem(_("_Find Group Chat"));
            _FindGroupChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Find, Gtk.IconSize.Menu);
            _FindGroupChatMenuItem.Activated += OnChatFindGroupChatButtonClicked;
            _FindGroupChatMenuItem.Sensitive = false;
            menu.Append(_FindGroupChatMenuItem);

            image_item = new Gtk.ImageMenuItem(_("C_lear All Activity"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Clear, Gtk.IconSize.Menu);
            image_item.Activated += OnChatClearAllActivityButtonClicked;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(_("_Next Chat"));
            image_item.Image = new Gtk.Image(Gtk.Stock.GoForward, Gtk.IconSize.Menu);
            image_item.Activated += OnNextChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.Page_Down;
            image_item.AddAccelerator("activate", agrp, akey);
            image_item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Previous Chat"));
            image_item.Image = new Gtk.Image(Gtk.Stock.GoBack, Gtk.IconSize.Menu);
            image_item.Activated += OnPreviousChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.Page_Up;
            image_item.AddAccelerator("activate", agrp, akey);
            image_item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            /*
            // TODO: make a radio item for each chat hotkey
            Gtk.RadioMenuItem radio_item;
            radio_item = new Gtk.RadioMenuItem();
            radio_item = new Gtk.RadioMenuItem(radio_item);
            radio_item = new Gtk.RadioMenuItem(radio_item);

            menu.Append(new Gtk.SeparatorMenuItem());
            */

            /*
            image_item = new Gtk.ImageMenuItem(Gtk.Stock.Find, agrp);
            image_item.Activated += OnFindChatMenuItemActivated;
            menu.Append(image_item);

            item = new Gtk.MenuItem(_("Find _Next"));
            item.Activated += OnFindNextChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.G;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            item = new Gtk.MenuItem(_("Find _Previous"));
            item.Activated += OnFindPreviousChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask;
            akey.Key = Gdk.Key.G;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);
            */

            // ROFL: the empty code statement below is needed to keep stupid
            // gettext away from using all the commented code from above as
            // translator comment
            ;
            _OpenLogChatMenuItem = new Gtk.ImageMenuItem(_("Open Log"));
            _OpenLogChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open,
                                                       Gtk.IconSize.Menu);
            _OpenLogChatMenuItem.Activated += OnOpenLogChatMenuItemActivated;
            _OpenLogChatMenuItem.Sensitive = false;
            _OpenLogChatMenuItem.NoShowAll = true;
            menu.Append(_OpenLogChatMenuItem);

            _CloseChatMenuItem = new Gtk.ImageMenuItem(Gtk.Stock.Close, agrp);
            _CloseChatMenuItem.Activated += OnCloseChatMenuItemActivated;
            _CloseChatMenuItem.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(_CloseChatMenuItem);

            // Menu - Engine
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Engine"));
            item.Submenu = menu;
            MenuBar.Append(item);

            item = new Gtk.MenuItem(_("_Use Local Engine"));
            item.Activated += new EventHandler(_OnUseLocalEngineButtonClicked);
            menu.Append(item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(_("_Add Remote Engine"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Menu);
            image_item.Activated += new EventHandler(_OnAddRemoteEngineButtonClicked);
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Switch Remote Engine"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu);
            image_item.Activated += new EventHandler(_OnSwitchRemoteEngineButtonClicked);
            menu.Append(image_item);

            // Menu - View
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_View"));
            item.Submenu = menu;
            MenuBar.Append(item);

            item = new Gtk.CheckMenuItem(_("_Caret Mode"));
            item.Activated += new EventHandler(_OnCaretModeButtonClicked);
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F7;
            item.AddAccelerator("activate", agrp, akey);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            item = new Gtk.CheckMenuItem(_("_Browse Mode"));
            item.Activated += delegate {
                try {
                    _Notebook.IsBrowseModeEnabled = !_Notebook.IsBrowseModeEnabled;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F8;
            item.AddAccelerator("activate", agrp, akey);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            ShowMenuBarMenuItem = new Gtk.CheckMenuItem(_("Show _Menubar"));
            ShowMenuBarMenuItem.Active = (bool) Frontend.FrontendConfig["ShowMenuBar"];
            ShowMenuBarMenuItem.Activated += OnShowMenuBarMenuItemActivated;
            menu.Append(ShowMenuBarMenuItem);

            ShowStatusBarMenuItem = new Gtk.CheckMenuItem(_("Show _Status Bar"));
            ShowStatusBarMenuItem.Active = (bool) Frontend.FrontendConfig["ShowStatusBar"];
            ShowStatusBarMenuItem.Activated += OnShowStatusBarMenuItemActivated;
            menu.Append(ShowStatusBarMenuItem);

            JoinWidget = new JoinWidget();
            JoinWidget.NoShowAll = true;
            JoinWidget.Visible = (bool) Frontend.FrontendConfig["ShowQuickJoin"];
            JoinWidget.Activated += OnJoinWidgetActivated;

            ShowQuickJoinMenuItem = new Gtk.CheckMenuItem(_("Show _Quick Join"));
            ShowQuickJoinMenuItem.Active = JoinWidget.Visible;
            ShowQuickJoinMenuItem.Activated += OnShowQuickJoinMenuItemActivated;
            menu.Append(ShowQuickJoinMenuItem);

            item = new Gtk.ImageMenuItem(Gtk.Stock.Fullscreen, agrp);
            item.Activated += delegate {
                try {
                    IsFullscreen = !IsFullscreen;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F11;
            item.AddAccelerator("activate", agrp, akey);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            // Menu - Help
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Help"));
            item.Submenu = menu;
            MenuBar.Append(item);

            image_item = new Gtk.ImageMenuItem(Gtk.Stock.About, agrp);
            image_item.Activated += new EventHandler(_OnAboutButtonClicked);
            menu.Append(image_item);

            MenuBar.ShowAll();
            MenuBar.NoShowAll = true;
            MenuBar.Visible = ShowMenuBarMenuItem.Active;

            // TODO: network treeview
            _Notebook = new Notebook();
            _Notebook.SwitchPage += OnNotebookSwitchPage;
            _Notebook.FocusInEvent += OnNotebookFocusInEvent;

            _ChatViewManager = new ChatViewManager(_Notebook, null);
            Assembly asm = Assembly.GetExecutingAssembly();
            _ChatViewManager.Load(asm);
            _ChatViewManager.LoadAll(System.IO.Path.GetDirectoryName(asm.Location),
                                     "smuxi-frontend-gnome-*.dll");
            _ChatViewManager.ChatAdded += OnChatViewManagerChatAdded;
            _ChatViewManager.ChatSynced += OnChatViewManagerChatSynced;
            _ChatViewManager.ChatRemoved += OnChatViewManagerChatRemoved;

            #if GTK_SHARP_2_10
            _StatusIconManager = new StatusIconManager(this, _ChatViewManager);
            #endif
            #if INDICATE_SHARP
            _IndicateManager = new IndicateManager(this, _ChatViewManager);
            #endif
            #if NOTIFY_SHARP
            _NotifyManager = new NotifyManager(this, _ChatViewManager);
            #endif
            #if IPC_DBUS
            _NetworkManager = new NetworkManager(_ChatViewManager);
            #endif

            _UI = new GnomeUI(_ChatViewManager);

            // HACK: Frontend.FrontendConfig out of scope
            _EngineManager = new EngineManager(Frontend.FrontendConfig, _UI);

            _Entry = new Entry(_ChatViewManager);
            var entryScrolledWindow = new Gtk.ScrolledWindow();
            entryScrolledWindow.ShadowType = Gtk.ShadowType.EtchedIn;
            entryScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Never;
            entryScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) {
                // predict and set useful heigth
                var layout = _Entry.CreatePangoLayout("Qp");
                int lineWidth, lineHeigth;
                layout.GetPixelSize(out lineHeigth, out lineHeigth);
                var text = Entry.Text;
                var newLines = text.Count(f => f == '\n');
                // cap to 1-3 lines
                if (text.Length > 0) {
                    newLines++;
                    newLines = Math.Max(newLines, 1);
                    newLines = Math.Min(newLines, 3);
                } else {
                    newLines = 1;
                }
                // use text heigth + a bit extra
                var bestSize = new Gtk.Requisition() {
                    Height = (lineHeigth * newLines) + 5
                };
                args.Requisition = bestSize;
            };
            entryScrolledWindow.Add(_Entry);

            _ProgressBar = new Gtk.ProgressBar();
            _ProgressBar.BarStyle = Gtk.ProgressBarStyle.Continuous;

            MenuHBox = new Gtk.HBox();
            MenuHBox.PackStart(MenuBar, false, false, 0);
            MenuHBox.PackEnd(JoinWidget, false, false, 0);

            Gtk.VBox vbox = new Gtk.VBox();
            vbox.PackStart(MenuHBox, false, false, 0);
            vbox.PackStart(_Notebook, true, true, 0);
            vbox.PackStart(entryScrolledWindow, false, false, 0);

            _NetworkStatusbar = new Gtk.Statusbar();
            _NetworkStatusbar.WidthRequest = 300;
            _NetworkStatusbar.HasResizeGrip = false;

            _Statusbar = new Gtk.Statusbar();
            _Statusbar.HasResizeGrip = false;

            Gtk.HBox status_bar_hbox = new Gtk.HBox();
            status_bar_hbox.Homogeneous = true;
            status_bar_hbox.PackStart(_NetworkStatusbar, false, true, 0);
            status_bar_hbox.PackStart(_Statusbar, true, true, 0);

            StatusHBox = new Gtk.HBox();
            StatusHBox.PackStart(status_bar_hbox);
            StatusHBox.PackStart(_ProgressBar, false, false, 0);
            StatusHBox.ShowAll();
            StatusHBox.NoShowAll = true;
            StatusHBox.Visible = ShowStatusBarMenuItem.Active;

            vbox.PackStart(StatusHBox, false, false, 0);
            Add(vbox);
        }
Пример #42
0
        public void LoadActions()
        {
            if (this.engineManager == null || this.engineManager.IsDisposed) {
                this.engineManager = new EngineManager(this);
            }

            this.engineManager.Clear();
            this.engineManager.Add(YuiCssEngine = new YuiCssEngine());
            this.engineManager.Add(YuiJsEngine = new YuiJsEngine());
            this.engineManager.Add(DeanEdwardsPackerEngine = new DeanEdwardsPackerEngine());
            this.engineManager.Add(ClosureCompilerEngine = new ClosureCompilerEngine());
            this.engineManager.Add(LessEngine = new LessEngine());
            this.engineManager.Add(MsJsEngine = new MsJsEngine());
            this.engineManager.Add(MsCssEngine = new MsCssEngine());
            this.engineManager.Add(ConfigEngine = new ConfigEngine());
            this.engineManager.Add(ViewEngine = new ViewEngine());
            this.engineManager.Add(T4Engine = new T4Engine());
            this.engineManager.Add(CoffeeScriptEngine = new CoffeeScriptEngine());
            this.engineManager.Add(UglifyEngine = new UglifyEngine());
            this.engineManager.Add(JSHintEngine = new JSHintEngine());
            this.engineManager.Add(CSSLintEngine = new CSSLintEngine());
            this.engineManager.Add(SassEngine = new SassEngine());
        }
Пример #43
0
        public EngineManagerDialog(EngineManager engineManager)
        {
            Trace.Call(engineManager);

            if (engineManager == null) {
                throw new ArgumentNullException("engineManager");
            }

            _EngineManager = engineManager;

            Modal = true;
            Title = "Smuxi - " + _("Engine Manager");
            SetPosition(Gtk.WindowPosition.CenterAlways);

            var connect_button = new Gtk.Button(Gtk.Stock.Connect);
            AddActionWidget(connect_button, 1);

            AddActionWidget(new Gtk.Button(Gtk.Stock.New), 3);

            Gtk.Button edit_button = new Gtk.Button(Gtk.Stock.Edit);
            _EditButton = edit_button;
            AddActionWidget(edit_button, 2);

            _DeleteButton = new Gtk.Button(Gtk.Stock.Delete);
            AddActionWidget(_DeleteButton, 4);
            AddActionWidget(new Gtk.Button(Gtk.Stock.Quit), 5);
            Response += new Gtk.ResponseHandler(_OnResponse);

            Gtk.VBox vbox = new Gtk.VBox();
            Gtk.Label label = new Gtk.Label("<b>" +
                                            _("Select which Smuxi engine you want to connect to") +
                                            "</b>");
            label.UseMarkup = true;
            vbox.PackStart(label, false, false, 5);

            Gtk.HBox hbox = new Gtk.HBox();
            hbox.PackStart(new Gtk.Label(_("Engine:")), false, false, 5);

            _ListStore = new Gtk.ListStore(typeof(string));
            _ComboBox = new Gtk.ComboBox();
            Gtk.CellRendererText cell = new Gtk.CellRendererText();
            _ComboBox.PackStart(cell, false);
            _ComboBox.AddAttribute(cell, "text", 0);
            _ComboBox.Changed += new EventHandler(_OnComboBoxChanged);
            _ComboBox.Model = _ListStore;
            _InitEngineList();

            var lowBandWidthCheckBox = new Gtk.CheckButton(_("Use Low Bandwidth Mode"));
            lowBandWidthCheckBox.Active = (bool) Frontend.FrontendConfig["UseLowBandwidthMode"];
            lowBandWidthCheckBox.Clicked += delegate {
                Frontend.FrontendConfig["UseLowBandwidthMode"] =
                    lowBandWidthCheckBox.Active;
                Frontend.FrontendConfig.Save();
            };

            hbox.PackStart(_ComboBox, true, true, 10);

            vbox.PackStart(hbox, false, false, 10);
            vbox.PackStart(lowBandWidthCheckBox);

            VBox.Add(vbox);

            ShowAll();
        }
Пример #44
0
        public MainWindow()
            : base("Smuxi")
        {
            // restore window size / position
            int width, heigth;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"] != null) {
                width  = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"];
            } else {
                width = 800;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"] != null) {
                heigth = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"];
            } else {
                heigth = 600;
            }
            if (width < -1 || heigth < -1) {
                width = -1;
                heigth = -1;
            }
            if (width == -1 && heigth == -1) {
                SetDefaultSize(800, 600);
                Maximize();
            } else if (width == 0 && heigth == 0) {
                // HACK: map 0/0 to default size as it crashes on Windows :/
                SetDefaultSize(800, 600);
            } else {
                SetDefaultSize(width, heigth);
            }

            int x, y;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"] != null) {
                x = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"];
            } else {
                x = 0;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"] != null) {
                y = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"];
            } else {
                y = 0;
            }
            if (x < 0 || y < 0) {
                x = 0;
                y = 0;
            }
            if (x == 0 && y == 0) {
                SetPosition(Gtk.WindowPosition.Center);
            } else {
                Move(x, y);
            }

            DeleteEvent += OnDeleteEvent;
            FocusInEvent += OnFocusInEvent;
            FocusOutEvent += OnFocusOutEvent;
            WindowStateEvent += OnWindowStateEvent;

            ChatTreeView = new ChatTreeView();

            Notebook = new Notebook();
            Notebook.SwitchPage += OnNotebookSwitchPage;
            Notebook.FocusInEvent += OnNotebookFocusInEvent;

            ChatViewManager = new ChatViewManager(Notebook, ChatTreeView);
            Assembly asm = Assembly.GetExecutingAssembly();
            ChatViewManager.Load(asm);
            ChatViewManager.LoadAll(System.IO.Path.GetDirectoryName(asm.Location),
                                     "smuxi-frontend-gnome-*.dll");
            ChatViewManager.ChatAdded += OnChatViewManagerChatAdded;
            ChatViewManager.ChatSynced += OnChatViewManagerChatSynced;
            ChatViewManager.ChatRemoved += OnChatViewManagerChatRemoved;

            #if GTK_SHARP_2_10
            StatusIconManager = new StatusIconManager(this, ChatViewManager);
            #endif
            #if INDICATE_SHARP || MESSAGING_MENU_SHARP
            IndicateManager = new IndicateManager(this, ChatViewManager);
            #endif
            #if NOTIFY_SHARP
            NotifyManager = new NotifyManager(this, ChatViewManager);
            #endif
            #if IPC_DBUS
            NetworkManager = new NetworkManager(ChatViewManager);
            #endif

            UI = new GnomeUI(ChatViewManager);

            // HACK: Frontend.FrontendConfig out of scope
            EngineManager = new EngineManager(Frontend.FrontendConfig, UI);

            Entry = new Entry(ChatViewManager);
            var entryScrolledWindow = new Gtk.ScrolledWindow();
            entryScrolledWindow.ShadowType = Gtk.ShadowType.EtchedIn;
            entryScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Never;
            entryScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) {
                // predict and set useful heigth
                int lineWidth, lineHeigth;
                using (var layout = Entry.CreatePangoLayout("Qp")) {
                    layout.GetPixelSize(out lineHeigth, out lineHeigth);
                }
                var it = Entry.Buffer.StartIter;
                int newLines = 1;
                // move to end of next visual line
                while (Entry.ForwardDisplayLineEnd(ref it)) {
                    newLines++;
                    // calling ForwardDisplayLineEnd repeatedly stays on the same position
                    // therefor we move one cursor position further
                    it.ForwardCursorPosition();
                }
                newLines = Math.Min(newLines, 3);
                // use text heigth + a bit extra
                var bestSize = new Gtk.Requisition() {
                    Height = (lineHeigth * newLines) + 5
                };
                args.Requisition = bestSize;
            };
            entryScrolledWindow.Add(Entry);

            ProgressBar = new Gtk.ProgressBar();
            StatusHBox = new Gtk.HBox();

            MenuWidget = new MenuWidget(this, ChatViewManager);

            var treeviewScrolledWindow = new Gtk.ScrolledWindow() {
                ShadowType = Gtk.ShadowType.EtchedIn,
                HscrollbarPolicy = Gtk.PolicyType.Never,
                VscrollbarPolicy = Gtk.PolicyType.Automatic
            };
            treeviewScrolledWindow.Add(ChatTreeView);
            ChatViewManager.ChatAdded += (sender, e) => {
                treeviewScrolledWindow.CheckResize();
            };

            var notebookPaned = new Gtk.VPaned();
            notebookPaned.Pack1(Notebook, true, false);
            notebookPaned.Pack2(entryScrolledWindow, false, false);

            var treeviewPaned = new Gtk.HPaned();
            treeviewPaned.Pack1(treeviewScrolledWindow, false, false);
            treeviewPaned.Pack2(notebookPaned, true, false);
            TreeViewHPaned = treeviewPaned;

            var entryPaned = new Gtk.VPaned();
            entryPaned.ButtonPressEvent += (sender, e) => {
                // reset entry size on double click
                if (e.Event.Type == Gdk.EventType.TwoButtonPress &&
                    e.Event.Button == 1) {
                    GLib.Timeout.Add(100, delegate {
                        entryPaned.Position = -1;
                        return false;
                    });
                }
            };
            entryPaned.Pack1(treeviewPaned, true, false);

            Gtk.VBox vbox = new Gtk.VBox();
            vbox.PackStart(MenuWidget, false, false, 0);
            vbox.PackStart(entryPaned, true, true, 0);

            NetworkStatusbar = new Gtk.Statusbar();
            NetworkStatusbar.WidthRequest = 300;
            NetworkStatusbar.HasResizeGrip = false;

            Statusbar = new Gtk.Statusbar();
            Statusbar.HasResizeGrip = false;

            Gtk.HBox status_bar_hbox = new Gtk.HBox();
            status_bar_hbox.Homogeneous = true;
            status_bar_hbox.PackStart(NetworkStatusbar, false, true, 0);
            status_bar_hbox.PackStart(Statusbar, true, true, 0);

            StatusHBox.PackStart(status_bar_hbox);
            StatusHBox.PackStart(ProgressBar, false, false, 0);
            StatusHBox.ShowAll();
            StatusHBox.NoShowAll = true;
            StatusHBox.Visible = (bool) Frontend.FrontendConfig["ShowStatusBar"];

            vbox.PackStart(StatusHBox, false, false, 0);
            Add(vbox);
        }
Пример #45
0
	virtual protected void Start()
	{
		mManager = GetComponent<EngineManager>();
	}
Пример #46
0
        public MainWindow()
            : base("Smuxi")
        {
            // restore window size / position
            int width, heigth;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"] != null) {
                width  = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"];
            } else {
                width = 800;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"] != null) {
                heigth = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"];
            } else {
                heigth = 600;
            }
            if (width < -1 || heigth < -1) {
                width = -1;
                heigth = -1;
            }
            if (width == -1 && heigth == -1) {
                SetDefaultSize(800, 600);
                Maximize();
            } else if (width == 0 && heigth == 0) {
                // HACK: map 0/0 to default size as it crashes on Windows :/
                SetDefaultSize(800, 600);
            } else {
                SetDefaultSize(width, heigth);
            }

            int x, y;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"] != null) {
                x = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"];
            } else {
                x = 0;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"] != null) {
                y = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"];
            } else {
                y = 0;
            }
            if (x < 0 || y < 0) {
                x = 0;
                y = 0;
            }
            if (x == 0 && y == 0) {
                SetPosition(Gtk.WindowPosition.Center);
            } else {
                Move(x, y);
            }

            DeleteEvent += OnDeleteEvent;
            FocusInEvent += OnFocusInEvent;
            FocusOutEvent += OnFocusOutEvent;
            WindowStateEvent += OnWindowStateEvent;

            // TODO: network treeview
            Notebook = new Notebook();
            Notebook.SwitchPage += OnNotebookSwitchPage;
            Notebook.FocusInEvent += OnNotebookFocusInEvent;

            ChatViewManager = new ChatViewManager(Notebook, null);
            Assembly asm = Assembly.GetExecutingAssembly();
            ChatViewManager.Load(asm);
            ChatViewManager.LoadAll(System.IO.Path.GetDirectoryName(asm.Location),
                                     "smuxi-frontend-gnome-*.dll");
            ChatViewManager.ChatAdded += OnChatViewManagerChatAdded;
            ChatViewManager.ChatSynced += OnChatViewManagerChatSynced;
            ChatViewManager.ChatRemoved += OnChatViewManagerChatRemoved;

            #if GTK_SHARP_2_10
            StatusIconManager = new StatusIconManager(this, ChatViewManager);
            #endif
            #if INDICATE_SHARP
            IndicateManager = new IndicateManager(this, ChatViewManager);
            #endif
            #if NOTIFY_SHARP
            NotifyManager = new NotifyManager(this, ChatViewManager);
            #endif
            #if IPC_DBUS
            NetworkManager = new NetworkManager(ChatViewManager);
            #endif

            UI = new GnomeUI(ChatViewManager);

            // HACK: Frontend.FrontendConfig out of scope
            EngineManager = new EngineManager(Frontend.FrontendConfig, UI);

            Entry = new Entry(ChatViewManager);
            var entryScrolledWindow = new Gtk.ScrolledWindow();
            entryScrolledWindow.ShadowType = Gtk.ShadowType.EtchedIn;
            entryScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Never;
            entryScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) {
                // predict and set useful heigth
                var layout = Entry.CreatePangoLayout("Qp");
                int lineWidth, lineHeigth;
                layout.GetPixelSize(out lineWidth, out lineHeigth);
                var text = Entry.Text;
                var newLines = text.Count(f => f == '\n');
                // cap to 1-3 lines
                if (text.Length > 0) {
                    newLines++;
                    newLines = Math.Max(newLines, 1);
                    newLines = Math.Min(newLines, 3);
                } else {
                    newLines = 1;
                }
                // use text heigth + a bit extra
                var bestSize = new Gtk.Requisition() {
                    Height = (lineHeigth * newLines) + 5
                };
                args.Requisition = bestSize;
            };
            entryScrolledWindow.Add(Entry);

            ProgressBar = new Gtk.ProgressBar();
            StatusHBox = new Gtk.HBox();

            MenuWidget = new MenuWidget(this, ChatViewManager);

            Gtk.VBox vbox = new Gtk.VBox();
            vbox.PackStart(MenuWidget, false, false, 0);
            vbox.PackStart(Notebook, true, true, 0);
            vbox.PackStart(entryScrolledWindow, false, false, 0);

            NetworkStatusbar = new Gtk.Statusbar();
            NetworkStatusbar.WidthRequest = 300;
            NetworkStatusbar.HasResizeGrip = false;

            Statusbar = new Gtk.Statusbar();
            Statusbar.HasResizeGrip = false;

            Gtk.HBox status_bar_hbox = new Gtk.HBox();
            status_bar_hbox.Homogeneous = true;
            status_bar_hbox.PackStart(NetworkStatusbar, false, true, 0);
            status_bar_hbox.PackStart(Statusbar, true, true, 0);

            StatusHBox.PackStart(status_bar_hbox);
            StatusHBox.PackStart(ProgressBar, false, false, 0);
            StatusHBox.ShowAll();
            StatusHBox.NoShowAll = true;
            StatusHBox.Visible = (bool) Frontend.FrontendConfig["ShowStatusBar"];

            vbox.PackStart(StatusHBox, false, false, 0);
            Add(vbox);

            if (Frontend.IsMacOSX) {
                IgeMacMenu.GlobalKeyHandlerEnabled = true;
                IgeMacMenu.MenuBar = MenuWidget.MenuBar;
                ShowMenuBar = false;

                var appGroup = IgeMacMenu.AddAppMenuGroup();
                appGroup.AddMenuItem(
                    (Gtk.MenuItem) MenuWidget.PreferencesAction.CreateMenuItem(),
                    _("Preferences")
                );
                IgeMacMenu.QuitMenuItem = (Gtk.MenuItem)
                    MenuWidget.QuitAction.CreateMenuItem();
            }
        }