@@ -7,13 +7,15 @@ import Dialog from 'primevue/dialog'
77import Numpad from ' ./components/Numpad.vue'
88import DRODisplay from ' ./components/DRODisplay.vue'
99import OperationPreview from ' ./components/OperationPreview.vue'
10+ import ToolTable from ' ./components/ToolTable.vue'
1011import { useHAL } from ' ./composables/useHAL'
1112import {
1213 useCannedCycles ,
1314 ThreadingEntryType ,
1415 TurningEntryType
1516} from ' ./composables/useCannedCycles'
1617import { useSettings } from ' ./composables/useSettings'
18+ import { useToolTable } from ' ./composables/useToolTable'
1719
1820enum EntryType {
1921 xPosition = 1 ,
@@ -65,7 +67,10 @@ const {
6567 xstepperactive,
6668 zstepperactive,
6769 currentToolIndex,
68- updateHALOut
70+ currentToolOffset,
71+ updateHALOut,
72+ loadCurrentTool,
73+ saveCurrentTool
6974} = useHAL ()
7075
7176const {
@@ -179,6 +184,9 @@ const xpitchangle = ref(0)
179184// Get settings from composable
180185const { metric, diameterMode, defaultMetricOnStartup, selectedThreadingTab, selectedTurningTab, selectedPitchTab, pitchX, pitchZ, isQuitting, loadSettings } = useSettings ()
181186
187+ // Get tool table functions
188+ const { loadTools } = useToolTable ()
189+
182190const cursorpos = ref (0 )
183191
184192enum FeedMode {
@@ -214,6 +222,19 @@ const showBackplot = ref(false)
214222const currentOperation = ref <any >(null )
215223const pendingOperationExecution = ref <(() => void ) | null >(null )
216224
225+ // Tool Table state
226+ const showToolTable = ref (false )
227+
228+ const openToolTable = () => {
229+ showToolTable .value = true
230+ }
231+
232+ const onToolSelected = (toolId : number , offset : number ) => {
233+ currentToolIndex .value = toolId
234+ currentToolOffset .value = offset
235+ showToolTable .value = false
236+ }
237+
217238const menuItems = ref ([
218239 { separator: true },
219240 {
@@ -795,6 +816,11 @@ watch(selectedMenu, () => {
795816 scheduleHALOut ()
796817})
797818
819+ // Auto-save current tool when it changes
820+ watch ([currentToolIndex , currentToolOffset ], () => {
821+ saveCurrentTool ()
822+ })
823+
798824const PitchPresetSelector = defineAsyncComponent (
799825 () => import (' ./components/PitchPresetSelector.vue' )
800826)
@@ -1080,6 +1106,12 @@ onMounted(async () => {
10801106 // Load settings first
10811107 await loadSettings ()
10821108
1109+ // Load tool table
1110+ await loadTools ()
1111+
1112+ // Load current tool
1113+ await loadCurrentTool ()
1114+
10831115 // Initialize pitch values from settings
10841116 if (pitchX .value > 0 ) {
10851117 xpitch .value = pitchX .value
@@ -1213,6 +1245,7 @@ onUnmounted(() => {
12131245 @pitch-clicked =" pitchClicked"
12141246 @metric-clicked =" metricClicked"
12151247 @other-clicked =" otherClicked"
1248+ @tool-clicked =" openToolTable"
12161249 />
12171250 <div class =" divider-vertical" ></div >
12181251 <Numpad class =" " @num-pad-clicked =" numPadClicked" />
@@ -1438,6 +1471,7 @@ onUnmounted(() => {
14381471 @pitch-clicked =" pitchClicked"
14391472 @metric-clicked =" threadMetricClicked"
14401473 @other-clicked =" otherClicked"
1474+ @tool-clicked =" openToolTable"
14411475 />
14421476 <div class =" divider-vertical" ></div >
14431477 <Numpad class =" " @num-pad-clicked =" numPadClicked" />
@@ -2459,6 +2493,14 @@ onUnmounted(() => {
24592493 </div >
24602494 </div >
24612495 </div >
2496+
2497+ <!-- Tool Table Modal -->
2498+ <ToolTable
2499+ :visible =" showToolTable"
2500+ @update:visible =" showToolTable = $event"
2501+ :current-tool-id =" currentToolIndex"
2502+ @tool-selected =" onToolSelected"
2503+ />
24622504</template >
24632505
24642506<style scoped>
0 commit comments