Skip to content

Commit

Permalink
Updated objects to compile with latest vt-managed-working-set branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ad3154 committed Nov 25, 2023
1 parent af16681 commit b670118
Show file tree
Hide file tree
Showing 24 changed files with 66 additions and 66 deletions.
4 changes: 2 additions & 2 deletions src/AlarmMaskComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void AlarmMaskComponent::on_content_changed(bool initial)
{
for (std::uint16_t i = 0; i < this->get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::SoftKeyMask != child->get_object_type()))
{
Expand All @@ -41,7 +41,7 @@ void AlarmMaskComponent::on_content_changed(bool initial)

void AlarmMaskComponent::paint(Graphics &g)
{
auto vtColour = colourTable.get_colour(backgroundColor);
auto vtColour = parentWorkingSet->get_colour(backgroundColor);

g.fillAll(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
}
6 changes: 3 additions & 3 deletions src/ButtonComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ButtonComponent::ButtonComponent(std::shared_ptr<isobus::VirtualTerminalServerMa

for (std::uint16_t i = 0; i < this->get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
Expand All @@ -33,7 +33,7 @@ ButtonComponent::ButtonComponent(std::shared_ptr<isobus::VirtualTerminalServerMa

void ButtonComponent::paint(Graphics &g)
{
auto vtColour = colourTable.get_colour(backgroundColor);
auto vtColour = parentWorkingSet->get_colour(backgroundColor);

if (true == get_option(Options::TransparentBackground))
{
Expand All @@ -46,7 +46,7 @@ void ButtonComponent::paint(Graphics &g)

if (false == get_option(Options::NoBorder))
{
vtColour = colourTable.get_colour(get_border_colour());
vtColour = parentWorkingSet->get_colour(get_border_colour());
g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
g.drawRect(0, 0, get_width(), get_height(), 4);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ContainerComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ContainerComponent::ContainerComponent(std::shared_ptr<isobus::VirtualTerminalSe

for (std::uint16_t i = 0; i < this->get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
Expand Down
4 changes: 2 additions & 2 deletions src/DataMaskComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void DataMaskComponent::on_content_changed(bool initial)
{
for (std::uint16_t i = 0; i < this->get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::SoftKeyMask != child->get_object_type()))
{
Expand All @@ -41,7 +41,7 @@ void DataMaskComponent::on_content_changed(bool initial)

void DataMaskComponent::paint(Graphics &g)
{
auto vtColour = colourTable.get_colour(backgroundColor);
auto vtColour = parentWorkingSet->get_colour(backgroundColor);

g.fillAll(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
}
12 changes: 6 additions & 6 deletions src/DataMaskRenderAreaComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void DataMaskRenderAreaComponent::mouseUp(const MouseEvent &event)

for (std::uint32_t i = 0; i < clickedList->get_number_children(); i++)
{
auto child = clickedList->get_object_by_id(clickedList->get_child_id(static_cast<std::uint16_t>(i)));
auto child = clickedList->get_object_by_id(clickedList->get_child_id(static_cast<std::uint16_t>(i)), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
Expand Down Expand Up @@ -181,7 +181,7 @@ void DataMaskRenderAreaComponent::mouseUp(const MouseEvent &event)

if (isobus::NULL_OBJECT_ID != clickedList->get_variable_reference())
{
auto child = clickedList->get_object_by_id(clickedList->get_variable_reference());
auto child = clickedList->get_object_by_id(clickedList->get_variable_reference(), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
Expand Down Expand Up @@ -224,7 +224,7 @@ void DataMaskRenderAreaComponent::mouseUp(const MouseEvent &event)

for (std::uint16_t i = 0; i < clickedNumber->get_number_children(); i++)
{
auto child = clickedNumber->get_object_by_id(clickedNumber->get_child_id(i));
auto child = clickedNumber->get_object_by_id(clickedNumber->get_child_id(i), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
Expand Down Expand Up @@ -259,7 +259,7 @@ void DataMaskRenderAreaComponent::mouseUp(const MouseEvent &event)

for (std::uint32_t i = 0; i < clickedNumber->get_number_children(); i++)
{
auto child = clickedNumber->get_object_by_id(clickedNumber->get_child_id(static_cast<std::uint16_t>(i)));
auto child = clickedNumber->get_object_by_id(clickedNumber->get_child_id(static_cast<std::uint16_t>(i)), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::NumberVariable == child->get_object_type()))
{
Expand Down Expand Up @@ -307,7 +307,7 @@ void DataMaskRenderAreaComponent::mouseUp(const MouseEvent &event)

for (std::uint16_t i = 0; i < clickedBool->get_number_children(); i++)
{
auto child = clickedBool->get_object_by_id(clickedBool->get_child_id(i));
auto child = clickedBool->get_object_by_id(clickedBool->get_child_id(i), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
Expand Down Expand Up @@ -383,7 +383,7 @@ std::shared_ptr<isobus::VTObject> DataMaskRenderAreaComponent::getClickedChildRe

for (std::uint16_t i = 0; i < object->get_number_children(); i++)
{
auto child = object->get_object_by_id(object->get_child_id(i));
auto child = object->get_object_by_id(object->get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) &&
(objectCanBeClicked(child)) &&
Expand Down
8 changes: 4 additions & 4 deletions src/InputBooleanComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ InputBooleanComponent::InputBooleanComponent(std::shared_ptr<isobus::VirtualTerm
void InputBooleanComponent::paint(Graphics &g)
{
// Draw background
auto vtColour = colourTable.get_colour(get_background_color());
auto vtColour = parentWorkingSet->get_colour(get_background_color());
g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
g.drawRect(0, 0, static_cast<int>(get_width()), static_cast<int>(get_height()), 0);

g.setColour(Colour::fromFloatRGBA(0.0f, 0.0f, 0.0f, 1.0f));
// Change colour to foreground colour if present
for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::FontAttributes == child->get_object_type()))
{
vtColour = colourTable.get_colour(std::static_pointer_cast<isobus::FontAttributes>(child)->get_background_color());
vtColour = parentWorkingSet->get_colour(std::static_pointer_cast<isobus::FontAttributes>(child)->get_background_color());
g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
break;
}
Expand All @@ -40,7 +40,7 @@ void InputBooleanComponent::paint(Graphics &g)
// Change use number variable if one was provided
for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::NumberVariable == child->get_object_type()))
{
Expand Down
4 changes: 2 additions & 2 deletions src/InputListComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void InputListComponent::onChanged(bool initial)

if (isobus::NULL_OBJECT_ID != get_variable_reference())
{
auto child = get_object_by_id(get_variable_reference());
auto child = get_object_by_id(get_variable_reference(), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
Expand All @@ -51,7 +51,7 @@ void InputListComponent::onChanged(bool initial)
(selectedIndex < static_cast<std::uint32_t>(get_number_children())))
{
// The number variable will always be the first one
auto listItem = get_object_by_id(get_child_id(static_cast<std::uint16_t>(selectedIndex)));
auto listItem = get_object_by_id(get_child_id(static_cast<std::uint16_t>(selectedIndex)), parentWorkingSet->get_object_tree());
childComponent = JuceManagedWorkingSetCache::create_component(parentWorkingSet, listItem);

if (nullptr != childComponent)
Expand Down
6 changes: 3 additions & 3 deletions src/InputNumberComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void InputNumberComponent::paint(Graphics &g)
{
if (isOpaque())
{
auto vtColour = colourTable.get_colour(backgroundColor);
auto vtColour = parentWorkingSet->get_colour(backgroundColor);
g.fillAll(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
}

Expand All @@ -38,15 +38,15 @@ void InputNumberComponent::paint(Graphics &g)
// Get font data
for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
if (isobus::VirtualTerminalObjectType::FontAttributes == child->get_object_type())
{
auto font = std::static_pointer_cast<isobus::FontAttributes>(child);

auto colour = colourTable.get_colour(font->get_background_color());
auto colour = parentWorkingSet->get_colour(font->get_background_color());
Font juceFont(Font::getDefaultMonospacedFontName(), font->get_font_height_pixels(), Font::FontStyleFlags::plain);
auto fontWidth = juceFont.getStringWidthFloat("1");
juceFont.setHorizontalScale(static_cast<float>(font->get_font_width_pixels()) / fontWidth);
Expand Down
4 changes: 2 additions & 2 deletions src/KeyComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ KeyComponent::KeyComponent(std::shared_ptr<isobus::VirtualTerminalServerManagedW

for (std::uint16_t i = 0; i < this->get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
Expand All @@ -33,7 +33,7 @@ KeyComponent::KeyComponent(std::shared_ptr<isobus::VirtualTerminalServerManagedW

void KeyComponent::paint(Graphics &g)
{
auto vtColour = colourTable.get_colour(backgroundColor);
auto vtColour = parentWorkingSet->get_colour(backgroundColor);

g.fillAll(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
}
2 changes: 1 addition & 1 deletion src/ObjectPointerComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ObjectPointerComponent::ObjectPointerComponent(std::shared_ptr<isobus::VirtualTe
void ObjectPointerComponent::on_content_changed(bool initial)
{
childComponent.reset();
auto child = get_object_by_id(get_child_id(0));
auto child = get_object_by_id(get_child_id(0), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
Expand Down
8 changes: 4 additions & 4 deletions src/OutputEllipseComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ void OutputEllipseComponent::paint(Graphics &g)
// Ensure we fill first, then draw the outline if needed
for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::FillAttributes == child->get_object_type()))
{
auto fill = std::static_pointer_cast<isobus::FillAttributes>(child);

auto vtColour = colourTable.get_colour(fill->get_background_color());
auto vtColour = parentWorkingSet->get_colour(fill->get_background_color());
g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
g.fillEllipse(0, 0, get_width(), get_height());
}
}

for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::LineAttributes == child->get_object_type()))
{
auto line = std::static_pointer_cast<isobus::LineAttributes>(child);

auto vtColour = colourTable.get_colour(line->get_background_color());
auto vtColour = parentWorkingSet->get_colour(line->get_background_color());
g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
g.drawEllipse(0, 0, get_width(), get_height(), line->get_width());
}
Expand Down
4 changes: 2 additions & 2 deletions src/OutputLineComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ void OutputLineComponent::paint(Graphics &g)
{
for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::LineAttributes == child->get_object_type()))
{
if ((0 != get_width()) && (0 != get_height()))
{
auto line = std::static_pointer_cast<isobus::LineAttributes>(child);

auto vtColour = colourTable.get_colour(line->get_background_color());
auto vtColour = parentWorkingSet->get_colour(line->get_background_color());
g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));

if (LineDirection::BottomLeftToTopRight == get_line_direction())
Expand Down
6 changes: 3 additions & 3 deletions src/OutputLinearBarGraphComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ OutputLinearBarGraphComponent::OutputLinearBarGraphComponent(std::shared_ptr<iso
void OutputLinearBarGraphComponent::paint(Graphics &g)
{
float valueRatioToMax = static_cast<float>(get_value()) / static_cast<float>(get_max_value());
auto vtBackgroundColour = colourTable.get_colour(get_colour());
auto vtTargetLineColour = colourTable.get_colour(get_target_line_colour());
auto vtBackgroundColour = parentWorkingSet->get_colour(get_colour());
auto vtTargetLineColour = parentWorkingSet->get_colour(get_target_line_colour());
g.setColour(Colour::fromFloatRGBA(vtBackgroundColour.r, vtBackgroundColour.g, vtBackgroundColour.b, 1.0));

for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::NumberVariable == child->get_object_type()))
{
Expand Down
6 changes: 3 additions & 3 deletions src/OutputMeterComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void OutputMeterComponent::paint(Graphics &g)
{
if (get_option(Options::DrawBorder))
{
auto vtColour = colourTable.get_colour(get_border_colour());
auto vtColour = parentWorkingSet->get_colour(get_border_colour());
g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
g.drawRect(0, 0, static_cast<int>(get_width()), static_cast<int>(get_height()), 1);
}
Expand Down Expand Up @@ -50,14 +50,14 @@ void OutputMeterComponent::paint(Graphics &g)
std::uint32_t needleValue = get_value();
if ((this->get_number_children() > 0) && (0xFFFF != this->get_child_id(0)))
{
auto varNum = this->get_object_by_id(this->get_child_id(0));
auto varNum = this->get_object_by_id(this->get_child_id(0), parentWorkingSet->get_object_tree());

if ((nullptr != varNum) && (isobus::VirtualTerminalObjectType::NumberVariable == varNum->get_object_type()))
{
needleValue = std::static_pointer_cast<isobus::NumberVariable>(varNum)->get_value();
}
}
auto vtColour = colourTable.get_colour(get_needle_colour());
auto vtColour = parentWorkingSet->get_colour(get_needle_colour());
Path needlePath;
float endVtAngleDeg = get_end_angle() * 2.0f;
float startVtAngleDeg = get_start_angle() * 2.0f;
Expand Down
6 changes: 3 additions & 3 deletions src/OutputNumberComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void OutputNumberComponent::paint(Graphics &g)
{
if (isOpaque())
{
auto vtColour = colourTable.get_colour(backgroundColor);
auto vtColour = parentWorkingSet->get_colour(backgroundColor);
g.fillAll(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
}

Expand All @@ -38,15 +38,15 @@ void OutputNumberComponent::paint(Graphics &g)
// Get font data
for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if (nullptr != child)
{
if (isobus::VirtualTerminalObjectType::FontAttributes == child->get_object_type())
{
auto font = std::static_pointer_cast<isobus::FontAttributes>(child);

auto colour = colourTable.get_colour(font->get_colour());
auto colour = parentWorkingSet->get_colour(font->get_colour());
Font juceFont(Font::getDefaultMonospacedFontName(), font->get_font_height_pixels(), Font::FontStyleFlags::plain);
auto fontWidth = juceFont.getStringWidthFloat("1");
juceFont.setHorizontalScale(static_cast<float>(font->get_font_width_pixels()) / fontWidth);
Expand Down
8 changes: 4 additions & 4 deletions src/OutputPolygonComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ void OutputPolygonComponent::paint(Graphics &g)

for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::LineAttributes == child->get_object_type()))
{
auto line = std::static_pointer_cast<isobus::LineAttributes>(child);
lineWidth = line->get_width();
auto lineAttributeColour = colourTable.get_colour(line->get_background_color());
auto lineAttributeColour = parentWorkingSet->get_colour(line->get_background_color());

lineColour = Colour::fromFloatRGBA(lineAttributeColour.r, lineAttributeColour.g, lineAttributeColour.b, 1.0);
break;
Expand Down Expand Up @@ -59,13 +59,13 @@ void OutputPolygonComponent::paint(Graphics &g)

for (std::uint16_t i = 0; i < get_number_children(); i++)
{
auto child = get_object_by_id(get_child_id(i));
auto child = get_object_by_id(get_child_id(i), parentWorkingSet->get_object_tree());

if ((nullptr != child) && (isobus::VirtualTerminalObjectType::FillAttributes == child->get_object_type()))
{
auto fill = std::static_pointer_cast<isobus::FillAttributes>(child);

auto vtColour = colourTable.get_colour(fill->get_background_color());
auto vtColour = parentWorkingSet->get_colour(fill->get_background_color());
g.setFillType(FillType(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f)));
g.fillPath(polygonPath);
break;
Expand Down
Loading

0 comments on commit b670118

Please sign in to comment.