private void onSelChangeGrid(object sender, SourceGrid.RangeRegionChangedEventArgs e)
        {
            try
            {
                SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection;
                SourceGrid.Grid g = select.Grid as SourceGrid.Grid;

                SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion();
                int[] indexes = region.GetRowsIndex();
                if (indexes.Length < 1 || indexes[0] < 1)
                {
                    _selectedAnalysis = null;
                }
                else
                {
                    _selectedAnalysis = _analyses[indexes[0] - 1];
                    // analysis name/description
                    if (null != _selectedAnalysis)
                    {
                        BoxProperties  box  = SelectedBox;
                        PackProperties pack = _selectedAnalysis.Content as PackProperties;
                        UpdateStatus(string.Empty);
                    }
                }

                graphCtrlPack.Invalidate();
                graphCtrlSolution.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }
예제 #2
0
        private void OnSelChangeGrid(object sender, EventArgs e)
        {
            try
            {
                SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection;
                SourceGrid.Grid g = select.Grid as SourceGrid.Grid;

                SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion();
                int[] indexes = region.GetRowsIndex();
                if (indexes.Length < 1 || indexes[0] < 1)
                {
                    _selectedItem = null;
                }
                else
                {
                    int iSel = indexes[0] - 1;
                    if (g == gridPallets)
                    {
                        _selectedItem = _pallets[iSel];
                    }
                }
                graphCtrl.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }
예제 #3
0
 /// <summary>
 /// Change current selection to sub script
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripButtonSubScript_Click(object sender, EventArgs e)
 {
     SourceGrid.RangeRegion        region = grid1.Selection.GetSelectionRegion();
     SourceGrid.PositionCollection poss   = region.GetCellsPositions();
     for (int i = 0; i < poss.Count; ++i)
     {
         getRichTextBoxCell(grid1, poss[i]).SelectionSubScript();
     }
 }
예제 #4
0
 public void GridCopySelectedToClipboard()
 {
     // Analyze selected range (rows/cols)
     SourceGrid.RangeRegion selRegion = grid1.Selection.GetSelectionRegion();
     int[] selRows = selRegion.GetRowsIndex();
     int[] selCols = selRegion.GetColumnsIndex();
     Array.Sort(selRows);
     Array.Sort(selCols);
     GridCopyToClipboard(selRows, selCols);
 }
예제 #5
0
 private int GetCurrentSolutionIndex()
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return(-1);
     }
     // return index
     return(indexes[0] - 1);
 }
예제 #6
0
 private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // redraw
     Draw();
 }
예제 #7
0
        private int CurrentRowIndex()
        {
            int rowIndex = -1;

            SourceGrid.RangeRegion selectedRegion = grdDetails.Selection.GetSelectionRegion();

            if ((selectedRegion != null) && (selectedRegion.GetRowsIndex().Length > 0))
            {
                rowIndex = selectedRegion.GetRowsIndex()[0];
            }

            return(rowIndex);
        }
예제 #8
0
 /// <summary>
 /// Underline current selection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripButtonUnderline_Click(object sender, EventArgs e)
 {
     SourceGrid.RangeRegion        region = grid1.Selection.GetSelectionRegion();
     SourceGrid.PositionCollection poss   = region.GetCellsPositions();
     for (int i = 0; i < poss.Count; ++i)
     {
         SourceGrid.Cells.Cell cell = grid1.GetCell(poss[i]) as SourceGrid.Cells.Cell;
         if (cell != null)
         {
             getRichTextBoxCell(grid1, poss[i]).SelectionUnderline();
         }
     }
 }
예제 #9
0
 private CasePalletSolution GetCurrentSolution()
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return(null);
     }
     else
     {
         return(gridSolutions.Rows[indexes[0]].Tag as CasePalletSolution);
     }
 }
예제 #10
0
 /// <summary>
 /// Align current selection to the right
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripButtonRight_Click(object sender, EventArgs e)
 {
     SourceGrid.RangeRegion        region = grid1.Selection.GetSelectionRegion();
     SourceGrid.PositionCollection poss   = region.GetCellsPositions();
     for (int i = 0; i < poss.Count; ++i)
     {
         SourceGrid.Cells.Cell cell = grid1.GetCell(poss[i]) as SourceGrid.Cells.Cell;
         if (cell != null)
         {
             cell.View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight;
             grid1.PerformLayout();
         }
     }
 }
예제 #11
0
 /// <summary>
 /// Change brackround color of current selection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripButtonBackgroundColor_Click(object sender, EventArgs e)
 {
     SourceGrid.RangeRegion        region = grid1.Selection.GetSelectionRegion();
     SourceGrid.PositionCollection poss   = region.GetCellsPositions();
     for (int i = 0; i < poss.Count; ++i)
     {
         SourceGrid.Cells.Cell cell = grid1.GetCell(poss[i]) as SourceGrid.Cells.Cell;
         if (cell != null)
         {
             cell.View.BackColor = backgroundColor;
             grid1.PerformLayout();
         }
     }
 }
 private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // get selected solution
     _sol = _analysis.Solutions[indexes[0] - 1];
     // redraw
     graphCtrlCase.Invalidate();
     graphCtrlPallet.Invalidate();
 }
예제 #13
0
 private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // update select/unselect button text
     UpdateSelectButtonText();
     // redraw
     graphCtrlCaseSolution.Invalidate();
     graphCtrlPalletSolution.Invalidate();
 }
예제 #14
0
 void Selection_SelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // redraw
     graphCtrlBoxesLayout.Invalidate();
     graphCtrlPallet.Invalidate();
     // update "Add solution" button status
     UpdateButtonAddSolutionStatus();
 }
예제 #15
0
 private void onGridSolutionSelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
     int[] indexes = region.GetRowsIndex();
     // no selection -> exit
     if (indexes.Length == 0)
     {
         return;
     }
     // get selected solution
     _sol = _analysis.Solutions[indexes[0] - 1];
     // update select/unselect button text
     UpdateSelectButtonText();
     // redraw
     Draw();
 }
예제 #16
0
 void Selection_SelectionChanged(object sender, SourceGrid.RangeRegionChangedEventArgs e)
 {
     try
     {
         SourceGrid.RangeRegion region = gridSolutions.Selection.GetSelectionRegion();
         int[] indexes = region.GetRowsIndex();
         // no selection -> exit
         if (indexes.Length == 0)
         {
             return;
         }
         // redraw
         Draw();
         // update "Add solution" button status
         UpdateToolbarButtons();
     }
     catch (Exception ex) { _log.Error(ex.ToString()); }
 }
예제 #17
0
        private void OnSelChangeGrid(object sender, SourceGrid.RangeRegionChangedEventArgs e)
        {
            try
            {
                SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection;
                SourceGrid.Grid g = select.Grid as SourceGrid.Grid;

                SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion();
                int[] indexes = region.GetRowsIndex();
                if (indexes.Length < 1 || indexes[0] < 1)
                {
                    _selectedAnalysis = null;
                }
                else
                {
                    _selectedAnalysis = _analyses[indexes[0] - 1];
                    // analysis name/description
                    if (null != _selectedAnalysis)
                    {
                        BoxProperties  box  = SelectedBox;
                        PackProperties pack = _selectedAnalysis.Content as PackProperties;
                        AnalysisName = string.Format("Analysis_{0}x{1}x{2}_{3}_on_{4}",
                                                     pack.Dim0, pack.Dim1, pack.Dim2, box.Name, _selectedAnalysis.Container.Name);
                        AnalysisDescription = string.Format("Packing {0}x{1}x{2} {3} on {4}",
                                                            pack.Dim0, pack.Dim1, pack.Dim2, box.Name, _selectedAnalysis.Container.Name);

                        UpdateStatus(string.Empty);
                    }
                    else
                    {
                        AnalysisName        = string.Empty;
                        AnalysisDescription = string.Empty;
                    }
                }

                graphCtrlPack.Invalidate();
                graphCtrlSolution.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }
예제 #18
0
        private void onSelChangeGrid(object sender, SourceGrid.RangeRegionChangedEventArgs e)
        {
            try
            {
                SourceGrid.Selection.RowSelection select = sender as SourceGrid.Selection.RowSelection;
                SourceGrid.Grid g = select.Grid as SourceGrid.Grid;

                SourceGrid.RangeRegion region = g.Selection.GetSelectionRegion();
                int[] indexes = region.GetRowsIndex();
                if (indexes.Length < 1 || indexes[0] < 1)
                {
                    _selectedAnalysis = null;
                }
                else
                {
                    _selectedAnalysis = _analyses[indexes[0] - 1];
                    // analysis name/description
                    if (null != _selectedAnalysis)
                    {
                        AnalysisName        = string.Format("Analysis_{0}_in_{1}", _selectedAnalysis.Content.Name, _selectedAnalysis.Container.Name);
                        AnalysisDescription = string.Format(" Packing {0} in {1}", _selectedAnalysis.Content.Name, _selectedAnalysis.Container.Name);
                    }
                    else
                    {
                        AnalysisName        = string.Empty;
                        AnalysisDescription = string.Empty;
                    }
                }
                // update drawing
                graphCtrl.Invalidate();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
        }