package Ġcom . so yle . stories . desktop . config . drivers . scene Ċ Ċ import Ġcom . so yle . stories . character arc . create Character Dialog . Create Character Form Ċ import Ġcom . so yle . stories . desktop . config . drivers . character . get Create Character Dialog Or Error Ċ import Ġcom . so yle . stories . desktop . config . drivers . location . get Create Location Dialog Or Error Ċ import Ġcom . so yle . stories . desktop . config . drivers . theme . get Create Symbol Dialog Or Error Ċ import Ġcom . so yle . stories . desktop . view . pro se . pro se Editor . Pro se Editor Driver Ċ import Ġcom . so yle . stories . desktop . view . pro se . pro se Editor . Pro se Editor Driver . Companion . drive Ċ import Ġcom . so yle . stories . desktop . view . pro se . pro se Editor . Pro se Editor Driver . Companion . driver Ċ import Ġcom . so yle . stories . desktop . view . scene . scene Editor . Scene Editor Driver . Companion . drive Ċ import Ġcom . so yle . stories . desktop . view . scene . scene Editor . Scene Editor Driver . Companion . driver Ċ import Ġcom . so yle . stories . desktop . view . scene . scene List . Scene List Driver Ċ import Ġcom . so yle . stories . desktop . view . type Ċ import Ġcom . so yle . stories . domain . scene . Scene Ċ import Ġcom . so yle . stories . location . create Location Dialog . Create Location Dialog Ċ import Ġcom . so yle . stories . project . Project Scope Ċ import Ġcom . so yle . stories . pro se . pro se Editor . Content Element Ċ import Ġcom . so yle . stories . pro se . pro se Editor . Mention Issue Menu Ċ import Ġcom . so yle . stories . scene . scene Editor . Scene Editor Scope Ċ import Ġcom . so yle . stories . scene . scene Editor . Scene Editor View Ċ import Ġcom . so yle . stories . scene . scene List . Scene ListView Ċ import Ġcom . so yle . stories . theme . create Symbol Dialog . Create Symbol Dialog Ċ import Ġjavafx . event . EventType Ċ import Ġjavafx . scene . input . ContextMenu Event Ċ import Ġjavafx . scene . input . KeyCode Ċ import Ġjavafx . scene . input . KeyEvent Ċ import Ġjavafx . scene . input . Pick Result Ċ import Ġkotlinx . coroutines . delay Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġt orn ad of x . FX Ċ Ċ fun ĠScene ListView . given Scene Editor Tool HasBeen Opened ( scene : ĠScene ): ĠScene Editor View Ġ= ĊĠĠĠ Ġscope . get Scene Editor Tool ( scene ) Ġ?: Ġopen Scene Editor Tool ( scene ). let Ġ{ Ġscope . get Scene Editor Tool Or Error ( scene ) Ġ} Ċ Ċ fun ĠProject Scope . get Scene Editor Tool Or Error ( scene : ĠScene ): ĠScene Editor View Ġ= ĊĠĠĠ Ġget Scene Editor Tool ( scene ) Ġ?: Ġerror (" No ĠScene ĠEditor Ġopen Ġfor Ġscene Ġ${ scene . name }") Ċ Ċ fun ĠProject Scope . get Scene Editor Tool ( scene : ĠScene ): ĠScene Editor View ? Ġ{ ĊĠĠĠ Ġreturn Ġtool Scopes . as Sequence () ĊĠĠĠĠĠĠĠ Ġ. filter Is Instance < Scene Editor Scope >() ĊĠĠĠĠĠĠĠ Ġ. find Ġ{ Ġit . type . scene Id Ġ== Ġscene . id Ġ} ĊĠĠĠĠĠĠĠ Ġ? . let Ġ{ ĠFX . get Components ( it )[ Scene Editor View :: class ] Ġas ? ĠScene Editor View Ġ} Ċ } Ċ Ċ fun ĠScene ListView . open Scene Editor Tool ( scene : ĠScene ) Ġ{ ĊĠĠĠ Ġval Ġdriver Ġ= ĠScene List Driver ( this ) ĊĠĠĠ Ġval Ġitem Ġ= Ġdriver . get Scene Item Or Error ( scene . name . value ) ĊĠĠĠ Ġdriver . interact Ġ{ ĊĠĠĠĠĠĠĠ Ġdriver . tree . selection Model . select ( item ) ĊĠĠĠĠĠĠĠ Ġwith ( driver ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġitem . get Scene Editor Item (). fire () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . set Conflict ( conflict : ĠString ) Ġ{ ĊĠĠĠ Ġdrive Ġ{ ĊĠĠĠĠĠĠĠ Ġconflict Field Input . request Focus () ĊĠĠĠĠĠĠĠ Ġconflict Field Input . text Ġ= Ġconflict ĊĠĠĠĠĠĠĠ Ġresolution Field Input . request Focus () ĊĠĠĠ Ġ} Ċ } Ċ fun ĠScene Editor View . set Resolution ( resolution : ĠString ) Ġ{ ĊĠĠĠ Ġdrive Ġ{ ĊĠĠĠĠĠĠĠ Ġresolution Field Input . request Focus () ĊĠĠĠĠĠĠĠ Ġresolution Field Input . text Ġ= Ġresolution ĊĠĠĠĠĠĠĠ Ġconflict Field Input . request Focus () ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . request Story Elements Matching ( query : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġkey Codes Ġ= Ġquery . as Sequence () ĊĠĠĠĠĠĠĠ Ġ. map ( Character :: toString ) ĊĠĠĠĠĠĠĠ Ġ. map ( String :: toUpperCase ) ĊĠĠĠĠĠĠĠ Ġ. map ( KeyCode :: getKey Code ) ĊĠĠĠĠĠĠĠ Ġ. toList () ĊĠĠĠĠĠĠĠ Ġ. to Typed Array () ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . request Focus () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpress ( KeyCode . SHIFT ). type ( KeyCode . DIGIT 2 ). release ( KeyCode . SHIFT ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype (* key Codes ) ĊĠĠĠĠĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . enter Text ( text : ĠString ) Ġ{ ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . request Focus () ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype ( text ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġrun Blocking Ġ{ Ġdelay ( 1 5 0 0 ) Ġ} ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . parent . request Focus () ĊĠĠĠĠĠĠĠ Ġ} Ċ } Ċ Ċ private Ġfun ĠPro se Editor Driver . get Offset For Mention ( mention Name : ĠString ): ĠPair < Int , ĠContent Element >? Ġ{ ĊĠĠĠ Ġvar Ġoffset Ġ= Ġ 0 ĊĠĠĠ Ġval Ġmention Ġ= Ġtext Area . paragraph s . as Sequence (). flatMap Ġ{ Ġit . segments . as Sequence () Ġ} ĊĠĠĠĠĠĠĠ Ġ. find Ġ{ Ġsegment Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ( segment . text Ġ== Ġmention Name ). also Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ(! it ) Ġoffset Ġ+= Ġsegment . text . length ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġmention ?. let Ġ{ Ġoffset Ġto Ġmention Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . at Right Of Mention ( mention Name : ĠString ): ĠScene Editor View Ġ{ ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġ( offset , Ġmention ) Ġ= Ġget Offset For Mention ( mention Name ) !! ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . moveTo ( offset Ġ+ Ġmention . text . length ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġthis Ċ } Ċ Ċ fun ĠScene Editor View . at Left Of Mention ( mention Name : ĠString ): ĠScene Editor View Ġ{ ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġ( offset , Ġmention ) Ġ= Ġget Offset For Mention ( mention Name ) !! ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . moveTo ( offset ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġthis Ċ } Ċ Ċ fun ĠScene Editor View . type Key ( keyCode : ĠKeyCode ): ĠScene Editor View Ġ{ ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . request Focus () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype ( keyCode ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġrun Blocking Ġ{ Ġdelay ( 1 0 0 ) Ġ} ĊĠĠĠ Ġdriver (). get Pro se Editor (). drive Ġ{ Ġtext Area . parent . request Focus () Ġ} ĊĠĠĠ Ġreturn Ġthis Ċ } Ċ Ċ fun ĠScene Editor View . query ( query : ĠString ) Ġ{ ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . request Focus () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpress ( KeyCode . SHIFT ). type ( KeyCode . DIGIT 2 ). release ( KeyCode . SHIFT ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġrun Blocking Ġ{ Ġdelay ( 1 0 0 ) Ġ} ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype ( query ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġrun Blocking Ġ{ Ġdelay ( 1 0 0 ) Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . given Story Elements Qu er ied ( query : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġdriver Ġ= Ġdriver (). get Pro se Editor (). driver () ĊĠĠĠ Ġif Ġ(! driver . is Showing Mention Menu ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġquery ( query ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . select Mention Suggestion ( suggestion Name : ĠString ) Ġ{ ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmention Item Ġ= Ġmention Menu Items . find Ġ{ Ġit . name . toString () Ġ== Ġsuggestion Name Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġerror (" could Ġnot Ġfind Ġmention Ġwith Ġname Ġ$ suggestion Name Ġin Ġ$ mention Menu Items ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmention Menu List . selection Model . select ( mention Item ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype ( KeyCode . ENTER ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġrun Blocking Ġ{ Ġdelay ( 1 0 0 ) Ġ} ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . parent . request Focus () ĊĠĠĠĠĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . select Mention Suggestion And Use ( suggestion Name : ĠString ) Ġ{ ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmention Item Ġ= Ġmention Menu Items . find Ġ{ Ġit . name . toString () Ġ== Ġsuggestion Name Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġerror (" could Ġnot Ġfind Ġmention Ġwith Ġname Ġ$ suggestion Name Ġin Ġ$ mention Menu Items ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmention Menu List . selection Model . select ( mention Item ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpress ( KeyCode . SHIFT ). type ( KeyCode . ENTER ). release ( KeyCode . SHIFT ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġrun Blocking Ġ{ Ġdelay ( 1 0 0 ) Ġ} ĊĠĠĠ Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . parent . request Focus () ĊĠĠĠĠĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . given Mention Is Being Invest ig ated ( mention Name : ĠString ): ĠScene Editor View Ġ{ ĊĠĠĠ Ġif Ġ(! is Mention Being Invest ig ated ( mention Name )) Ġinvestigate Mention ( mention Name ) ĊĊĠĠĠ Ġreturn Ġthis Ċ } Ċ Ċ fun ĠScene Editor View . is Mention Being Invest ig ated ( mention Name : ĠString ): ĠBoolean Ġ= Ġdriver (). get Pro se Editor (). driver (). run Ġ{ ĊĠĠĠ Ġis Showing Mention Issue Menu () Ġ&& Ġmention Issue Menu Is Related To Mention ( mention Name ) Ċ } Ċ Ċ fun ĠScene Editor View . invest igate Mention ( mention Name : ĠString ): ĠM ention Issue Menu ? Ġ{ ĊĠĠĠ Ġreturn Ġdriver (). get Pro se Editor () ĊĠĠĠĠĠĠĠ Ġ. drive Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . request Focus () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . moveTo ( textArea . text . indexOf ( mention Name ) Ġ+ Ġ 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtext Area . on ContextMenu Requested . handle ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠContext Menu Event ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠContext Menu Event . CONTEXT _ MENU _ REQUEST ED , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 . 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 . 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 . 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 . 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtrue , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPick Result ( textArea , Ġ 0 . 0 , Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ}. mention Issue Menu ?. take If Ġ{ Ġit . is Showing Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . clear All Ment ions Of Entity () Ġ{ ĊĠĠĠ Ġval Ġclear Mention Option Ġ= Ġwith ( driver (). get Pro se Editor (). driver ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġmention Issue Menu !!. clear Mention Option () !! ĊĠĠĠ Ġ} ĊĠĠĠ Ġdriver (). interact Ġ{ ĊĠĠĠĠĠĠĠ Ġclear Mention Option . fire () ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . select Replacement Suggestion ( suggestion Text : ĠString ) Ċ { ĊĠĠĠ Ġval Ġreplacement Option Ġ= Ġwith ( driver (). get Pro se Editor (). driver ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġmention Issue Menu !!. replacement Option () !! ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġreplacement Suggestion Ġ= Ġreplacement Option . items . find Ġ{ Ġit . text Ġ== Ġsuggestion Text Ġ} Ġ?: Ġerror (" No Ġreplacement Ġsuggestion Ġavailable Ġnamed Ġ$ suggestion Text ") ĊĠĠĠ Ġdriver (). interact Ġ{ ĊĠĠĠĠĠĠĠ Ġreplacement Suggestion . fire () ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠScene Editor View . given Repl acing Invest ig ated Mention With New Character (): ĠCreate Character Form Ċ { ĊĠĠĠ Ġval Ġreplacement Option Ġ= Ġwith ( driver (). get Pro se Editor (). driver ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġmention Issue Menu !!. replacement Option () !! ĊĠĠĠ Ġ} ĊĠĠĠ Ġdriver (). interact Ġ{ ĊĠĠĠĠĠĠĠ Ġreplacement Option . items . first (). fire () ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġget Create Character Dialog Or Error () Ċ } Ċ Ċ fun ĠScene Editor View . given Repl acing Invest ig ated Mention With New Location (): ĠCreate Location Dialog . View Ċ { ĊĠĠĠ Ġval Ġreplacement Option Ġ= Ġwith ( driver (). get Pro se Editor (). driver ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġmention Issue Menu !!. replacement Option () !! ĊĠĠĠ Ġ} ĊĠĠĠ Ġdriver (). interact Ġ{ ĊĠĠĠĠĠĠĠ Ġreplacement Option . items . first (). fire () ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġget Create Location Dialog Or Error () Ċ } Ċ Ċ fun ĠScene Editor View . given Repl acing Invest ig ated Mention With New Symbol (): ĠCreate Symbol Dialog Ċ { ĊĠĠĠ Ġval Ġreplacement Option Ġ= Ġwith ( driver (). get Pro se Editor (). driver ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġmention Issue Menu !!. replacement Option () !! ĊĠĠĠ Ġ} ĊĠĠĠ Ġdriver (). interact Ġ{ ĊĠĠĠĠĠĠĠ Ġreplacement Option . items . first (). fire () ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġget Create Symbol Dialog Or Error () Ċ } Ċ