OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::GridCellSupportEditor Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/GUI_ObjectTable.hpp>

Inheritance diagram for Slic3r::GUI::GridCellSupportEditor:
Collaboration diagram for Slic3r::GUI::GridCellSupportEditor:

Public Member Functions

 GridCellSupportEditor ()
virtual void DoActivate (int row, int col, wxGrid *grid) wxOVERRIDE

Private Member Functions

void SetValueFromGrid (int row, int col, wxGrid *grid)
void SetGridFromValue (int row, int col, wxGrid *grid) const
wxString GetStringValue () const
 wxDECLARE_NO_COPY_CLASS (GridCellSupportEditor)

Static Private Member Functions

static wxString GetStringValue (bool value)

Private Attributes

bool m_value

Static Private Attributes

static wxString ms_stringValues [2] = { wxT(""), wxT("") }

Detailed Description

Constructor & Destructor Documentation

◆ GridCellSupportEditor()

Slic3r::GUI::GridCellSupportEditor::GridCellSupportEditor ( )
inline
190{ }

Referenced by wxDECLARE_NO_COPY_CLASS().

Here is the caller graph for this function:

Member Function Documentation

◆ DoActivate()

void Slic3r::GUI::GridCellSupportEditor::DoActivate ( int row,
int col,
wxGrid * grid )
virtual
597{
598 wxGridBlocks cell_array = grid->GetSelectedBlocks();
599 auto iter = cell_array.begin();
600
601 int left_col, right_col, top_row, bottom_row;
602 if (iter == cell_array.end()) {
603 // wxWidgets 3.3.x returns an empty range when nothing is selected;
604 // fall back to the cell that triggered activation so the single-cell
605 // branch below handles it.
606 left_col = right_col = col;
607 top_row = bottom_row = row;
608 } else {
609 left_col = iter->GetLeftCol();
610 right_col = iter->GetRightCol();
611 top_row = iter->GetTopRow();
612 bottom_row = iter->GetBottomRow();
613 }
614
615 if ((left_col == right_col) &&
616 (top_row == bottom_row)) {
617 wxGridCellBoolEditor::DoActivate(row, col, grid);
618 grid->SelectBlock(row, col, row, col, true);
619 return;
620 }
621 else if( (left_col == right_col) &&
622 (top_row != bottom_row)){
623
624 for (auto i = top_row; i <= bottom_row; i++) {
625 //grid->GetTable()->SetValueAsBool(i, left_col, false);
626 wxGridCellBoolEditor::DoActivate(i, left_col, grid);
627 }
628 }
629
630 wxGridCellBoolEditor::DoActivate(row, col, grid);
631 grid->SelectBlock(row, col, row, col, true);
632}
std::vector< ArithmeticOnly< T > > grid(const T &start, const T &stop, const T &stride)
A set of equidistant values starting from 'start' (inclusive), ending in the closest multiple of 'str...
Definition MTUtils.hpp:127

References Slic3r::grid().

Here is the call graph for this function:

◆ GetStringValue() [1/2]

wxString Slic3r::GUI::GridCellSupportEditor::GetStringValue ( ) const
inlineprivate
197{ return GetStringValue(m_value); }
wxString GetStringValue() const
Definition GUI_ObjectTable.hpp:197
bool m_value
Definition GUI_ObjectTable.hpp:202

References GetStringValue(), and m_value.

Referenced by GetStringValue(), and SetGridFromValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStringValue() [2/2]

wxString Slic3r::GUI::GridCellSupportEditor::GetStringValue ( bool value)
inlinestaticprivate
200{ return ms_stringValues[value]; }
static wxString ms_stringValues[2]
Definition GUI_ObjectTable.hpp:204

References ms_stringValues.

◆ SetGridFromValue()

void Slic3r::GUI::GridCellSupportEditor::SetGridFromValue ( int row,
int col,
wxGrid * grid ) const
private
663{
664 wxGridTableBase * const table = grid->GetTable();
665 if ( table->CanSetValueAs(row, col, wxGRID_VALUE_BOOL) )
666 table->SetValueAsBool(row, col, m_value);
667 else
668 table->SetValue(row, col, GetStringValue());
669}

References GetStringValue(), Slic3r::grid(), and m_value.

Here is the call graph for this function:

◆ SetValueFromGrid()

void Slic3r::GUI::GridCellSupportEditor::SetValueFromGrid ( int row,
int col,
wxGrid * grid )
private
635{
636 if (grid->GetTable()->CanGetValueAs(row, col, wxGRID_VALUE_BOOL))
637 {
638 m_value = grid->GetTable()->GetValueAsBool(row, col);
639 }
640 else
641 {
642 wxString cellval( grid->GetTable()->GetValue(row, col) );
643
644 if ( cellval == ms_stringValues[false] )
645 m_value = false;
646 else if ( cellval == ms_stringValues[true] )
647 m_value = true;
648 else
649 {
650 // do not try to be smart here and convert it to true or false
651 // because we'll still overwrite it with something different and
652 // this risks to be very surprising for the user code, let them
653 // know about it
654 wxFAIL_MSG( wxT("invalid value for a cell with bool editor!") );
655
656 // Still need to initialize it to something.
657 m_value = false;
658 }
659 }
660}

References Slic3r::grid(), m_value, and ms_stringValues.

Here is the call graph for this function:

◆ wxDECLARE_NO_COPY_CLASS()

Slic3r::GUI::GridCellSupportEditor::wxDECLARE_NO_COPY_CLASS ( GridCellSupportEditor )
private

References GridCellSupportEditor().

Here is the call graph for this function:

Member Data Documentation

◆ m_value

bool Slic3r::GUI::GridCellSupportEditor::m_value
private

◆ ms_stringValues

wxString Slic3r::GUI::GridCellSupportEditor::ms_stringValues = { wxT(""), wxT("") }
staticprivate

Referenced by GetStringValue(), and SetValueFromGrid().


The documentation for this class was generated from the following files: