Example #1
0
    void Visit(Path path, Path filename) override {
      items.emplace_back(filename.c_str(), path);
    }
  } visitor(items);

  const auto weather_path = LocalPath(_T("weather"));
  const auto overlay_path = AllocatedPath::Build(weather_path, _T("overlay"));
  Directory::VisitSpecificFiles(overlay_path, _T("*.tif"), visitor);
  Directory::VisitSpecificFiles(overlay_path, _T("*.tiff"), visitor);

  const unsigned n = items.size();

  if (n > 0)
    std::sort(items.begin(), items.end());

  ListControl &list_control = GetList();
  list_control.SetLength(n);
  list_control.Invalidate();

  const bool empty = items.empty();
  use_button->SetEnabled(!empty);

  UpdateActiveIndex();
}

/**
 * Set up reasonable defaults for the given overlay.
 */
static void
SetupOverlay(MapOverlayBitmap &bmp, Path::const_pointer name)
{
Example #2
0
inline void
NOAAListWidget::DetailsClicked()
{
  if (!stations.empty())
    OpenDetails(GetList().GetCursorIndex());
}
Example #3
0
 const Waypoint *GetCursorObject() const {
   return items.empty()
     ? nullptr
     : items[GetList().GetCursorIndex()].waypoint;
 }
NS_IMETHODIMP
nsCharsetConverterManager::GetEncoderList(nsIUTF8StringEnumerator ** aResult)
{
  return GetList(NS_LITERAL_CSTRING(NS_UNICODEENCODER_NAME),
                 EmptyCString(), aResult);
}
Example #5
0
inline void
PlaneListWidget::LoadClicked()
{
  if (LoadWithDialog(GetList().GetCursorIndex()))
    form->SetModalResult(mrOK);
}
Example #6
0
//------------------------------------------------------------------------------
const StringArray& FactoryManager::GetListOfItems(Gmat::ObjectType byType,
            const std::string &withQualifier)
{
   entireList.clear();
   return GetList(byType, withQualifier);
}
Example #7
0
void
TrafficListWidget::UpdateList()
{
  assert(filter_widget != nullptr);

  items.clear();
  last_update.Clear();

  const TCHAR *callsign = filter_widget->GetValueString(CALLSIGN);
  if (!StringIsEmpty(callsign)) {
    FlarmId ids[30];
    unsigned count = FlarmDetails::FindIdsByCallSign(callsign, ids, 30);

    for (unsigned i = 0; i < count; ++i)
      AddItem(ids[i]);
  } else {
    /* if no filter was set, show a list of current traffic and known
       traffic */

    /* add live FLARM traffic */
    for (const auto &i : CommonInterface::Basic().flarm.traffic.list) {
      AddItem(i.id);
    }

    /* add FLARM peers that have a user-defined color */
    for (const auto &i : traffic_databases->flarm_colors) {
      Item &item = AddItem(i.first);
      item.color = i.second;
    }

    /* add FLARM peers that have a user-defined name */
    for (const auto &i : traffic_databases->flarm_names) {
      AddItem(i.id);
    }

#ifdef HAVE_SKYLINES_TRACKING_HANDLER
    /* show SkyLines traffic unless this is a FLARM traffic picker
       dialog (from dlgTeamCode) */
    if (buttons != nullptr) {
      const auto &data = tracking->GetSkyLinesData();
      const ScopeLock protect(data.mutex);
      for (const auto &i : data.traffic) {
        const auto name_i = data.user_names.find(i.first);
        std::string name = name_i != data.user_names.end()
          ? name_i->second
          : std::string();

        items.emplace_back(i.first, i.second.time_of_day_ms,
                           i.second.location, i.second.altitude,
                           std::move(name));
        Item &item = items.back();

        if (i.second.location.IsValid()) {
          if (CommonInterface::Basic().location_available)
            item.vector = GeoVector(CommonInterface::Basic().location,
                                    i.second.location);

          const auto wp = way_points.GetNearestLandable(i.second.location,
                                                        20000);
          if (wp != nullptr) {
            item.near_name = wp->name.c_str();
            item.near_distance = wp->location.DistanceS(i.second.location);
          }
        }
      }
    }
#endif
  }

  GetList().SetLength(items.size());

  UpdateVolatile();
  UpdateButtons();
}
Example #8
0
 void UpdateList() {
   GetList().SetLength(task.GetOptionalStartPointCount()
                       + (RealStartExists ? 2 : 1));
   GetList().Invalidate();
 }
Example #9
0
 void UpdateButtons() {
   const unsigned current = GetCursorIndex();
   relocate_button->SetEnabled(!RealStartExists || current >= 1);
   remove_button->SetEnabled((!RealStartExists || current >= 1) &&
                             current < GetList().GetLength() - 1);
 }
bool CQRobotSettingList::AddRobotLine( const RBLine& newRobotLine, short count )
{
	GetList().push_back( newRobotLine );
	return true;
}
Example #11
0
//DeadCode RDH 19Feb98 //---------------------------------------------------------------------------
//DeadCode RDH 19Feb98 int __fastcall TGroundGroupForm::GeneralFindShapes(int currshape)
//DeadCode RDH 19Feb98 {
//DeadCode RDH 19Feb98 	int i = 0;
//DeadCode RDH 19Feb98 	int	shapeindex;
//DeadCode RDH 19Feb98
//DeadCode RDH 19Feb98 	while (AvailableShapes[i] != currshape)
//DeadCode RDH 19Feb98
//DeadCode RDH 19Feb98 	{
//DeadCode RDH 19Feb98 		if ( (AvailableShapes[i] ==NULL) &&  (AvailableShapes[i+1] ==NULL))
//DeadCode RDH 19Feb98 			break;
//DeadCode RDH 19Feb98
//DeadCode RDH 19Feb98 		i++;
//DeadCode RDH 19Feb98 	}
//DeadCode RDH 19Feb98 	return(TEXT_FLAKBRIT+i-1);
//DeadCode RDH 19Feb98 }
//---------------------------------------------------------------------------
int __fastcall TGroundGroupForm::FindShapes(int currshape,int& groupindex,int shapepage)
{
	int i = 0;
	int firstnull = -1;
	int secondnull = -1;
	int	shapeindex;

    if (!AvailableShapes[0][0])
    {
		int trg=0;
    	for (int src=0;src<256;src++)
        	if (	GetList(ENUM_ShapeTitle).Translate(src)	||	GetList(ENUM_Shape).Translate(src)	)
				AvailableShapes[0][trg++]=src;
    	AvailableShapes[0][trg++]=0;
        trg=0;
    	for (int src=256;src<512;src++)
        	if (	GetList(ENUM_ShapeTitle).Translate(src)	||	GetList(ENUM_Shape).Translate(src)	)
				AvailableShapes[1][trg++]=src;
        AvailableShapes[1][trg++]=0;
        trg=0;
    	for (int src=512;src<768;src++)
        	if (	GetList(ENUM_ShapeTitle).Translate(src)	||	GetList(ENUM_Shape).Translate(src)	)
				AvailableShapes[2][trg++]=src;
        AvailableShapes[2][trg++]=0;
        trg=0;
        GlobalsInfo* g;

    	for (int src=0;(g=(GlobalsInfo*)BFieldGlobalTable[src].reference)!=NULL;src++)
        	if (g->processor==&ShapeProcess)
				AvailableShapes[3][trg++]=src;
        AvailableShapes[3][trg++]=0;
    }

    if (shapepage==-1)
    	shapepage=currshape/256;

	SWord j = 1;
	char*	tmp;

	ShapeComboBox->Items->Clear();
	CurrShape->ShapeComboBox->Items->Clear();

    shapeindex=-1;
    if (shapepage==3)
    {
    	for (int src=0;AvailableShapes[shapepage][src];src++)
        {
            if (AvailableShapes[shapepage][src]==currshape)
            	shapeindex=src;
            char* tmp=((GlobalsInfo*)BFieldGlobalTable[AvailableShapes[shapepage][src]].reference)->identifier;
			ShapeComboBox->Items->Add(tmp);
        }
    }
    else
    {
    	for (int src=0;AvailableShapes[shapepage][src];src++)
        {
        	if (AvailableShapes[shapepage][src]==currshape)
            	shapeindex=src;
        	char* tmp=GetList(ENUM_ShapeTitle).Translate(AvailableShapes[shapepage][src]);
	        if (!tmp)
    	    	tmp=GetList(ENUM_Shape).Translate(AvailableShapes[shapepage][src]);
			ShapeComboBox->Items->Add(tmp);
        }
    }
	ShapeComboBox->ItemIndex =   shapeindex;
	CurrShape->ShapeComboBox->ItemIndex =   shapeindex;
    ShapeCat->ItemIndex=shapepage;
    currshapecat=shapepage;
   return(firstnull+1);
}
Example #12
0
void GuiListBox::Clear()
{
  GetList()->Clear();
}
Example #13
0
void __fastcall TGroundGroupForm::RefreshText()
{
	char buff[TITLE_LENGTH];
	char buffuid[UID_LENGTH];
	char buffdesc[DESCRIPTION_LENGTH];

 //	LoadString(HInstance,MissionEditor->currobj,buff,sizeof(buff));
	char*	tmp =  GetList(ENUM_UIDtitle).Translate(MissionEditor->currobj);

	if (tmp == NULL)
		Edit_Title->SetTextBuf("None");
	else
		Edit_Title->SetTextBuf(tmp);

	tmp = GetList(ENUM_UniqueID).Translate(MissionEditor->currobj);
	if (tmp  != NULL)
		Edit_UID->SetTextBuf(tmp);
	else
		Edit_UID->SetTextBuf("UID_");
	tmp = GetList(ENUM_UIDdesc).Translate(MissionEditor->currobj);
	if (tmp  != NULL)
		Memo_Description->SetTextBuf(tmp);
	else
		Memo_Description->SetTextBuf("None");

   info_itemS*	I= *Persons2::ConvertPtrUID(MissionEditor->currobj);
   SWord i = 0;

	bool	itemissupergroup = false;
	while ( i < MAXLOADEDSUPERGROUPS)
	{
		if	(MissionEditor->loadedsupergroup[i].uid  == MissionEditor->currobj)
			itemissupergroup = true;
		i++;
	}
	if (itemissupergroup)
	{
		SuperGroupCombo->Enabled = false;
		SuperGroupButton->Enabled = false;
		SuperGroupCombo->Items->Clear();

	}else
	{
		SuperGroupCombo->Enabled = true;
		SuperGroupButton->Enabled = true;
		SWord selection=-1;
		while (selection==-1)
		{
			SuperGroupCombo->Items->Clear();
			SuperGroupCombo->Items->Add("(none)");
			if (!I->SGT)
				selection=0;
			i =0;
			while ( 	( ++i < MAXLOADEDSUPERGROUPS)	)
				if (MissionEditor->loadedsupergroup[i].uid != AbsolutingSepID)
				{
					char* buff=GetList(ENUM_UIDtitle).Translate(MissionEditor->loadedsupergroup[i].uid);
					SuperGroupCombo->Items->Add(buff);
					if ( I->SGT == MissionEditor->loadedsupergroup[i].uid)
						selection=i;
				}
			if (selection==-1)
			{	//add new SG to list:
				i=1;
				while (MissionEditor->loadedsupergroup[i].uid != AbsolutingSepID)
					i++;
				MissionEditor->loadedsupergroup[i].uid=I->SGT;
			}
		}
		SuperGroupCombo->ItemIndex = selection;
	}
}
Example #14
0
 void UpdateActiveIndex() {
   active_index = FindActiveIndex();
   disable_button->SetEnabled(active_index >= 0);
   GetList().Invalidate();
 }
Example #15
0
void ListBaseTestCase::ItemClick()
{
    // FIXME: This test fail under wxGTK because we get 3 FOCUSED events and
    //        2 SELECTED ones instead of the one of each we expect for some
    //        reason, this needs to be debugged as it may indicate a bug in the
    //        generic wxListCtrl implementation.
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)

    // FIXME: This test fails on MSW buildbot slaves although works fine on
    //        development machine, no idea why. It seems to be a problem with
    //        wxUIActionSimulator rather the wxListCtrl control itself however.
    if ( wxGetUserId().Lower().Matches("buildslave*") )
        return;

    wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
                                          wxTestableFrame);

    wxListCtrl* const list = GetList();

    list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
    list->InsertColumn(1, "Column 1", wxLIST_FORMAT_LEFT, 50);
    list->InsertColumn(2, "Column 2", wxLIST_FORMAT_LEFT, 40);

    list->InsertItem(0, "Item 0");
    list->SetItem(0, 1, "first column");
    list->SetItem(0, 2, "second column");

    EventCounter count(list, wxEVT_COMMAND_LIST_ITEM_SELECTED);
    EventCounter count1(list, wxEVT_COMMAND_LIST_ITEM_FOCUSED);
    EventCounter count2(list, wxEVT_COMMAND_LIST_ITEM_ACTIVATED);
    EventCounter count3(list, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK);

    wxUIActionSimulator sim;

    wxRect pos;
    list->GetItemRect(0, pos);

    //We move in slightly so we are not on the edge
    wxPoint point = list->ClientToScreen(pos.GetPosition()) + wxPoint(2, 2);

    sim.MouseMove(point);
    wxYield();

    sim.MouseClick();
    wxYield();

    sim.MouseDblClick();
    wxYield();

    sim.MouseClick(wxMOUSE_BTN_RIGHT);
    wxYield();

    // when the first item was selected the focus changes to it, but not
    // on subsequent clicks
    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_FOCUSED));
    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_SELECTED));
    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_ACTIVATED));
    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK));

    //tidy up when we are finished
    list->ClearAll();
#endif // wxUSE_UIACTIONSIMULATOR
}
BOOL CFileSharingPage::OnInitDialog()
{
    CFilePropertiesPage::OnInitDialog();

    m_wndTags.AddString( _T("") );

    if ( UploadQueues.m_pSection.Lock() )
    {
        CStringList pAdded;

        for ( POSITION pos = UploadQueues.GetIterator() ; pos ; )
        {
            CUploadQueue* pQueue = UploadQueues.GetNext( pos );

            if ( pQueue->m_sShareTag.GetLength() )
            {
                if ( pAdded.Find( pQueue->m_sShareTag ) == NULL )
                {
                    pAdded.AddTail( pQueue->m_sShareTag );
                    m_wndTags.AddString( pQueue->m_sShareTag );
                }
            }
        }

        UploadQueues.m_pSection.Unlock();

        if ( pAdded.IsEmpty() )
        {
            m_wndTags.AddString( _T("Release") );
            m_wndTags.AddString( _T("Popular") );
        }
    }

    {
        CQuickLock oLock( Library.m_pSection );

        if ( CLibraryFile* pFile = GetFile() )
        {
            m_bOverride	= pFile->m_bShared != TS_UNKNOWN;
            m_bShare	= pFile->IsShared();
            m_sTags		= pFile->m_sShareTags;
        }
        else if ( CLibraryList* pList = GetList() )
        {
            for ( POSITION pos = pList->GetIterator() ; pos ; )
            {
                if ( CLibraryFile* pFile = pList->GetNextFile( pos ) )
                {
                    m_bOverride	= pFile->m_bShared != TS_UNKNOWN;
                    m_bShare	= pFile->IsShared();
                    m_sTags		= pFile->m_sShareTags;
                }
            }

        }
    }

    UpdateData( FALSE );
    m_wndShare.EnableWindow( m_bOverride );

    return TRUE;
}
Example #17
0
void ListBaseTestCase::ColumnsOrder()
{
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
    wxListCtrl* const list = GetList();

    int n;
    wxListItem li;
    li.SetMask(wxLIST_MASK_TEXT);

    // first set up some columns
    static const int NUM_COLS = 3;

    list->InsertColumn(0, "Column 0");
    list->InsertColumn(1, "Column 1");
    list->InsertColumn(2, "Column 2");

    // and a couple of test items too
    list->InsertItem(0, "Item 0");
    list->SetItem(0, 1, "first in first");

    list->InsertItem(1, "Item 1");
    list->SetItem(1, 2, "second in second");


    // check that the order is natural in the beginning
    const wxArrayInt orderOrig = list->GetColumnsOrder();
    for ( n = 0; n < NUM_COLS; n++ )
        CPPUNIT_ASSERT_EQUAL( n, orderOrig[n] );

    // then rearrange them: using { 2, 0, 1 } order means that column 2 is
    // shown first, then column 0 and finally column 1
    wxArrayInt order(3);
    order[0] = 2;
    order[1] = 0;
    order[2] = 1;
    list->SetColumnsOrder(order);

    // check that we get back the same order as we set
    const wxArrayInt orderNew = list->GetColumnsOrder();
    for ( n = 0; n < NUM_COLS; n++ )
        CPPUNIT_ASSERT_EQUAL( order[n], orderNew[n] );

    // and the order -> index mappings for individual columns
    for ( n = 0; n < NUM_COLS; n++ )
        CPPUNIT_ASSERT_EQUAL( order[n], list->GetColumnIndexFromOrder(n) );

    // and also the reverse mapping
    CPPUNIT_ASSERT_EQUAL( 1, list->GetColumnOrder(0) );
    CPPUNIT_ASSERT_EQUAL( 2, list->GetColumnOrder(1) );
    CPPUNIT_ASSERT_EQUAL( 0, list->GetColumnOrder(2) );


    // finally check that accessors still use indices, not order
    CPPUNIT_ASSERT( list->GetColumn(0, li) );
    CPPUNIT_ASSERT_EQUAL( "Column 0", li.GetText() );

    li.SetId(0);
    li.SetColumn(1);
    CPPUNIT_ASSERT( list->GetItem(li) );
    CPPUNIT_ASSERT_EQUAL( "first in first", li.GetText() );

    li.SetId(1);
    li.SetColumn(2);
    CPPUNIT_ASSERT( list->GetItem(li) );
    CPPUNIT_ASSERT_EQUAL( "second in second", li.GetText() );

    //tidy up when we are finished
    list->ClearAll();
#endif // wxHAS_LISTCTRL_COLUMN_ORDER
}
void ListBaseTestCase::ItemClick()
{
#if wxUSE_UIACTIONSIMULATOR 

#ifdef __WXMSW__
    // FIXME: This test fails on MSW buildbot slaves although works fine on
    //        development machine, no idea why. It seems to be a problem with
    //        wxUIActionSimulator rather the wxListCtrl control itself however.
    if ( IsAutomaticTest() )
        return;
#endif // __WXMSW__

    wxListCtrl* const list = GetList();

    list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
    list->InsertColumn(1, "Column 1", wxLIST_FORMAT_LEFT, 50);
    list->InsertColumn(2, "Column 2", wxLIST_FORMAT_LEFT, 40);

    list->InsertItem(0, "Item 0");
    list->SetItem(0, 1, "first column");
    list->SetItem(0, 2, "second column");

    EventCounter selected(list, wxEVT_LIST_ITEM_SELECTED);
    EventCounter focused(list, wxEVT_LIST_ITEM_FOCUSED);
    EventCounter activated(list, wxEVT_LIST_ITEM_ACTIVATED);
    EventCounter rclick(list, wxEVT_LIST_ITEM_RIGHT_CLICK);

    wxUIActionSimulator sim;

    wxRect pos;
    list->GetItemRect(0, pos);

    //We move in slightly so we are not on the edge
    wxPoint point = list->ClientToScreen(pos.GetPosition()) + wxPoint(10, 5);

    sim.MouseMove(point);
    wxYield();

    sim.MouseClick();
    wxYield();

    sim.MouseDblClick();
    wxYield();

    sim.MouseClick(wxMOUSE_BTN_RIGHT);
    wxYield();

    // when the first item was selected the focus changes to it, but not
    // on subsequent clicks
    
    // FIXME: This test fail under wxGTK & wxOSX because we get 3 FOCUSED events and
    //        2 SELECTED ones instead of the one of each we expect for some
    //        reason, this needs to be debugged as it may indicate a bug in the
    //        generic wxListCtrl implementation.
#ifndef _WX_GENERIC_LISTCTRL_H_
    CPPUNIT_ASSERT_EQUAL(1, focused.GetCount());
    CPPUNIT_ASSERT_EQUAL(1, selected.GetCount());
#endif
    CPPUNIT_ASSERT_EQUAL(1, activated.GetCount());
    CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());

    //tidy up when we are finished
    list->ClearAll();
#endif // wxUSE_UIACTIONSIMULATOR
}
Example #19
0
 gcc_pure
 FlarmId GetCursorId() const {
   return items.empty()
     ? FlarmId::Undefined()
     : items[GetList().GetCursorIndex()].id;
 }
Example #20
0
/**
 * @function HeaderDraw
 * @brief List header draw function
 * @param void *_g_obj: pointer to the generic object of the header
 * @param void *_obj: pointer to the specific object of the header
 * @return none
 */
static void HeaderDraw(void *_g_obj, void *_obj) {

  g_obj_st *g_obj;
  list_header_st *header;
  list_st *list;
  color_t colBack, colLine, colText;
  coord_t x0, x1, y0, y1, xImg, yImg, xTxt, yTxt, xOffset;
  gui_img_t img;
  rect_st lrec;
  category_st *category;

  /*retreive generic & specific object + pointer to the associated list*/
  if(_g_obj != NULL && _obj != NULL) {
    g_obj = (g_obj_st *) _g_obj;
    header = (list_header_st *) _obj;
    list = GetList(header->g_obj_list);

    colBack = GetColor(G_COL_BACKGROUND);
    colLine = GetColor(G_COL_LOWER_REC);
    colText = GetColor(G_COL_TEXT);

    /*P2D configuration*/
    P2D_SetDisplayMode(DISPLAY_SOLID);
    P2D_SetLineType(LINE_SOLID);
    SetFont(list->font);

    /*draw header background*/
    P2D_SetColor(colBack);
    (void) P2D_RectToCoord(&(g_obj->rec), &x0, &y0, &x1, &y1);
    x0++; y0++; x1--; y1--;
    (void) P2D_CoordToRect(&lrec, x0, y0, x1, y1);
    P2D_SetColor(colBack);
    P2D_FillRect(&lrec);

    /*display categories*/
    category = list->pCategory;
    P2D_SetColors(colText, colBack);
    xTxt = g_obj->rec.x - list->hScroll.offset;
    yTxt = y0 + ((y1 - y0) - list->hItem) / 2;
    xOffset = list->wSpriteMax + 4;

    while(category != NULL) {
      P2D_PutText(xTxt + xOffset, yTxt, category->name);
      xTxt += category->w;
      xOffset = 0;

      /*current category is the selected one? display the up/down sprite*/
      if(category == list->pSelectedCategory) {

        img = (list->bReversedSort == true)? G_IMG_SORT_DOWN: G_IMG_SORT_UP;
        xImg = xTxt - SpriteGetWidth(img) - 2;
        yImg = y0 + ((y1 - y0) - SpriteGetHeight(img)) / 2;

        Sprite(xImg, yImg, img);
      }

      category = category->next;
    }

    /*draw header rect*/
    P2D_SetColor(colLine);
    P2D_Rect(&(g_obj->rec));
  }
}
Example #21
0
void
TrafficListWidget::UpdateVolatile()
{
  const TrafficList &live_list = CommonInterface::Basic().flarm.traffic;

  bool modified = false;

  /* determine the most recent time stamp in the #TrafficList; this is
     used to set the new last_update value */
  Validity max_time;
  max_time.Clear();

  for (auto &i : items) {
    if (i.IsFlarm()) {
      const FlarmTraffic *live = live_list.FindTraffic(i.id);

      if (live != nullptr) {
        if (live->valid.Modified(last_update))
          /* if this #FlarmTraffic is newer than #last_update, then we
             need to redraw the list */
          modified = true;

        if (live->valid.Modified(max_time))
          /* update max_time (and last_update) for the next
             UpdateVolatile() call */
          max_time = live->valid;

        i.location = live->location;
        i.vector = GeoVector(live->distance, live->track);
      } else {
        if (i.location.IsValid() || i.vector.IsValid())
          /* this item has disappeared from our FLARM: redraw the
             list */
          modified = true;

        i.location.SetInvalid();
        i.vector.SetInvalid();
      }
#ifdef HAVE_SKYLINES_TRACKING_HANDLER
    } else if (i.IsSkyLines()) {
      const auto &data = tracking->GetSkyLinesData();
      const ScopeLock protect(data.mutex);

      auto live = data.traffic.find(i.skylines_id);
      if (live != data.traffic.end()) {
        if (live->second.location != i.location)
          modified = true;

        i.location = live->second.location;

        if (i.location.IsValid() &&
            CommonInterface::Basic().location_available)
          i.vector = GeoVector(CommonInterface::Basic().location,
                               i.location);
      } else {
        if (i.location.IsValid() || i.vector.IsValid())
          /* this item has disappeared: redraw the list */
          modified = true;

        i.location.SetInvalid();
        i.vector.SetInvalid();
      }
#endif
    }
  }

  last_update = max_time;

  if (modified)
    GetList().Invalidate();
}
Example #22
0
/**
 * @function HeaderRefresh
 * @brief List header task
 * @param void *_g_obj: pointer to the generic object of the header
 * @param void *_obj: pointer to the specific object of the header
 * @return none
 */
static void HeaderRefresh(void *_g_obj, void *_obj) {

  g_obj_st *g_obj;
  list_header_st *header;
  list_st *list;
  category_st *category;
  coord_t x, xt;
  bool bRefresh = false;

  /*retreive generic & specific object + pointer to the associated list*/
  if(_g_obj != NULL && _obj != NULL) {
    g_obj = (g_obj_st *) _g_obj;
    header = (list_header_st *) _obj;
    list = GetList(header->g_obj_list);

    /*touchscreen?*/
    if(GUI_ObjIsPressed(g_obj)) {

      /*previous state == released?*/
      if(header->xt < 0) {

        GUI_ReadTouchScreen(&xt, NULL);
        header->xt = xt;

        /*retrieve the category corresponding to the touchscreen y*/
        category = list->pCategory;
        x = g_obj->rec.x - list->hScroll.offset;
        while(category != NULL) {

          if(xt < x + category->w) break;

          else {
            x += category->w;
            category = category->next;
          }

        }

        if(category != NULL) {

          /*touched category == previous one? reverse the sort*/
          if(list->pSelectedCategory == category) {
            list->bReversedSort = !list->bReversedSort;
            bRefresh = true;
          }
          /*else, use the touched category for sort*/
          else {
            list->pSelectedCategory = category;
            list->bReversedSort = false;
            bRefresh = true;
          }
        }

        /*important, the header shall handle the refresh of its parent list !*/
        if(bRefresh) {
          GUI_ObjSetNeedRefresh(g_obj, true);
          GUI_ObjSetNeedRefresh(header->g_obj_list, true);
        }
      }
    }
    else {
      header->xt = -1;
    }
  }
}
NS_IMETHODIMP
nsCharsetConverterManager::GetCharsetDetectorList(nsIUTF8StringEnumerator** aResult)
{
  return GetList(NS_LITERAL_CSTRING("charset-detectors"),
                 NS_LITERAL_CSTRING("chardet."), aResult);
}
Example #24
0
BOOL CFileSharingPage::OnInitDialog()
{
	CFilePropertiesPage::OnInitDialog();

	m_wndTags.AddString( L"" );

	{
		CQuickLock oLock( UploadQueues.m_pSection );

		CList< CString > pAdded;

		for ( POSITION pos = UploadQueues.GetIterator(); pos; )
		{
			CUploadQueue* pQueue = UploadQueues.GetNext( pos );

			if ( ! pQueue->m_sShareTag.IsEmpty() )
			{
				if ( pAdded.Find( pQueue->m_sShareTag ) == NULL )
				{
					pAdded.AddTail( pQueue->m_sShareTag );
					m_wndTags.AddString( pQueue->m_sShareTag );
				}
			}
		}

		if ( pAdded.IsEmpty() )
		{
			m_wndTags.AddString( L"Release" );
			m_wndTags.AddString( L"Popular" );
		}
	}

	{
		CQuickLock oLock( Library.m_pSection );

		if ( CLibraryFile* pSingleFile = GetFile() )
		{
			m_bOverride	= pSingleFile->IsSharedOverride();
			m_bShare	= pSingleFile->IsShared();
			m_sTags		= pSingleFile->m_sShareTags;
		}
		else
		{
			CLibraryListPtr pList( GetList() );
			if ( pList )
			{
				for ( POSITION pos = pList->GetHeadPosition(); pos; )
				{
					if ( CLibraryFile* pFile = pList->GetNextFile( pos ) )
					{
						m_bOverride	= pFile->IsSharedOverride();
						m_bShare	= pFile->IsShared();
						m_sTags		= pFile->m_sShareTags;
					}
				}
			}
		}
	}

	UpdateData( FALSE );
	m_wndShare.EnableWindow( m_bOverride );

	return TRUE;
}
Example #25
0
		Base::Base()
		{
			GetList().push_back( this );
		}
Example #26
0
//---------------------------------------------------------------------------
void __fastcall TMainForm::IdTCPServerExecute(TIdPeerThread *AThread)
{

    AnsiString s;
    AnsiString sCommand;
    AnsiString sAction;
    TFileStream* tmpfStream;
    Graphics::TBitmap *tbm;

try
{
s = UpperCase(AThread->Connection->ReadLn("",5000));

sCommand = s.SubString (1,3);
sAction = s.SubString(5,s.Length()-4);

if (sCommand == "LST")
   {
    AThread->Connection->WriteLn(GetList());
    AThread->Connection->Disconnect();
   }
else if (sCommand == "PIC")
    {
    if (FileExists(ExtractFileDir(ParamStr(0)) + "\\images\\" + sAction))
        {
        lstRequests->Items->Add("Serving up: " + sAction);
        // open file stream to image requested
        tmpfStream = new TFileStream(ExtractFileDir(ParamStr(0)) + "\\images\\" + sAction,fmOpenRead |fmShareDenyNone);
        // copy file stream to write stream
        AThread->Connection->OpenWriteBuffer(-1);
        AThread->Connection->WriteStream(tmpfStream,true,false);
        AThread->Connection->CloseWriteBuffer();
        // free the file stream
        delete tmpfStream;
        tmpfStream=NULL;
        lstRequests->Items->Add("File transfer completed");
        AThread->Connection->Disconnect();
        }
        else
          {AThread->Connection->WriteLn("ERR - Requested file does not exist");
           AThread->Connection->Disconnect();
          }
    }
else if (sCommand == "SRN")
   {
    // in production version you would use a unique file name such as one generated
    // from a tickcount plus clint IP / id etc.
    // take snapshot
    lstRequests->Items->Add("Taking screen snap shot");

    tbm = new Graphics::TBitmap();

    ScreenShot(0,0,Screen->Width,Screen->Height,tbm);
    if (FileExists (ExtractFileDir(ParamStr(0)) + "\\images\\ScreenShot.BMP"))
        DeleteFile(ExtractFileDir(ParamStr(0)) + "\\images\\ScreenShot.BMP");
    tbm->SaveToFile(ExtractFileDir(ParamStr(0)) + "\\images\\ScreenShot.BMP");
    tbm->FreeImage();
    delete tbm;
    tbm=NULL;

    lstRequests->Items->Add("Serving up: SCREENSHOT.BMP");
    // open file stream to image requested
    tmpfStream = new TFileStream(ExtractFileDir(ParamStr(0)) + "\\images\\ScreenShot.BMP",fmOpenRead | fmShareDenyNone);
    // copy file stream to write stream
    AThread->Connection->OpenWriteBuffer(-1);
    AThread->Connection->WriteStream(tmpfStream,true,false);
    AThread->Connection->CloseWriteBuffer();
    // free the file stream
    delete tmpfStream;
    tmpfStream=NULL;
    lstRequests->Items->Add("File transfer completed");
    AThread->Connection->Disconnect();
    }
else
if ((sCommand != "LST") && (sCommand != "PIC") && (sCommand != "SRN"))
     {
     AThread->Connection->WriteLn("ERR : Unknown command / action");
     AThread->Connection->Disconnect();
     }

     }


catch (Exception& E)
{
ShowMessage(E.Message);
}


}
Example #27
0
 unsigned GetCursorIndex() const {
   return GetList().GetCursorIndex();
 }
Example #28
0
 gcc_pure
 const char *GetSelectedAddress() const {
   return items[GetList().GetCursorIndex()].address.c_str();
 }
Example #29
0
void
TaskEditPanel::OnEditTurnpointClicked()
{
  EditTaskPoint(GetList().GetCursorIndex());
}
Example #30
0
void GameManager::CheckKey()
{
	if (GameStart() && !GamePause() && !GameOver() )
	{
		if (GetKey('w') || GetKey('W') || GetKey(VK_UP)) { MovePlane(Up); }
		if (GetKey('s') || GetKey('S') || GetKey(VK_DOWN)) { MovePlane(Down); }
		if (GetKey('a') || GetKey('A') || GetKey(VK_LEFT)) { MovePlane(Left); }
		if (GetKey('d') || GetKey('D') || GetKey(VK_RIGHT)) { MovePlane(Right); }
		if (!(GetKey('a') || GetKey('A') || GetKey(VK_LEFT)) && !(GetKey('d') || GetKey('D') || GetKey(VK_RIGHT)) ) { MovePlane(Stay); }

		//功能检测
		if (GetKey('G') || GetKey('g'))
		{
			OnGod();
		}

		if (GetKey('F') || GetKey('f'))
		{
			OffGod();
		}

		if (GameManager::GetKey(VK_SPACE))//!GetPlayer()->Kill()
		{
			Player* p = GetPlayer();
			if (p->FireStatus())
			{
				Play(_T("Player_Shot"));
				Produce(_T("Weapon"), Point(p->X() + p->Width() / 2 - 3, p->Y() - 4), p->WeaponID());
			}
		}

		if (GetKey('Q') || GetKey('q'))
		{
			Player* p = GetPlayer();
			if (p->FireStatus())
			{
				Produce(_T("Weapon"), Point(p->X() + p->Width() / 2 - 3, p->Y() - 4),11, GetList(Index_Enemy));
			}
		}
		if (GetKey('Z') || GetKey('z'))
		{
			CList<GameObject*, GameObject*> *now = GetList(Index_Angela);
			POSITION pos = now->GetHeadPosition();
			while (pos != NULL)
			{
				Angela* angela_ = static_cast<Angela*>(now->GetNext(pos));
				if (angela_->Op() == 1) {
					angela_->SetX(GetPlayer()->X() - 80);
					angela_->SetY(GetPlayer()->Y());
					angela_->Op(3, angela_->Position(), GetPlayer()->Position(), GetPlayer()->SpeedX(), GetPlayer()->SpeedY());
				}
				else if (angela_->Op() == 2)
				{
					angela_->SetX(GetPlayer()->X() + 80);
					angela_->SetY(GetPlayer()->Y());
					angela_->Op(3, angela_->Position(), GetPlayer()->Position(), GetPlayer()->SpeedX(), GetPlayer()->SpeedY());
				}
				
			}
		}
		if (GetKey('X') || GetKey('x'))
		{
			CList<GameObject*, GameObject*> *now = GetList(Index_Angela);
			POSITION pos = now->GetHeadPosition();
			while (pos != NULL)
			{
				Angela* angela_ = static_cast<Angela*>(now->GetNext(pos));
				if (angela_->Op() == 1) 
				{
					angela_->Op(1,  angela_->Position(), GetPlayer()->Position(), 0,0);
				}
				else if (angela_->Op() == 2)
				{
					angela_->Op(2,  angela_->Position(), GetPlayer()->Position(), 0,0);
				}
				

			}
		}
		if (GameManager::GetKey(VK_ESCAPE))
		{
			PauseGame();
		}
	}

	if (GameManager::GetKey(VK_RETURN))
	{
		if (GameStart() && GamePause() )
		{
			ResumeGame();
		}
		else if(!GameStart())
		{
			StartGame();
			Play(_T("Mission_Begin"));
		}
	}
}