Пример #1
0
        // check whether active MDIChild is a ImageWindow and sets up availability menu fields
        public void check(object sender = null, EventArgs e = null)
        {
            if (ActiveMdiChild is ImageWindow)
            {
                aiw = (ImageWindow)ActiveMdiChild;

                // Menu image
                MenuImage.Enabled = true;

                if (aiw.checkUndo())
                {
                    MenuImage_Undo.Enabled = true;                  // if exists previous version of image
                }
                else
                {
                    MenuImage_Undo.Enabled = false;
                }

                MenuImage_Duplicate.Enabled = true;
                MenuImage_Histogram.Enabled = true;

                // Menu file
                MenuFile_SaveAs.Enabled = true;
                if (aiw.getFilepath() != null)
                {
                    MenuFile_Save.Enabled = true;                            // if image was opened, not duplicated
                }
                else
                {
                    MenuFile_Save.Enabled = false;
                }

                // Menu operations
                MenuOperations.Enabled = true;

                MenuOper_Calculation.Enabled = true;
                MenuOper_Filters.Enabled     = true;

                // adjustment submenu
                MenuOper_Adj_Gamma.Enabled      = true;
                MenuOper_Adj_Contrast.Enabled   = true;
                MenuOper_Adj_Brightness.Enabled = true;
                MenuOper_Adj_Greyscale.Enabled  = true;
                MenuOper_Adj_Negative.Enabled   = true;
                MenuOper_Adj_Treshold.Enabled   = true;
                MenuOper_Adj_Posterize.Enabled  = true;

                // equalization submenu
                MenuOper_Equ_Average.Enabled  = true;
                MenuOper_Equ_Random.Enabled   = true;
                MenuOper_Equ_Neighbor.Enabled = true;



                return;
            }
            aiw = null;

            // Menu image
            MenuImage.Enabled = false;

            MenuImage_Undo.Enabled = false;

            MenuImage_Duplicate.Enabled = false;
            MenuImage_Histogram.Enabled = false;

            // Menu file
            MenuFile_SaveAs.Enabled = false;
            MenuFile_Save.Enabled   = false;

            // Menu operations
            MenuOperations.Enabled = false;

            MenuOper_Calculation.Enabled = false;
            MenuOper_Filters.Enabled     = false;

            // adjustment submenu
            MenuOper_Adj_Gamma.Enabled      = false;
            MenuOper_Adj_Contrast.Enabled   = false;
            MenuOper_Adj_Brightness.Enabled = false;
            MenuOper_Adj_Greyscale.Enabled  = false;
            MenuOper_Adj_Negative.Enabled   = false;
            MenuOper_Adj_Treshold.Enabled   = false;
            MenuOper_Adj_Posterize.Enabled  = false;

            // equalization submenu
            MenuOper_Equ_Average.Enabled  = false;
            MenuOper_Equ_Random.Enabled   = false;
            MenuOper_Equ_Neighbor.Enabled = false;
        }
Пример #2
0
        // check whether active MDIChild is a ImageWindow and sets up availability menu fields
        public void check(object sender=null, EventArgs e=null)
        {
            if (ActiveMdiChild is ImageWindow)
            {
                aiw = (ImageWindow)ActiveMdiChild;
                
                // Menu image
                MenuImage.Enabled = true;

                if (aiw.checkUndo()) MenuImage_Undo.Enabled = true; // if exists previous version of image
                else MenuImage_Undo.Enabled = false;

                MenuImage_Duplicate.Enabled = true;
                MenuImage_Histogram.Enabled = true;
                
                // Menu file
                MenuFile_SaveAs.Enabled = true;
                if (aiw.getFilepath() != null) MenuFile_Save.Enabled = true; // if image was opened, not duplicated
                else MenuFile_Save.Enabled = false;

                // Menu operations
                MenuOperations.Enabled = true;

                MenuOper_Calculation.Enabled = true;
                MenuOper_Filters.Enabled = true;
                
                // adjustment submenu
                MenuOper_Adj_Gamma.Enabled = true;
                MenuOper_Adj_Contrast.Enabled = true;
                MenuOper_Adj_Brightness.Enabled = true;
                MenuOper_Adj_Greyscale.Enabled = true;
                MenuOper_Adj_Negative.Enabled = true;
                MenuOper_Adj_Treshold.Enabled = true;
                MenuOper_Adj_Posterize.Enabled = true;

                // equalization submenu
                MenuOper_Equ_Average.Enabled = true;
                MenuOper_Equ_Random.Enabled = true;
                MenuOper_Equ_Neighbor.Enabled = true;
                

                

                return;
            }
            aiw = null;

            // Menu image
            MenuImage.Enabled = false;

            MenuImage_Undo.Enabled = false;

            MenuImage_Duplicate.Enabled = false;
            MenuImage_Histogram.Enabled = false;

            // Menu file
            MenuFile_SaveAs.Enabled = false;
            MenuFile_Save.Enabled = false;

            // Menu operations
            MenuOperations.Enabled = false;

            MenuOper_Calculation.Enabled = false;
            MenuOper_Filters.Enabled = false;

            // adjustment submenu
            MenuOper_Adj_Gamma.Enabled = false;
            MenuOper_Adj_Contrast.Enabled = false;
            MenuOper_Adj_Brightness.Enabled = false;
            MenuOper_Adj_Greyscale.Enabled = false;
            MenuOper_Adj_Negative.Enabled = false;
            MenuOper_Adj_Treshold.Enabled = false;
            MenuOper_Adj_Posterize.Enabled = false;

            // equalization submenu
            MenuOper_Equ_Average.Enabled = false;
            MenuOper_Equ_Random.Enabled = false;
            MenuOper_Equ_Neighbor.Enabled = false;
        }
Пример #3
0
 private void MenuFile_Save_Click(object sender, EventArgs e) // save open file - available for open, not duplicated images
 {
     aiw.getBitmap().Save(aiw.getFilepath());
 }