- // We first initial all the arrays EXCEPT for the m_minsizes array.
-
- memset(m_maxHeight, 0, sizeof(int) * m_cell_count.GetHeight());
- memset(m_maxWidth, 0, sizeof(int) * m_cell_count.GetWidth());
- memset(m_rowStretch, 0, sizeof(int) * m_cell_count.GetHeight());
- memset(m_colStretch, 0, sizeof(int) * m_cell_count.GetWidth());
- for (int x = 0; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++)
- {
- m_weights[x]->SetHeight(0);
- m_weights[x]->SetWidth(0);
- }
-
- wxNode *node = m_children.GetFirst();
- while (node)
- {
- wxSizerItem *item = (wxSizerItem*) node->Data();
- wxMultiCellItemHandle *rect;
- if (item != NULL &&
- (rect = (wxMultiCellItemHandle *)item->GetUserData()) != NULL)
- {
- int row = rect->GetRow();
- int col = rect->GetColumn();
-
- // First make sure that the control knows about the max rows and columns
-
- int changed = FALSE;
- if (row + 1 > m_cell_count.GetHeight())
- {
- changed++;
- m_maxHeight = (int *)realloc(m_maxHeight, (1 + row) * sizeof(int));
- m_rowStretch = (int *)realloc(m_rowStretch, (1 + row) * sizeof(int));
- for (int x = m_cell_count.GetHeight(); x < row + 1; x++)
- {
- m_maxHeight[x - 1] = 0;
- m_rowStretch[x - 1] = 0;
- }
- m_cell_count.SetHeight(row + 1);
- }
- if (col + 1 > m_cell_count.GetWidth())
- {
- changed++;
- m_maxWidth = (int *)realloc(m_maxWidth, (1 + col) * sizeof(int));
- m_colStretch = (int *)realloc(m_colStretch, ( 1 + col) * sizeof(int));
- for (int x = m_cell_count.GetWidth(); x < col + 1; x++)
- {
- m_maxWidth[x - 1] = 0;
- m_colStretch[x - 1] = 0;
- }
- m_cell_count.SetWidth(col + 1);
- }
- if (changed)
- {
- m_weights = (wxSize **)realloc(m_weights, (1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *));
- m_minSizes = (wxSize **)realloc(m_minSizes, (1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *));
- for (int x = m_maxWeights; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++)
- {
- m_weights[x - 1] = new wxSize(0,0);
- m_minSizes[x - 1] = new wxSize(0,0);
- }
- m_maxWeights = 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth());
- }
-
- // Sum the m_weights for each row/column, but only if they are resizable
-
- wxSize minSize( item->CalcMin() );
- wxSize c_size = rect->GetLocalSize();
- if (c_size.GetHeight() != wxDefaultSize.GetHeight() ||
- c_size.GetWidth() != wxDefaultSize.GetWidth())
- {
- minSize.SetHeight(wxMax(minSize.GetHeight(), c_size.GetHeight()));
- minSize.SetWidth(wxMax(minSize.GetWidth(), c_size.GetWidth()));
- }
-
- // For each row, calculate the max height for those fields which are not
- // resizable in the vertical pane
-
- if (!(rect->GetStyle() & wxVERTICAL_RESIZABLE || m_minSizes[row]->GetHeight() < 0))
- {
- m_maxHeight[row] = wxMax(m_maxHeight[row], minSize.GetHeight() / rect->GetHeight());
- }
- else
- {
- m_rowStretch[row] = 1;
- if (m_minSizes[row]->GetHeight())
- {
- m_maxHeight[row] = abs(m_minSizes[row]->GetHeight());
- }
- else
- {
- m_maxHeight[row] = wxMax(m_maxHeight[row], m_defaultCellSize.GetHeight());
- }
- m_weights[row]->SetHeight(wxMax(m_weights[row]->GetHeight(), rect->GetWeight().GetHeight()));
- }
-
- // For each column, calculate the max width for those fields which are not
- // resizable in the horizontal pane
-
- if (!(rect->GetStyle() & wxHORIZENTAL_RESIZABLE || m_minSizes[col]->GetWidth() < 0))
- {
- if (m_minSizes[col]->GetWidth())
- {
- m_maxWidth[col] = abs(m_minSizes[col]->GetWidth());
- }
- else
- {
- m_maxWidth[col] = wxMax(m_maxWidth[col], minSize.GetWidth() / rect->GetWidth());
- }
- }
- else
- {
- m_colStretch[col] = 1;
- m_maxWidth[col] = wxMax(m_maxWidth[col], m_defaultCellSize.GetWidth());
- m_weights[col]->SetWidth(wxMax(m_weights[col]->GetWidth(), rect->GetWeight().GetWidth()));
- }
- node = node->Next();
- }
- }
+ // We first initial all the arrays EXCEPT for the m_minsizes array.
+
+ memset(m_maxHeight, 0, sizeof(int) * m_cell_count.GetHeight());
+ memset(m_maxWidth, 0, sizeof(int) * m_cell_count.GetWidth());
+ memset(m_rowStretch, 0, sizeof(int) * m_cell_count.GetHeight());
+ memset(m_colStretch, 0, sizeof(int) * m_cell_count.GetWidth());
+ for (int x = 0; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++)
+ {
+ m_weights[x]->SetHeight(0);
+ m_weights[x]->SetWidth(0);
+ }
+
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
+ while (node)
+ {
+ wxSizerItem *item = node->GetData();
+ wxMultiCellItemHandle *rect;
+ if (item != NULL &&
+ (rect = (wxMultiCellItemHandle *)item->GetUserData()) != NULL)
+ {
+ int row = rect->GetRow();
+ int col = rect->GetColumn();
+
+ // First make sure that the control knows about the max rows and columns
+
+ int changed = false;
+ if (row + 1 > m_cell_count.GetHeight())
+ {
+ changed++;
+ m_maxHeight = (int *)realloc(m_maxHeight, (1 + row) * sizeof(int));
+ m_rowStretch = (int *)realloc(m_rowStretch, (1 + row) * sizeof(int));
+ for (int x = m_cell_count.GetHeight(); x < row + 1; x++)
+ {
+ m_maxHeight[x - 1] = 0;
+ m_rowStretch[x - 1] = 0;
+ }
+ m_cell_count.SetHeight(row + 1);
+ }
+ if (col + 1 > m_cell_count.GetWidth())
+ {
+ changed++;
+ m_maxWidth = (int *)realloc(m_maxWidth, (1 + col) * sizeof(int));
+ m_colStretch = (int *)realloc(m_colStretch, ( 1 + col) * sizeof(int));
+ for (int x = m_cell_count.GetWidth(); x < col + 1; x++)
+ {
+ m_maxWidth[x - 1] = 0;
+ m_colStretch[x - 1] = 0;
+ }
+ m_cell_count.SetWidth(col + 1);
+ }
+ if (changed)
+ {
+ m_weights = (wxSize **)realloc(m_weights, (1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *));
+ m_minSizes = (wxSize **)realloc(m_minSizes, (1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *));
+ for (int x = m_maxWeights; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++)
+ {
+ m_weights[x - 1] = new wxSize(0,0);
+ m_minSizes[x - 1] = new wxSize(0,0);
+ }
+ m_maxWeights = 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth());
+ }
+
+ // Sum the m_weights for each row/column, but only if they are resizable
+
+ wxSize minSize( item->CalcMin() );
+ wxSize c_size = rect->GetLocalSize();
+ if (c_size.GetHeight() != wxDefaultCoord ||
+ c_size.GetWidth() != wxDefaultCoord)
+ {
+ minSize.SetHeight(wxMax(minSize.GetHeight(), c_size.GetHeight()));
+ minSize.SetWidth(wxMax(minSize.GetWidth(), c_size.GetWidth()));
+ }
+
+ // For each row, calculate the max height for those fields which are not
+ // resizable in the vertical pane
+
+ if (!(rect->GetStyle() & wxVERTICAL_RESIZABLE || m_minSizes[row]->GetHeight() < 0))
+ {
+ m_maxHeight[row] = wxMax(m_maxHeight[row], minSize.GetHeight() / rect->GetHeight());
+ }
+ else
+ {
+ m_rowStretch[row] = 1;
+ if (m_minSizes[row]->GetHeight())
+ {
+ m_maxHeight[row] = abs(m_minSizes[row]->GetHeight());
+ }
+ else
+ {
+ m_maxHeight[row] = wxMax(m_maxHeight[row], m_defaultCellSize.GetHeight());
+ }
+ m_weights[row]->SetHeight(wxMax(m_weights[row]->GetHeight(), rect->GetWeight().GetHeight()));
+ }
+
+ // For each column, calculate the max width for those fields which are not
+ // resizable in the horizontal pane
+
+ if (!(rect->GetStyle() & wxHORIZONTAL_RESIZABLE || m_minSizes[col]->GetWidth() < 0))
+ {
+ if (m_minSizes[col]->GetWidth())
+ {
+ m_maxWidth[col] = abs(m_minSizes[col]->GetWidth());
+ }
+ else
+ {
+ m_maxWidth[col] = wxMax(m_maxWidth[col], minSize.GetWidth() / rect->GetWidth());
+ }
+ }
+ else
+ {
+ m_colStretch[col] = 1;
+ m_maxWidth[col] = wxMax(m_maxWidth[col], m_defaultCellSize.GetWidth());
+ m_weights[col]->SetWidth(wxMax(m_weights[col]->GetWidth(), rect->GetWeight().GetWidth()));
+ }
+ node = node->GetNext();
+ }
+ }