Ejemplo n.º 1
0
        /// <summary>
        /// Изменение подсказки EXIF при смене языка.
        /// </summary>
        /// <param name="result"></param>
        public void UpdateExifTooltip(CoreResult result)
        {
            if (result.type == CoreDll.ResultType.None)
            {
                throw new Exception("Bad result type!");
            }

            switch (m_position)
            {
            case Position.Left:
            case Position.Top:
                if (result.first.exifInfo.isEmpty == CoreDll.FALSE)
                {
                    SetExifTooltip(result.first);
                }
                break;

            case Position.Right:
            case Position.Bottom:
                if (result.second.exifInfo.isEmpty == CoreDll.FALSE)
                {
                    SetExifTooltip(result.second);
                }
                break;
            }
        }
Ejemplo n.º 2
0
 private void AddCommon(CoreResult result, ResultsOptions.ColumnOptions[] options)
 {
     if (options[(int)TypeVertical.Type].visible)
     {
         Append(result.type);
     }
     if (options[(int)TypeVertical.Group].visible)
     {
         Append(result.group);
     }
     if (options[(int)TypeVertical.Difference].visible)
     {
         Append(result.difference.ToString("F2"));
     }
     if (options[(int)TypeVertical.Defect].visible)
     {
         Append(result.defect);
     }
     if (options[(int)TypeVertical.Transform].visible)
     {
         Append(result.transform);
     }
     if (options[(int)TypeVertical.Hint].visible)
     {
         Append(result.hint);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Set cell defect in horizontal mode.
        /// ”становка ¤йчейки дефектов в горизонтальном режиме.
        /// </summary>
        private void SetDefectToRowHorizontal(DataGridViewCellCollection cells, CoreResult result)
        {
            for (int col = (int)ResultsListView.ColumnsTypeHorizontal.FirstFileName; col < (int)ResultsListView.ColumnsTypeHorizontal.Size; col++)
            {
                cells[col] = new DataGridViewTextBoxCell();
            }
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileName].Value             = Path.GetFileName(result.first.path);
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileDirectory].Value        = result.first.GetDirectoryString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstImageSize].Value            = result.first.GetImageSizeString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstImageType].Value            = result.first.GetImageTypeString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlockiness].Value           = result.first.GetBlockinessString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlockiness].Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlurring].Value             = result.first.GetBlurringString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlurring].Style.Alignment   = DataGridViewContentAlignment.MiddleRight;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileSize].Value             = result.first.GetFileSizeString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileSize].Style.Alignment   = DataGridViewContentAlignment.MiddleRight;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileTime].Value             = result.first.GetFileTimeString();

            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileName].Value      = "";
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileDirectory].Value = "";
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondImageSize].Value     = "";
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondImageType].Value     = "";
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileSize].Value      = "";
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileTime].Value      = "";
        }
Ejemplo n.º 4
0
 public void SetCurrentSearchResult(CoreResult currentSearchResult)
 {
     m_currentSearchResult = currentSearchResult;
     m_firstImagePreviewPanel.SetResult(m_currentSearchResult);
     m_secondImagePreviewPanel.SetResult(m_currentSearchResult);
     SetDifference();
     SetHint(m_currentSearchResult.hint);
     UpdateNextAndPreviousButtonEnabling();
 }
Ejemplo n.º 5
0
        private void CurrentResultChanged()
        {
            CoreResult result = m_mainSplitContainer.resultsListView.GetCurrentResult();
            State      state  = State.Empty;

            if (result != null)
            {
                switch (result.type)
                {
                case CoreDll.ResultType.DefectImage:
                    state = State.Defect;
                    break;

                case CoreDll.ResultType.DuplImagePair:
                    state = State.DuplPair;
                    break;
                }
            }

            switch (state)
            {
            case State.Empty:
                break;

            case State.Defect:
                m_resultsPreviewDefect.SetCurrentSearchResult(result);
                break;

            case State.DuplPair:
                m_resultsPreviewDuplPair.SetCurrentSearchResult(result);
                break;
            }

            if (state != m_state)
            {
                m_state = state;

                m_mainSplitContainer.OnCurrentResultChanged -= new MainSplitContainer.CurrentResultChangedHandler(CurrentResultChanged);
                Controls.Clear(); //Очишаем панель
                m_mainSplitContainer.OnCurrentResultChanged += new MainSplitContainer.CurrentResultChangedHandler(CurrentResultChanged);

                switch (m_state)
                {
                case State.Empty:
                    break;

                case State.Defect:
                    Controls.Add(m_resultsPreviewDefect);
                    break;

                case State.DuplPair:
                    Controls.Add(m_resultsPreviewDuplPair);
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        public void Set(CoreResult result, DataGridViewCustomRow row)
        {
            switch (result.type)
            {
            case CoreDll.ResultType.DefectImage:
                SetDefectToRow(row.Cells, result);
                break;

            case CoreDll.ResultType.DuplImagePair:
                SetDuplPairToRow(row.Cells, result);
                break;
            }
        }
Ejemplo n.º 7
0
        private void AddVertical(CoreResult result, ResultsOptions.ColumnOptions[] options)
        {
            if (options[(int)TypeVertical.FileName].visible ||
                options[(int)TypeVertical.FileDirectory].visible)
            {
                Append(result.first.path);
            }
            if (options[(int)TypeVertical.ImageSize].visible)
            {
                Append(result.first.GetImageSizeString());
            }
            if (options[(int)TypeVertical.ImageType].visible)
            {
                Append(result.first.GetImageTypeString());
            }
            if (options[(int)TypeVertical.FileSize].visible)
            {
                Append(result.first.GetFileSizeString());
            }
            if (options[(int)TypeVertical.FileTime].visible)
            {
                Append(result.first.GetFileTimeString());
            }

            if (options[(int)TypeVertical.FileName].visible ||
                options[(int)TypeVertical.FileDirectory].visible)
            {
                Append(result.second.path);
            }
            if (options[(int)TypeVertical.ImageSize].visible)
            {
                Append(result.second.GetImageSizeString());
            }
            if (options[(int)TypeVertical.ImageType].visible)
            {
                Append(result.second.GetImageTypeString());
            }
            if (options[(int)TypeVertical.FileSize].visible)
            {
                Append(result.second.GetFileSizeString());
            }
            if (options[(int)TypeVertical.FileTime].visible)
            {
                Append(result.second.GetFileTimeString());
            }
        }
Ejemplo n.º 8
0
        public void Add(CoreResult result)
        {
            m_insertTab = false;
            switch (m_options.viewMode)
            {
            case ResultsOptions.ViewMode.VerticalPairTable:
                AddCommon(result, m_options.columnOptionsVertical);
                AddVertical(result, m_options.columnOptionsVertical);
                break;

            case ResultsOptions.ViewMode.HorizontalPairTable:
                AddCommon(result, m_options.columnOptionsHorizontal);
                AddHorizontal(result, m_options.columnOptionsHorizontal);
                break;
            }
            m_builder.AppendLine("");
        }
Ejemplo n.º 9
0
        public void SetResult(CoreResult result)
        {
            if (result.type == CoreDll.ResultType.None)
            {
                throw new Exception("Bad result type!");
            }

            m_group = result.group;

            switch (m_position)
            {
            case Position.Left:
            case Position.Top:
                if (result.type == CoreDll.ResultType.DuplImagePair)
                {
                    SetImageInfo(result.first, result.second);
                }
                else
                {
                    SetImageInfo(result.first, null);
                }

                break;

            case Position.Right:
            case Position.Bottom:
                if (result.type == CoreDll.ResultType.DuplImagePair)
                {
                    SetImageInfo(result.second, result.first);
                }
                else
                {
                    SetImageInfo(result.second, null);
                }
                break;
            }
        }
Ejemplo n.º 10
0
        public CoreResult[] GetResult(uint startFrom, uint size)
        {
            uint resultSize = GetResultSize();

            if (resultSize > startFrom)
            {
                object resultObject = new CoreDll.adResultW();
                int    sizeOfResult = Marshal.SizeOf(resultObject);
                byte[] buffer       = new byte[sizeOfResult * PAGE_SIZE];
                size = Math.Min(resultSize - startFrom, size);
                CoreResult[] results   = new CoreResult[size];
                uint         pageCount = (uint)(size / PAGE_SIZE + (size % PAGE_SIZE > 0 ? 1 : 0));
                for (uint page = 0; page < pageCount; ++page)
                {
                    UIntPtr[] pStartFrom = new UIntPtr[1];
                    pStartFrom[0] = new UIntPtr(startFrom + page * PAGE_SIZE);

                    UIntPtr[] pSize = new UIntPtr[1];
                    pSize[0] = new UIntPtr(PAGE_SIZE);

                    if (m_dll.adResultGetW(m_handle, Marshal.UnsafeAddrOfPinnedArrayElement(pStartFrom, 0),
                                           Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0),
                                           Marshal.UnsafeAddrOfPinnedArrayElement(pSize, 0)) == CoreDll.Error.Ok)
                    {
                        for (uint i = 0; i < pSize[0].ToUInt32(); ++i)
                        {
                            IntPtr            pResult = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, (int)(i * sizeOfResult));
                            CoreDll.adResultW result  = (CoreDll.adResultW)Marshal.PtrToStructure(pResult, resultObject.GetType());
                            results[page * PAGE_SIZE + i] = new CoreResult(ref result);
                        }
                    }
                }
                return(results);
            }
            return(null);
        }
Ejemplo n.º 11
0
        private void SetDuplPairToRowHorizontal(DataGridViewCellCollection cells, CoreResult result)
        {
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Type].Value = m_duplPairHorizontalIcon;

            switch (result.hint)
            {
            case CoreDll.HintType.DeleteFirst:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Hint].Value = m_deleteFirstHorizontalIcon;
                break;

            case CoreDll.HintType.DeleteSecond:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Hint].Value = m_deleteSecondHorizontalIcon;
                break;

            case CoreDll.HintType.RenameFirstToSecond:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Hint].Value = m_renameFirstToSecondHorizontalIcon;
                break;

            case CoreDll.HintType.RenameSecondToFirst:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Hint].Value = m_renameSecondToFirstHorizontalIcon;
                break;
            }

            for (int col = (int)ResultsListView.ColumnsTypeHorizontal.FirstFileName; col < (int)ResultsListView.ColumnsTypeHorizontal.Size; col++)
            {
                cells[col] = new DataGridViewTextBoxCell();
            }
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileName].Value             = Path.GetFileName(result.first.path);
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileDirectory].Value        = result.first.GetDirectoryString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstImageSize].Value            = result.first.GetImageSizeString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstImageType].Value            = result.first.GetImageTypeString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlockiness].Value           = result.first.GetBlockinessString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlockiness].Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlurring].Value             = result.first.GetBlurringString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlurring].Style.Alignment   = DataGridViewContentAlignment.MiddleRight;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileSize].Value             = result.first.GetFileSizeString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileSize].Style.Alignment   = DataGridViewContentAlignment.MiddleRight;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileTime].Value             = result.first.GetFileTimeString();

            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileName].Value             = Path.GetFileName(result.second.path);
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileDirectory].Value        = result.second.GetDirectoryString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondImageSize].Value            = result.second.GetImageSizeString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondImageType].Value            = result.second.GetImageTypeString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondBlockiness].Value           = result.second.GetBlockinessString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondBlockiness].Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondBlurring].Value             = result.second.GetBlurringString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondBlurring].Style.Alignment   = DataGridViewContentAlignment.MiddleRight;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileSize].Value             = result.second.GetFileSizeString();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileSize].Style.Alignment   = DataGridViewContentAlignment.MiddleRight;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileTime].Value             = result.second.GetFileTimeString();

            if (result.first.height * result.first.width > result.second.height * result.second.width) //подсветка highlight
            {
                cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstImageSize].Style.ForeColor  = m_dataGridView.DefaultCellStyle.ForeColor;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondImageSize].Style.ForeColor = Color.Red;
            }
            else if (result.first.height * result.first.width < result.second.height * result.second.width)
            {
                cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstImageSize].Style.ForeColor  = Color.Red;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondImageSize].Style.ForeColor = m_dataGridView.DefaultCellStyle.ForeColor;
            }

            if (result.first.size > result.second.size)
            {
                cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileSize].Style.ForeColor  = m_dataGridView.DefaultCellStyle.ForeColor;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileSize].Style.ForeColor = Color.Red;
            }
            else if (result.first.size < result.second.size)
            {
                cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstFileSize].Style.ForeColor  = Color.Red;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondFileSize].Style.ForeColor = m_dataGridView.DefaultCellStyle.ForeColor;
            }

            if (result.first.blockiness > result.second.blockiness)
            {
                cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlockiness].Style.ForeColor  = Color.Red;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondBlockiness].Style.ForeColor = m_dataGridView.DefaultCellStyle.ForeColor;
            }
            else if (result.first.blockiness < result.second.blockiness)
            {
                cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlockiness].Style.ForeColor  = m_dataGridView.DefaultCellStyle.ForeColor;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondBlockiness].Style.ForeColor = Color.Red;
            }

            if (result.first.blurring > result.second.blurring)
            {
                cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlurring].Style.ForeColor  = Color.Red;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondBlurring].Style.ForeColor = m_dataGridView.DefaultCellStyle.ForeColor;
            }
            else if (result.first.blurring < result.second.blurring)
            {
                cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstBlurring].Style.ForeColor  = m_dataGridView.DefaultCellStyle.ForeColor;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondBlurring].Style.ForeColor = Color.Red;
            }

            if (result.first.type != result.second.type)
            {
                cells[(int)ResultsListView.ColumnsTypeHorizontal.FirstImageType].Style.ForeColor  = Color.Red;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.SecondImageType].Style.ForeColor = Color.Red;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Set cell duplicate pair in vertical mode.
        /// ”становка ¤йчеек пар дубликатов в вертикальном режиме.
        /// </summary>
        private void SetDuplPairToRowVertical(DataGridViewCellCollection cells, CoreResult result)
        {
            cells[(int)ResultsListView.ColumnsTypeVertical.Type].Value = m_duplPairVerticalIcon;

            switch (result.hint)
            {
            case CoreDll.HintType.DeleteFirst:
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].Value = m_deleteFirstVerticalIcon;
                break;

            case CoreDll.HintType.DeleteSecond:
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].Value = m_deleteSecondVerticalIcon;
                break;

            case CoreDll.HintType.RenameFirstToSecond:
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].Value = m_renameFirstToSecondVerticalIcon;
                break;

            case CoreDll.HintType.RenameSecondToFirst:
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].Value = m_renameSecondToFirstVerticalIcon;
                break;
            }

            DataGridViewDoubleTextBoxCell doubleCell;

            cells[(int)ResultsListView.ColumnsTypeVertical.FileName] = new DataGridViewDoubleTextBoxCell(
                Path.GetFileName(result.first.path), Path.GetFileName(result.second.path));
            cells[(int)ResultsListView.ColumnsTypeVertical.FileDirectory] = new DataGridViewDoubleTextBoxCell(
                result.first.GetDirectoryString(), result.second.GetDirectoryString());

            doubleCell = new DataGridViewDoubleTextBoxCell(result.first.GetImageSizeString(), result.second.GetImageSizeString());
            if (result.first.height * result.first.width > result.second.height * result.second.width)
            {
                doubleCell.markType = DataGridViewDoubleTextBoxCell.MarkType.Second;
            }
            else if (result.first.height * result.first.width < result.second.height * result.second.width)
            {
                doubleCell.markType = DataGridViewDoubleTextBoxCell.MarkType.First;
            }
            cells[(int)ResultsListView.ColumnsTypeVertical.ImageSize] = doubleCell;

            doubleCell = new DataGridViewDoubleTextBoxCell(result.first.GetImageTypeString(), result.second.GetImageTypeString());
            if (result.first.type != result.second.type)
            {
                doubleCell.markType = DataGridViewDoubleTextBoxCell.MarkType.Both;
            }
            cells[(int)ResultsListView.ColumnsTypeVertical.ImageType] = doubleCell;

            doubleCell = new DataGridViewDoubleTextBoxCell(result.first.GetFileSizeString(), result.second.GetFileSizeString());
            if (result.first.size > result.second.size)
            {
                doubleCell.markType = DataGridViewDoubleTextBoxCell.MarkType.Second;
            }
            else if (result.first.size < result.second.size)
            {
                doubleCell.markType = DataGridViewDoubleTextBoxCell.MarkType.First;
            }
            cells[(int)ResultsListView.ColumnsTypeVertical.FileSize] = doubleCell;
            cells[(int)ResultsListView.ColumnsTypeVertical.FileSize].Style.Alignment = DataGridViewContentAlignment.MiddleRight;

            doubleCell = new DataGridViewDoubleTextBoxCell(result.first.GetBlockinessString(), result.second.GetBlockinessString());
            if (result.first.blockiness > result.second.blockiness) //подсветка highlight
            {
                doubleCell.markType = DataGridViewDoubleTextBoxCell.MarkType.First;
            }
            else if (result.first.blockiness < result.second.blockiness)
            {
                doubleCell.markType = DataGridViewDoubleTextBoxCell.MarkType.Second;
            }
            cells[(int)ResultsListView.ColumnsTypeVertical.Blockiness] = doubleCell;
            cells[(int)ResultsListView.ColumnsTypeVertical.Blockiness].Style.Alignment = DataGridViewContentAlignment.MiddleRight;

            doubleCell = new DataGridViewDoubleTextBoxCell(result.first.GetBlurringString(), result.second.GetBlurringString());
            if (result.first.blurring > result.second.blurring)
            {
                doubleCell.markType = DataGridViewDoubleTextBoxCell.MarkType.First;
            }
            else if (result.first.blurring < result.second.blurring)
            {
                doubleCell.markType = DataGridViewDoubleTextBoxCell.MarkType.Second;
            }
            cells[(int)ResultsListView.ColumnsTypeVertical.Blurring] = doubleCell;
            cells[(int)ResultsListView.ColumnsTypeVertical.Blurring].Style.Alignment = DataGridViewContentAlignment.MiddleRight;

            cells[(int)ResultsListView.ColumnsTypeVertical.FileTime] = new DataGridViewDoubleTextBoxCell(result.first.GetFileTimeString(), result.second.GetFileTimeString());
        }
Ejemplo n.º 13
0
        private void SetDuplPairToRow(DataGridViewCellCollection cells, CoreResult result)
        {
            if (result.type != CoreDll.ResultType.DuplImagePair)
            {
                throw new Exception("Bad result type!");
            }

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Type] = new DataGridViewImageCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Type].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Type].ToolTipText     = m_duplPairIconToolTipText;

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Group]                 = new DataGridViewTextBoxCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Group].Value           = (result.group == -1 ? "" : result.group.ToString());
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Group].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

            cells[(int)ResultsListView.ColumnsTypeHorizontal.GroupSize]                 = new DataGridViewTextBoxCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.GroupSize].Value           = (result.groupSize == -1 ? "" : result.groupSize.ToString());
            cells[(int)ResultsListView.ColumnsTypeHorizontal.GroupSize].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Difference]            = new DataGridViewTextBoxCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Difference].Value      = result.difference.ToString("F2");
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Difference].Style.Font =
                new Font(DataGridView.DefaultFont, result.difference == 0 ? FontStyle.Bold : FontStyle.Regular);
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Difference].Style.ForeColor =
                result.difference == 0 ? Color.LightGreen : DataGridView.DefaultForeColor;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Difference].Style.Alignment = DataGridViewContentAlignment.MiddleRight;

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect]       = new DataGridViewTextBoxCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].Value = "";

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform] = new DataGridViewImageCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            switch (result.transform)
            {
            case CoreDll.TransformType.Turn_0:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Value       = m_turn_0_Icon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].ToolTipText = m_turn_0_IconToolTipText;
                break;

            case CoreDll.TransformType.Turn_90:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Value       = m_turn_90_Icon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].ToolTipText = m_turn_90_IconToolTipText;
                break;

            case CoreDll.TransformType.Turn_180:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Value       = m_turn_180_Icon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].ToolTipText = m_turn_180_IconToolTipText;
                break;

            case CoreDll.TransformType.Turn_270:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Value       = m_turn_270_Icon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].ToolTipText = m_turn_270_IconToolTipText;
                break;

            case CoreDll.TransformType.MirrorTurn_0:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Value       = m_mirrorTurn_0_Icon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].ToolTipText = m_mirrorTurn_0_IconToolTipText;
                break;

            case CoreDll.TransformType.MirrorTurn_90:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Value       = m_mirrorTurn_90_Icon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].ToolTipText = m_mirrorTurn_90_IconToolTipText;
                break;

            case CoreDll.TransformType.MirrorTurn_180:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Value       = m_mirrorTurn_180_Icon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].ToolTipText = m_mirrorTurn_180_IconToolTipText;
                break;

            case CoreDll.TransformType.MirrorTurn_270:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Value       = m_mirrorTurn_270_Icon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].ToolTipText = m_mirrorTurn_270_IconToolTipText;
                break;
            }

            cells[(int)ResultsListView.ColumnsTypeVertical.Hint] = new DataGridViewImageCell();
            cells[(int)ResultsListView.ColumnsTypeVertical.Hint].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            switch (result.hint)
            {
            case CoreDll.HintType.DeleteFirst:
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].ToolTipText = m_deleteFirstIconToolTipText;
                break;

            case CoreDll.HintType.DeleteSecond:
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].ToolTipText = m_deleteSecondIconToolTipText;
                break;

            case CoreDll.HintType.RenameFirstToSecond:
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].ToolTipText = m_renameFirstToSecondIconToolTipText;
                break;

            case CoreDll.HintType.RenameSecondToFirst:
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].ToolTipText = m_renameSecondToFirstIconToolTipText;
                break;

            default:
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].Value       = m_nullIcon;
                cells[(int)ResultsListView.ColumnsTypeVertical.Hint].ToolTipText = "";
                break;
            }

            switch (m_options.resultsOptions.viewMode)
            {
            case ResultsOptions.ViewMode.VerticalPairTable:
                SetDuplPairToRowVertical(cells, result);
                break;

            case ResultsOptions.ViewMode.HorizontalPairTable:
                SetDuplPairToRowHorizontal(cells, result);
                break;
            }
        }
Ejemplo n.º 14
0
        private void SetDefectToRow(DataGridViewCellCollection cells, CoreResult result)
        {
            if (result.type != CoreDll.ResultType.DefectImage)
            {
                throw new Exception("Bad result type!");
            }

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Type]                 = new DataGridViewImageCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Type].Value           = m_defectIcon;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Type].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Type].ToolTipText     = m_defectIconToolTipText;

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Group]                 = new DataGridViewTextBoxCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Group].Value           = (result.group == -1 ? "" : result.group.ToString());
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Group].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

            cells[(int)ResultsListView.ColumnsTypeHorizontal.GroupSize]                 = new DataGridViewTextBoxCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.GroupSize].Value           = (result.groupSize == -1 ? "" : result.groupSize.ToString());
            cells[(int)ResultsListView.ColumnsTypeHorizontal.GroupSize].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Difference].Value = "";

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect] = new DataGridViewImageCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            switch (result.defect)
            {
            case CoreDll.DefectType.None:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].Value = m_nullIcon;
                break;

            case CoreDll.DefectType.Unknown:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].Value       = m_unknownDefectIcon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].ToolTipText = m_unknownDefectIconToolTipText;
                break;

            case CoreDll.DefectType.JpegEndMarkerIsAbsent:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].Value       = m_jpegEndMarkerIsAbsentIcon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].ToolTipText = m_jpegEndMarkerIsAbsentIconToolTipText;
                break;

            case CoreDll.DefectType.Blockiness:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].Value       = m_blockinessIcon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].ToolTipText = m_blockinessIconToolTipText;
                break;

            case CoreDll.DefectType.Blurring:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].Value       = m_blurringIcon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Defect].ToolTipText = m_blurringIconToolTipText;
                break;
            }

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform]       = new DataGridViewTextBoxCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Transform].Value = "";

            cells[(int)ResultsListView.ColumnsTypeHorizontal.Hint] = new DataGridViewImageCell();
            cells[(int)ResultsListView.ColumnsTypeHorizontal.Hint].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            switch (result.hint)
            {
            case CoreDll.HintType.DeleteFirst:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Hint].Value       = m_deleteDefectIcon;
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Hint].ToolTipText = m_deleteDefectIconToolTipText;
                break;

            default:
                cells[(int)ResultsListView.ColumnsTypeHorizontal.Hint].Value = m_nullIcon;
                break;
            }

            switch (m_options.resultsOptions.viewMode)
            {
            case ResultsOptions.ViewMode.VerticalPairTable:
                SetDefectToRowVertical(cells, result);
                break;

            case ResultsOptions.ViewMode.HorizontalPairTable:
                SetDefectToRowHorizontal(cells, result);
                break;
            }
        }
Ejemplo n.º 15
0
 public void SetCurrentSearchResult(CoreResult currentSearchResult)
 {
     m_currentSearchResult = currentSearchResult;
     m_imagePreviewPanel.SetResult(m_currentSearchResult);
     UpdateNextAndPreviousButtonEnabling();
 }