static void buildWaypointList(WaypointClient* userdata)
	{
		WaypointClient* anInstance = (WaypointClient*) userdata;
		Fl_Input_Choice * fromWPChoice = anInstance->frWps;
		Fl_Input_Choice * toWPChoice = anInstance->toWps;

		fromWPChoice->clear();
		toWPChoice->clear();
		Json::Value waypointsArray = anInstance->getWaypoints().get("waypoints",0);
		if (waypointsArray.size() == 0)
		{
			fromWPChoice->add("EMPTY");
			toWPChoice->add("EMPTY");
		}
		else
		{
			for (Json::ValueIterator itr = waypointsArray.begin(); itr != waypointsArray.end(); itr++)
			{
				Json::Value waypoint = *itr;
				string name = waypoint["name"].asString();
				fromWPChoice->add(name.c_str());
				toWPChoice->add(name.c_str());
			}

		}
		fromWPChoice->value(0);
		toWPChoice->value(0);
		SelectedFromWP(NULL, anInstance);
	}
Ejemplo n.º 2
0
	WaypointGUI(const char * name = 0) :
			Fl_Window(520, 300, name)
	{
		begin();
		frWps = new Fl_Input_Choice(40, 10, 200, 25, "from");
		frWps->add("EMPTY");
		frWps->value(0);
		toWps = new Fl_Input_Choice(40, 45, 200, 25, "to");
		toWps->add("EMPTY");
		toWps->value(0);
		latIn = new Fl_Input(270, 10, 230, 25, "lat");
		lonIn = new Fl_Input(270, 45, 230, 25, "lon");
		eleIn = new Fl_Input(270, 80, 230, 25, "ele");
		nameIn = new Fl_Input(270, 115, 230, 25, "name");
		addrIn = new Fl_Multiline_Input(270, 150, 230, 70, "addr");
		distBearIn = new Fl_Input(225, 260, 255, 25);

		removeWPButt = new Fl_Button(55, 80, 130, 25, "Remove Waypoint");
		addWPButt = new Fl_Button(55, 115, 130, 25, "Add Waypoint");
		modWPButt = new Fl_Button(55, 150, 130, 25, "Modify Waypoint");
		getAddrButt = new Fl_Button(20, 185, 180, 25, "Get Addr for lat/lon");
		//importJSONButt = new Fl_Button(20, 220, 180, 25, "Import Json Library");
		distBearButt = new Fl_Button(20, 260, 180, 25, "Distance and Bearing");

		end();
		show();
	}
Scheme_Object*
spark_fltk_input_choice::add(int argc, Scheme_Object** argv)
{
  DEFAULT_RET_INIT;

  Fl_Input_Choice* ic = _get_fl_input_choice(argc, argv, 0);
  if (ic)
    {
      if (!SCHEME_CHAR_STRINGP(argv[1]))
	scheme_wrong_type("add-choice", "string", 1, argc, argv);
      Scheme_Object* str = scheme_char_string_to_byte_string(argv[1]);
      std::string s = SCHEME_BYTE_STR_VAL(str);
      ic->add(s.c_str());
      _ret_ = scheme_true;
    }

  DEFAULT_RET_FINISH;
}