class Qt::GraphicsSvgItem

Attributes

baseElement[RW]

Public Instance Methods

contextMenuEvent(contextEvent) click to toggle source
# File lib/fgmapping/main-dlg-impl.rb, line 1257
def contextMenuEvent(contextEvent)
        dlg=contextEvent.widget.parent.parent
        entries=["Add Waypoint as last", "Add Waypoint at"]
        menu=Qt::Menu.new
        entries.each{|e|
                menu.addAction(e)
        }
        sel=menu.exec(contextEvent.screenPos)
        sel=sel.text if !sel.nil?

        ok = Qt::Boolean.new(true)

        case sel
                when entries[1]
                        # don't put this into a thread, it will create nasty core-dumps
                        resp = Qt::InputDialog.getInt(dlg, "Enter Waypoint Position.", "After which waypoint shall I insert this one?\nEnter 0 to insert at beginning.", 0, 0, 9999, 1, ok)
        end #case
        
        if ok.value then
                Thread.new {
                        case sel
                                when entries[0]
                                        dlg.writeFlightsim("set /autopilot/route-manager/input @INSERT-1:#{baseElement.shortName}")

                                when entries[1]
                                        dlg.writeFlightsim("set /autopilot/route-manager/input @INSERT+#{resp}:#{baseElement.shortName}")
                        end #case
                }
        end
end