21 const auto &mainPanel = prefs.GetMainPanelSettings();
22 const auto &perf = prefs.GetPerformanceSettings();
26 cfg.zoom_step = btView.zoomStepSize;
27 cfg.mouse_wheel_sensitivity = btView.mouseWheelSensitivity;
28 cfg.pan_sensitivity = btView.panSensitivity;
29 cfg.zoom_follows_cursor = btView.zoomFollowsCursor;
30 cfg.enable_smooth_panning = btView.enableSmoothPanning;
31 cfg.pan_smoothness = btView.panSmoothness;
32 cfg.pan_step_size = btView.panStepSize;
34 cfg.enable_viewport_culling = perf.enableViewportCulling;
35 cfg.viewport_culling_margin = perf.viewportCullingMargin;
40 cfg.grid_size = mainPanel.gridSize;
41 cfg.grid_color = wxColour(mainPanel.gridLineColor.r, mainPanel.gridLineColor.g, mainPanel.gridLineColor.b);
43 cfg.highlight_path_to_selected = mainPanel.highlightPathToSelected;
44 cfg.path_highlight_color =
45 wxColour(mainPanel.pathHighlightColor.r, mainPanel.pathHighlightColor.g, mainPanel.pathHighlightColor.b);
47 cfg.background_color = wxColour(mainPanel.canvasBackgroundColor.r, mainPanel.canvasBackgroundColor.g,
48 mainPanel.canvasBackgroundColor.b);
50 cfg.connection_color =
51 wxColour(mainPanel.connectionLineColor.r, mainPanel.connectionLineColor.g, mainPanel.connectionLineColor.b);
53 cfg.node_color = wxColour(mainPanel.idleNodeBgColor.r, mainPanel.idleNodeBgColor.g, mainPanel.idleNodeBgColor.b);
55 wxColour(mainPanel.idleNodeBorderColor.r, mainPanel.idleNodeBorderColor.g, mainPanel.idleNodeBorderColor.b);
57 wxColour(mainPanel.idleNodeTextColor.r, mainPanel.idleNodeTextColor.g, mainPanel.idleNodeTextColor.b);
58 cfg.selected_border_color =
59 wxColour(mainPanel.selectedNodeColor.r, mainPanel.selectedNodeColor.g, mainPanel.selectedNodeColor.b);
60 cfg.hovered_border_color =
61 wxColour(mainPanel.hoveredNodeColor.r, mainPanel.hoveredNodeColor.g, mainPanel.hoveredNodeColor.b);
65 LOG_INFO(
"ForgeTreeCanvas",
"Preferences loaded");
72 dc.SetUserScale(1.0, 1.0);
73 dc.SetDeviceOrigin(0, 0);
75 wxSize panelSize = GetSize();
80 return {panelSize.x - offX, offY};
82 return {offX, panelSize.y - offY};
84 return {panelSize.x - offX, panelSize.y - offY};
90 if (btView.showCoordinateInfo) {
91 wxColour c(btView.coordinateInfoColor.r, btView.coordinateInfoColor.g, btView.coordinateInfoColor.b);
92 dc.SetTextForeground(c);
94 wxFont(btView.coordinateInfoFontSize, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
96 wxString zoomText = wxString::Format(
"Zoom: %.0f%% | Pan: (%d, %d)",
GetZoom() * 100, viewOfs.x, viewOfs.y);
98 zoomText +=
" | FOCUS MODE";
99 dc.DrawText(zoomText, calcPos(btView.coordinateInfoAnchor, btView.coordinateInfoX, btView.coordinateInfoY));
103 if (btView.showSelectedNodeInfo && selectedNode) {
104 wxColour c(btView.selectedNodeInfoColor.r, btView.selectedNodeInfoColor.g, btView.selectedNodeInfoColor.b);
105 dc.SetTextForeground(c);
107 wxFont(btView.selectedNodeInfoFontSize, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
109 "Selected: " + selectedNode->GetName() +
" [" + selectedNode->GetTypeString() +
"]";
112 if (statusProvider) {
113 int status = statusProvider->GetNodeStatus(
static_cast<int64_t
>(selectedNode->GetId()));
114 wxString statusNames[] = {
"Idle",
"Running",
"Success",
"Failure",
"Halted"};
115 selectedText +=
" | Status: " + (status >= 0 && status <= 4 ? statusNames[status] :
"Unknown");
117 dc.DrawText(selectedText,
118 calcPos(btView.selectedNodeInfoAnchor, btView.selectedNodeInfoX, btView.selectedNodeInfoY));
121 if (btView.showTreeInfo) {
123 if (tree && tree->HasRootNode()) {
124 wxColour c(btView.treeInfoColor.r, btView.treeInfoColor.g, btView.treeInfoColor.b);
125 dc.SetTextForeground(c);
126 dc.SetFont(wxFont(btView.treeInfoFontSize, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
127 wxString statsText = wxString::Format(
"Nodes: %lu",
static_cast<unsigned long>(tree->GetNodeCount()));
128 dc.DrawText(statsText, calcPos(btView.treeInfoAnchor, btView.treeInfoX, btView.treeInfoY));
132 if (btView.showFPS) {
133 wxColour c(btView.fpsColor.r, btView.fpsColor.g, btView.fpsColor.b);
134 dc.SetTextForeground(c);
135 dc.SetFont(wxFont(btView.fpsFontSize, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
137 wxString txt = wxString::Format(
"FPS: %.1f", mon.
GetCurrentFPS());
138 dc.DrawText(txt, calcPos(btView.fpsAnchor, btView.fpsX, btView.fpsY));
141 if (btView.showControlsHelp) {
142 wxColour c(btView.controlsHelpColor.r, btView.controlsHelpColor.g, btView.controlsHelpColor.b);
143 dc.SetTextForeground(c);
144 dc.SetFont(wxFont(btView.controlsHelpFontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
145 EmberCore::String helpText =
"Controls: Click=Select | DblClick=Center | Wheel=Zoom | " +
146 btView.resetViewHotkey +
"=Reset | " + btView.centerOnNodeHotkey +
147 "=Expand/Collapse | F=Focus | " + btView.deleteNodeHotkey +
"=Delete";
149 helpText +=
" | Esc=Exit Focus";
150 dc.DrawText(helpText, calcPos(btView.controlsHelpAnchor, btView.controlsHelpX, btView.controlsHelpY));