Class: Qt::GraphicsSvgItem

Inherits:
Object
  • Object
show all
Defined in:
lib/fgmapping/main-dlg-impl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#baseElementObject

Returns the value of attribute baseElement.



1255
1256
1257
# File 'lib/fgmapping/main-dlg-impl.rb', line 1255

def baseElement
  @baseElement
end

Instance Method Details

#contextMenuEvent(contextEvent) ⇒ Object



1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
# 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