Esempio n. 1
0
    public void UpdateUI()
    {
        Title = string.Format("{0}{1} ({2} for {3})", appPal.PaletteName,
                              appPal.Dirty ? "*" : "", GetSelectedScheme().Name,
                              app.Color.ToHtml());

        var selected = treeview1.Selection.CountSelectedRows() > 0;
        var hasItems = appPal.Palette.Colors.Count > 0;

        goBackAction.Sensitive     = app.CanUndo();
        goForwardAction.Sensitive  = app.CanRedo();
        BrightenAction.Sensitive   = app.CanBrighten();
        DarkenAction.Sensitive     = app.CanDarken();
        SaturateAction.Sensitive   = app.CanSaturate();
        DesaturateAction.Sensitive = app.CanDesaturate();

        undoAction.Sensitive = appPal.CanUndo();
        redoAction.Sensitive = appPal.CanRedo();
        undoAction.Label     = appPal.CanUndo() ?
                               "Undo " + appPal.UndoHistory.Peek().Name : "Can't Undo";
        redoAction.Label = appPal.CanRedo() ?
                           "Redo " + appPal.RedoHistory.Peek().Name : "Can't Redo";

        cutAction.Sensitive            = selected;
        copyAction.Sensitive           = selected;
        deleteAction.Sensitive         = selected;
        RenameAction.Sensitive         = selected;
        ChangeMetadataAction.Sensitive = selected;

        saveAction.Sensitive   = hasItems;
        saveAsAction.Sensitive = hasItems;
    }
Esempio n. 2
0
        public void UpdateUI()
        {
            Text = string.Format("{0}{1} ({2} for {3})",
                                 appPal.PaletteName, appPal.Dirty ? "*" : "",
                                 schemeBox.SelectedItem.ToString(), app.Color.ToHtml());

            var hasAny      = appPal.Palette.Colors.Count > 0;
            var hasMultiple = appPal.Palette.Colors.Count > 1;
            var selected    = SelectedItems.Count() > 0;
            var canPaste    = Clipboard.ContainsData("LPC") ||
                              Clipboard.ContainsText();
            var supportsMetadata = appPal.Palette is GimpPalette ||
                                   appPal.Palette is AcbPalette || appPal.Palette is ActPalette ||
                                   appPal.Palette is NativePalette;
            var supportsColourMetadata = appPal.Palette is AcbPalette ||
                                         appPal.Palette is NativePalette;

            propertiesToolStripMenuItem.Enabled     = supportsMetadata;
            propertiesToolStripMenuItem.ToolTipText = supportsMetadata ?
                                                      "" : "This file format doesn't support metadata.";
            changeMetadataToolStripMenuItem.Enabled        = selected && supportsColourMetadata;
            changeMetadataSubmenuToolStripMenuItem.Enabled = selected && supportsColourMetadata;
            changeMetadataToolStripMenuItem.ToolTipText    = supportsColourMetadata ?
                                                             "" : "This file format doesn't support metadata.";
            changeMetadataSubmenuToolStripMenuItem.ToolTipText = supportsColourMetadata ?
                                                                 "" : "This file format doesn't support metadata.";

            saveToolStripMenuItem.Enabled       = appPal.Dirty;
            saveAsHTMLToolStripMenuItem.Enabled = hasAny;

            undoToolStripMenuItem.Enabled = appPal.CanUndo();
            redoToolStripMenuItem.Enabled = appPal.CanRedo();
            undoToolStripMenuItem.Text    = appPal.CanUndo() ?
                                            "Undo " + appPal.UndoHistory.Peek().Name : "Can't Undo";
            redoToolStripMenuItem.Text = appPal.CanRedo() ?
                                         "Redo " + appPal.RedoHistory.Peek().Name : "Can't Redo";

            backToolStripMenuItem.Enabled    = app.CanUndo();
            forwardToolStripMenuItem.Enabled = app.CanRedo();

            brightenToolStripMenuItem.Enabled   = app.CanBrighten();
            darkenToolStripMenuItem.Enabled     = app.CanDarken();
            saturateToolStripMenuItem.Enabled   = app.CanSaturate();
            desaturateToolStripMenuItem.Enabled = app.CanDesaturate();

            cutSubmenuToolStripMenuItem.Enabled    = selected;
            cutToolStripMenuItem.Enabled           = selected;
            copyPCSubmenuToolStripMenuItem.Enabled = selected;
            copyPCToolStripMenuItem.Enabled        = selected;
            deleteSubmenuToolStripMenuItem.Enabled = selected;
            deleteToolStripMenuItem.Enabled        = selected;
            renameToolStripMenuItem.Enabled        = selected;
            renameSubmenuToolStripMenuItem.Enabled = selected;
            useToolStripMenuItem.Enabled           = selected;
            useSubmenuToolStripMenuItem.Enabled    = selected;
            changeToolStripMenuItem.Enabled        = selected;
            changeSubmenuToolStripMenuItem.Enabled = selected;
            selectAllToolStripMenuItem.Enabled     = !GridView && hasAny;
            sortToolStripMenuItem.Enabled          = hasMultiple;

            pasteAcquireToolStripMenuItem.Enabled = canPaste;
            pasteToolStripMenuItem.Enabled        = canPaste;

            nativeFormatToolStripMenuItem.Enabled = !GridView;

            UpdateUIPaletteList();
        }