Ejemplo n.º 1
0
        private void MaximizeButton_Click(object sender, EventArgs e)
        {
            UtinniTitlebarButton btn = (UtinniTitlebarButton)sender;

            if (WindowState == FormWindowState.Normal)
            {
                WindowState = FormWindowState.Maximized;
                btn.SetImage(new Bitmap(Properties.Resources.maximized));
            }
            else
            {
                WindowState = FormWindowState.Normal;
                btn.SetImage(new Bitmap(Properties.Resources.maximize));
            }
        }
Ejemplo n.º 2
0
        public UtinniForm()
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);

            Padding         = new Padding(0, titleBarHeight, 0, 0);
            FormBorderStyle = FormBorderStyle.None;
            this.Icon       = Resources.TJT;

            UtinniTitlebarButton closeButton = new UtinniTitlebarButton(new Bitmap(Resources.close), Color.Red);

            closeButton.Click += CloseButton_Click;
            RightTitleBarButtons.Add(closeButton);

            base.BackColor = Colors.Primary(); // ToDo do this proper
            UpdateForeColor();
        }
Ejemplo n.º 3
0
        protected override void OnLoad(EventArgs e)
        {
            if (MinimizeBox)
            {
                UtinniTitlebarButton minimizeButton = new UtinniTitlebarButton(new Bitmap(Resources.min));
                minimizeButton.Click += MinimizeButton_Click;
                RightTitleBarButtons.Insert(1, minimizeButton);
            }

            if (MaximizeBox)
            {
                UtinniTitlebarButton maximizeButton = new UtinniTitlebarButton(new Bitmap(Resources.maximize));
                maximizeButton.Click += MaximizeButton_Click;
                RightTitleBarButtons.Insert(1, maximizeButton);
            }

            int rightButtonEdge = 0;

            foreach (UtinniTitlebarButton btn in RightTitleBarButtons)
            {
                btn.Anchor = AnchorStyles.Top | AnchorStyles.Right;
                Controls.Add(btn);

                btn.Location     = new Point(Width - rightButtonEdge - btn.Width, 2);
                rightButtonEdge += btn.Width;
            }

            int leftButtonEdge = leftTitlebarOffset;

            foreach (UtinniTitlebarButton btn in LeftTitleBarButtons)
            {
                btn.Anchor = AnchorStyles.Top | AnchorStyles.Left;
                Controls.Add(btn);
                btn.Location    = new Point(32 + leftButtonEdge, 2);
                leftButtonEdge += btn.Width;
            }

            if (IconImage != null)
            {
                IconImage = new Bitmap(IconImage, 24, 24);
            }
        }
Ejemplo n.º 4
0
        public FormMain(PluginLoader pluginLoader)
        {
            InitializeComponent();

            Width  = UtinniCore.Utinni.utinni.GetConfig().GetInt("Editor", "width");
            Height = UtinniCore.Utinni.utinni.GetConfig().GetInt("Editor", "height");

            undoRedoManager = new UndoRedoManager(OnUpdateCommandsCallback, OnUndo, OnRedo);

            foreach (IPlugin plugin in pluginLoader.Plugins)
            {
                IEditorPlugin editorPlugin = (IEditorPlugin)plugin;
                if (editorPlugin != null)
                {
                    editorPlugins.Add(editorPlugin);
                }
            }

            game = new PanelGame(pluginLoader);
            pnlGame.Controls.Add(game);

            pnlPlugins.BackColor = Colors.Primary();
            pnlPlugins.ForeColor = Colors.Font();

            tbddWindows = new UtinniTitlebarDropDownButton("Open...");

            ToolStripDropDownItem tsddItem = new ToolStripMenuItem("Log");

            tsddItem.Click += (sender, args) =>
            {
                OpenLogWindow();
            };

            tbddWindows.Menu.Items.Add(tsddItem);

            CreatePluginControls();

            tbbtnUndo = new UndoRedoTitlebarButton(this, "Undo", Resources.undo, undoRedoManager.Undo);
            tbbtnRedo = new UndoRedoTitlebarButton(this, "Redo", Resources.redo, undoRedoManager.Redo);

            tbbtnUndo.Click += TbbtnUndo_Click;
            tbbtnRedo.Click += TbbtnRedo_Click;

            LeftTitleBarButtons.Add(tbddWindows);
            LeftTitleBarButtons.Add(tbbtnUndo);
            LeftTitleBarButtons.Add(tbbtnRedo);

            formHotkeyManager.Add(new Hotkey("Undo", "Undo", "Control + Z", undoRedoManager.Undo, true));
            formHotkeyManager.Add(new Hotkey("Redo", "Redo", "Control + Y", undoRedoManager.Redo, true));
            formHotkeyManager.Add(new Hotkey("ToggleUI", "Toggle UI", "Shift + Oemtilde", ToggleFullWindowGame, true));

            formHotkeyManager.CreateSettings();
            formHotkeyManager.Load();

            InitializeEditorCallbacks(); // Initialize callbacks that are purely editor related


            UtinniTitlebarButton tbbtnHotkeyEditor = new UtinniTitlebarButton("Hotkey Editor");

            tbbtnHotkeyEditor.Click += (sender, args) =>
            {
                FormHotkeyEditor form = new FormHotkeyEditor(formHotkeyManager, editorPlugins);
                form.Show();
            };

            RightTitleBarButtons.Add(tbbtnHotkeyEditor);

            if (UtinniCore.Utinni.utinni.GetConfig().GetBool("Editor", "autoOpenLogWindow"))
            {
                OpenLogWindow();
                this.BringToFront();
                this.Focus();
            }
        }