void ChooseVariableDialog::OnFindUndeclaredSelected(wxCommandEvent& event)
{
    std::set<gd::String> allVariables;
    if ( associatedProject != NULL && associatedLayout == NULL ) allVariables = EventsVariablesFinder::FindAllGlobalVariables(associatedProject->GetCurrentPlatform(), *associatedProject);
    else if ( associatedProject != NULL && associatedLayout != NULL && associatedObject == NULL  ) allVariables = EventsVariablesFinder::FindAllLayoutVariables(associatedProject->GetCurrentPlatform(), *associatedProject, *associatedLayout);
    else if ( associatedProject != NULL && associatedLayout != NULL && associatedObject != NULL ) allVariables = EventsVariablesFinder::FindAllObjectVariables(associatedProject->GetCurrentPlatform(), *associatedProject, *associatedLayout, *associatedObject);
    else return;

    //Construct a wxArrayString with not declared variables
    wxArrayString variablesNotDeclared;
    for (std::set<gd::String>::const_iterator it = allVariables.begin();it!=allVariables.end();++it)
    {
        if ( !temporaryContainer->Has(*it) )
            variablesNotDeclared.push_back(*it);
    }

    //Request the user to choose which variables to add.
    wxMultiChoiceDialog dialog(this, _("These variables are used but not declared:\nCheck the variables to be added to the list."), _("Adding undeclared variables"), variablesNotDeclared, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL);
    dialog.ShowModal();

    //Add selection
    wxArrayInt selection = dialog.GetSelections();
    for (std::size_t i = 0;i<selection.size();++i)
    {
        temporaryContainer->InsertNew(variablesNotDeclared[selection[i]],temporaryContainer->Count());
        modificationCount++;
    }

    if ( !selection.empty() ) RefreshAll();
}
Example #2
0
void StatBar::SetContent( EChesses* aec )
{
	//CCLog(">[StatBar] SetContent.");
	if(!aec){
		m_ec = aec;
		setVisible(false);
		return;
	}
	//CCLog(">[StatBar] SetContent. | None Null Pass.");

	if(m_ec == aec){
		setVisible(true);
		return;
	}
	//CCLog(">[StatBar] SetContent. | New Stat Calculate.");

	m_ec = aec;
	CCLog(">[StatBar] setContent | Name: %s", m_ec->m_pChara->m_sName.c_str());

	msb_SoulBall->setSum(m_ec->m_pChara->getSHP());
	mb_BloodOne->revalue(m_ec->m_pChara->getvalue("hp"));
	setHead(m_ec->m_pChara->msBHead.c_str());

	RefreshAll();
	SetNullAct();
	setVisible(true);
}
Example #3
0
//
// Update the horizontal scrollbar or remove it if not needed
//
void
KeyView::UpdateHScroll()
{
   // Get the internal dimensions of the view
   wxRect r = GetClientRect();

   // Calculate the full line width
   mWidth = KV_LEFT_MARGIN +
            mCommandWidth +
            KV_COLUMN_SPACER +
            mKeyWidth +
            KV_VSCROLL_WIDTH;

   // Retrieve the current horizontal scroll amount
   mScrollX = GetScrollPos(wxHORIZONTAL);

   if (mWidth <= r.GetWidth())
   {
      // Remove the scrollbar if it will fit within client width
      SetScrollbar(wxHORIZONTAL, 0, 0, 0);
   }
   else
   {
      // Set scrollbar metrics
      SetScrollbar(wxHORIZONTAL, mScrollX, r.GetWidth(), mWidth);
   }

   // Refresh the entire view
   RefreshAll();
}
Example #4
0
BOOL SERVER::SetMonitor (BOOL fShouldMonitor, ULONG *pStatus)
{
   BOOL rc = TRUE;
   ULONG status = 0;

   if (m_fMonitor != fShouldMonitor)
      {
      LPCELL lpCell;
      if ((lpCell = m_lpiCell->OpenCell (&status)) == NULL)
         rc = FALSE;
      else
         {
         NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusBegin, GetIdentifier());

         if ((m_fMonitor = fShouldMonitor) == FALSE)
            {
            FreeAll();
            (lpCell->m_nServersUnmonitored)++;
            }
         else // (fMonitor == TRUE)
            {
            (lpCell->m_nServersUnmonitored)--;
            Invalidate();
            rc = RefreshAll (&status);
            }

         NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusEnd, GetIdentifier(), m_lastStatus);
         lpCell->Close();
         }
      }

   if (!rc && pStatus)
      *pStatus = status;
   return rc;
}
Example #5
0
void      RichText::DestroyTable(int table)
{
	int pi;
	RichTxt& txt = GetTableUpdateText(table, style, pi);
	RichPara p;
	txt.Set(pi, p, style);
	RefreshAll();
}
Example #6
0
void RichText::ApplyZoom(Zoom z)
{
	if(z.m == z.d)
		return;
	RichStyles ostyle(style, 1);
	for(int i = 0; i < style.GetCount(); i++)
		style[i].format *= z;
	RichTxt::ApplyZoom(z, ostyle, style);
	RefreshAll();
}
void wxListBox::Clear()
{
    DoClear();

    m_updateScrollbarY = true;

    RefreshHorzScrollbar();

    RefreshAll();
}
Example #8
0
void GotoFileList::UpdateList(const bool reloadAll) {
	const FileEntry* selEntry = GetSelectedAction();
	const int topLine = GetFirstVisibleLine();
	int selection = -1;
	const unsigned int startItem = reloadAll ? 0 : m_items.size();

	// Insert new items
	if (m_searchText.empty()) {
		// Copy all actions to items
		m_items.resize(m_actions.size());
		for (unsigned int i = startItem; i < m_actions.size(); ++i) {
			m_items[i].file_entry = m_actions[i];
			m_items[i].hlChars.clear();
		}
	}
	else {
		// Copy matching actions to items
		for (unsigned int i = m_actionCount; i < m_actions.size(); ++i) {
			if (m_tempEntry->path.empty() || m_actions[i]->path != m_tempEntry->path)
				AddFileIfMatching(m_searchText, m_actions[i]);
		}
	}

	// Sort the items
	if (startItem) {
		sort(m_items.begin() + startItem, m_items.end());
		inplace_merge(m_items.begin(), m_items.begin() + startItem, m_items.end());
	}
	else sort(m_items.begin(), m_items.end());

	// Keep same selection
	if (selEntry) {
		for (unsigned int i = 0; i < m_items.size(); ++i) {
			if (m_items[i].file_entry == selEntry) {
				selection = i;
				break;
			}
		}
	}

	// Refresh and redraw listCtrl
	Freeze();
	SetItemCount(m_items.size());
	SetSelection(selection);

	if (selection == -1)
		ScrollToLine(topLine);
	else if (!IsVisible(selection))
		ScrollToLine(selection);

	RefreshAll();
	Thaw();

	m_actionCount = m_actions.size();
}
Example #9
0
void wxSimpleHtmlListBox::UpdateCount()
{
    wxASSERT(m_items.GetCount() == m_HTMLclientData.GetCount());
    wxHtmlListBox::SetItemCount(m_items.GetCount());

    // very small optimization: if you need to add lot of items to
    // a wxSimpleHtmlListBox be sure to use the
    // wxSimpleHtmlListBox::Append(const wxArrayString&) method instead!
    if (!this->IsFrozen())
        RefreshAll();
}
bool wxListBox::SetFont(const wxFont& font)
{
    if ( !wxControl::SetFont(font) )
        return false;

    CalcItemsPerPage();

    RefreshAll();

    return true;
}
Example #11
0
void ClueListBox::OnSelection(wxCommandEvent & evt)
{
    if (m_clues && m_clues->size() <= evt.GetSelection())
    {
        InvalidateCache();
        RefreshAll();
    }
    else
    {
        evt.Skip();
    }
}
Example #12
0
void RichText::RemoveParaSpecial(int table, bool before)
{
	int pi;
	RichTxt& txt = GetTableUpdateText(table, style, pi);
	if(before)
		pi--;
	else
		pi++;
	ASSERT(txt.IsPara(pi) && txt.GetPartLength(pi) == 0);
	txt.part.Remove(pi);
	RefreshAll();
}
Example #13
0
int  RichText::SetTable(int pos, const RichTable& table)
{
	RefreshAll();
	RichPos p = GetRichPos(pos);
	int bpos = pos;
	RichTxt& txt = GetUpdateText(pos);
	int pi = txt.FindPart(pos);
	ASSERT(pos == 0 && txt.GetPartLength(pi) == 0 && txt.IsPara(pi));
	RichTable pt(table, 1);
	txt.SetPick(pi, pt);
	return GetRichPos(bpos).table;
}
Example #14
0
void RichText::InsertParaSpecial(int table, bool before, const RichPara::Format& fmt)
{
	int pi;
	RichTxt& txt = GetTableUpdateText(table, style, pi);
	if(!before)
		pi++;
	txt.RefreshAll();
	txt.part.Insert(pi);
	RichPara p;
	p.format = fmt;
	txt.Set(pi, p, style);
	RefreshAll();
}
Example #15
0
void RichText::ClearTable(int table, const Rect& sel)
{
	RichTable& tab = GetUpdateTable(table);
	for(int i = sel.top; i <= sel.bottom; i++)
		for(int j = sel.left; j <= sel.right; j++) {
			if(tab(i, j)) {
				tab.InvalidateRefresh(i, j);
				tab[i][j].ClearText(tab[i][j].text.GetFirstFormat(style), style);
			}
		}
	tab.Normalize();
	RefreshAll();
}
Example #16
0
void FindCmdDlg::ActionList::SetAllItems() {
	m_items.clear();
	m_items.resize(m_actions.size());

	for (unsigned int i = 0; i < m_actions.size(); ++i) {
		m_items[i].action = m_actions[i];
	}

	sort(m_items.begin(), m_items.end());
	SetItemCount(m_items.size());
	SetSelection(-1);
	RefreshAll();
}
Example #17
0
void ControlCenter::Run() {
  Initialize();
  bool need_refresh = false;
  for (bool done = false; !done;) {
    if (need_refresh) {
      // refresh the window since we call endwin before invoking bbs code.
      RefreshAll();
      need_refresh = false;
    }

    wtimeout(commands_->window(), 500);
    int key = commands_->GetChar();
    if (key == ERR) {
      // we have a timeout. process other events
      need_refresh = false;
      UpdateLog();
      UpdateStatus(status_.get());
      CleanNetIfNeeded();
      RunEventsIfNeeded();
      continue;
    }
    need_refresh = true;
    session()->SetWfcStatus(2);
    // Call endwin since we'll be out of curses IO
    endwin();
    switch (toupper(key)) {
    case 'B': wfc_command(INST_LOC_BOARDEDIT, boardedit, cleanup_net); log_->Put("Ran BoardEdit"); break;
    case 'C': wfc_command(INST_LOC_CHAINEDIT, chainedit); log_->Put("Ran ChainEdit"); break;
    case 'D': wfc_command(INST_LOC_DIREDIT, dlboardedit); log_->Put("Ran DirEdit"); break;
    case 'E': wfc_command(INST_LOC_EMAIL, send_email_f, cleanup_net); break;
    case 'G': wfc_command(INST_LOC_GFILEEDIT, gfileedit); break;
    case 'H': wfc_command(INST_LOC_EVENTEDIT, eventedit); break;
    case 'I': wfc_command(INST_LOC_VOTEEDIT, ivotes); break;
    case 'J': wfc_command(INST_LOC_CONFEDIT, edit_confs); break;
    case 'L': wfc_command(INST_LOC_WFC, view_sysop_log_f); break;
    case 'M': wfc_command(INST_LOC_EMAIL, read_mail_f, cleanup_net); break;
    case 'N': wfc_command(INST_LOC_WFC, []() { print_local_file("net.log"); }); break;
    case 'P': wfc_command(INST_LOC_WFC, print_pending_list); break;
    case 'R': wfc_command(INST_LOC_MAILR, mailr); break;
    case 'S': wfc_command(INST_LOC_WFC, prstatus, getkey_f); break;
    case 'U': wfc_command(INST_LOC_UEDIT, []() { uedit(1, UEDIT_NONE); } ); break;
    case 'Y': wfc_command(INST_LOC_WFC, view_yesterday_sysop_log_f); break;
    case 'Z': wfc_command(INST_LOC_WFC, zlog, getkey_f); break;
    case 'Q': done=true; break;
    // ansicallout doesn't work due to arrow keys and other drawing problems with it under curses.
    // case '/': wfc_command(INST_LOC_NET, []() { force_callout(0); }); log_->Put("Ran Network Callout"); break;
    case ' ': log_->Put("Not Implemented Yet"); break; 
    }
    TouchAll();
  }
}
void wxGISToolExecuteView::OnObjectRefreshed(wxGxCatalogEvent& event)
{
    if(m_nParentGxObjectId == event.GetObjectID())
        RefreshAll();

    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
    if(!pGxObject)
        return;
    wxGxObject* pParentGxObject = pGxObject->GetParent();
    if(pParentGxObject && pParentGxObject->GetId() == m_nParentGxObjectId)
    {
        OnObjectChanged(event);
    }
}
Example #19
0
void       RichText::ApplyTableFormatInfo(int table, const Rect& sel, const RichText::FormatInfo& fi)
{
	RichTable& tab = GetUpdateTable(table);
	for(int i = sel.top; i <= sel.bottom; i++)
		for(int j = sel.left; j <= sel.right; j++) {
			if(tab(i, j)) {
				tab.InvalidateRefresh(i, j);
				RichTxt& txt = tab[i][j].text;
				txt.ApplyFormat(fi, 0, txt.GetPartCount(), style);
			}
		}
	tab.Normalize();
	RefreshAll();
}
void wxGxContentView::SetStyle(wxGISEnumContentsViewStyle style)
{
    if(m_current_style == style)
        return;


    if(m_current_style == enumGISCVReport)
    {
        //store values
        m_anWidth.Clear();
        for (int i = 0; i < GetColumnCount(); ++i)
        {
            m_anWidth.Add( GetColumnWidth(i) );
        }
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
        m_anOrder = GetColumnsOrder();
#endif
    }
    m_current_style = style;

	switch(m_current_style)
	{
	case enumGISCVReport:
        SetSingleStyle(wxLC_REPORT);

        InitColumns();

        for(size_t i = 0; i < m_anWidth.GetCount(); ++i)
            SetColumnWidth(i, m_anWidth[i]);
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
        SetColumnsOrder(m_anOrder);
#endif

        SetColumnImage(m_currentSortCol, m_bSortAsc ? 0 : 1);

		break;
	case enumGISCVSmall:
        SetSingleStyle(wxLC_SMALL_ICON);
		break;
	case enumGISCVLarge:
        SetSingleStyle(wxLC_ICON);
		break;
	case enumGISCVList:
        SetSingleStyle(wxLC_LIST);
		break;
	}

    RefreshAll();
}
Example #21
0
void SymbolList::ActionList::Find(const wxString& searchtext, bool refresh) {
	m_searchText = searchtext; // cache for later updates

	if (searchtext.empty()) {
		SetAllItems();
		return;
	}

	// Convert to upper case for case insensitive search
	const wxString text = searchtext.Upper();

	m_items.clear();
	vector<unsigned int> hlChars;
	for (unsigned int i = 0; i < m_actions.GetCount(); ++i) {
		const wxString& name = m_actions[i];
		unsigned int charpos = 0;
		wxChar c = text[charpos];
		hlChars.clear();

		for (unsigned int textpos = 0; textpos < name.size(); ++textpos) {
			if ((wxChar)wxToupper(name[textpos]) == c) {
				hlChars.push_back(textpos);
				++charpos;
				if (charpos == text.size()) {
					// All chars found.
					m_items.push_back(aItem(i, &m_actions[i], hlChars));
					break;
				}
				else c = text[charpos];
			}
		}
	}

	sort(m_items.begin(), m_items.end());

	Freeze();
	SetItemCount(m_items.size());
	if (refresh) {
		if (m_items.empty()) SetSelection(-1); // deselect
		else SetSelection(0);

		RefreshAll();
	}
	Thaw();
}
/**
 * Move up a variable
 */
void ChooseVariableDialog::OnMoveUpVarSelected(wxCommandEvent& event)
{
    UpdateSelectedAndParentVariable();
    for (std::size_t i = 1;i<temporaryContainer->Count();++i)
    {
        const std::pair<gd::String, gd::Variable> & currentVar = temporaryContainer->Get(i);
        if ( currentVar.first == selectedVariableName)
        {
            const std::pair<gd::String, gd::Variable> & prevVar = temporaryContainer->Get(i-1);
            temporaryContainer->Swap(i, i-1);
            RefreshAll();

            modificationCount++;
            return;
        }
    }

}
Example #23
0
//
// Handle the wxEVT_SCROLL event
//
void
KeyView::OnScroll(wxScrollWinEvent & event)
{
   // We only care bout the horizontal scrollbar.
   if (event.GetOrientation() != wxHORIZONTAL)
   {
      // Allow further processing
      event.Skip();
      return;
   }

   // Get new scroll position and scroll the view
   mScrollX = event.GetPosition();
   SetScrollPos(wxHORIZONTAL, mScrollX);

   // Refresh the entire view
   RefreshAll();
}
Example #24
0
bool RichTxt::Update(ParaOp& op)
{
	bool val = false;
	for(int i = 0; i < part.GetCount(); i++)
		if(IsTable(i)) {
			RichTable& tab = part[i].Get<RichTable>();
			for(int i = 0; i < tab.GetRows(); i++)
				for(int j = 0; j < tab.GetColumns(); j++)
					if(tab(i, j))
						if(tab[i][j].text.Update(op)) {
							tab.InvalidateRefresh(i, j);
							val = true;
						}
		}
		else
		if(op(part[i].Get<Para>()))
			val = true;
	RefreshAll();
	return val;
}
void muhkuh_dirlistbox::Delete(unsigned int n)
{
    size_t sizLineCount;


    // get old line count
    sizLineCount = m_astrPaths.GetCount();
    if( n<sizLineCount )
    {
        // remove the item from the path array
        m_astrPaths.RemoveAt(n);
        m_aiPathPixelHeight.RemoveAt(n);
        m_aiPathPixelWidth.RemoveAt(n);
        // set new linecount
        --sizLineCount;
        SetLineCount(sizLineCount);
        // Redraw all modified lines
        RefreshAll();
    }
}
Example #26
0
void GotoFileList::Find(const wxString& searchtext, const std::map<wxString,wxString>& triggers) {
	m_tempEntry->Clear();

	if (searchtext.empty()) {
		// Remove highlights
		m_searchText.clear();
		SetSelection(-1); // de-select
		ScrollToLine(0);
		UpdateList(true);
		return;
	}

	// Convert to lower case for case insensitive search
	m_searchText = searchtext.Lower();

	// Find all matching filenames
	m_items.clear();
	std::vector<unsigned int> hlChars;
	for (unsigned int i = 0; i < m_actions.size(); ++i)
		AddFileIfMatching(m_searchText, m_actions[i]);

	sort(m_items.begin(), m_items.end());

	// Check if we have a matching trigger
	int selection = FindMatchesAndSelection(triggers);

	// Update display
	Freeze();
	SetItemCount(m_items.size());

	if (m_items.empty())
		SetSelection(-1); // deselect
	else if (selection != wxNOT_FOUND)
		SetSelection(selection);
	else
		SetSelection(0);

	RefreshAll();
	Thaw();
}
Example #27
0
void  RichText::JoinCell(int table, const Rect& sel)
{
	RichTable& tab = GetUpdateTable(table);
	RichCell& cell = tab[sel.top][sel.left];
	cell.vspan = sel.bottom - sel.top;
	cell.hspan = sel.right - sel.left;
	for(int i = sel.top; i <= sel.bottom; i++)
		for(int j = sel.left; j <= sel.right; j++) {
			if(tab(i, j) && (i != sel.top || j != sel.left)) {
				RichTxt& t = tab[i][j].text;
				for(int pi = 0; pi < t.GetPartCount(); pi++)
					if(t.IsTable(pi))
						cell.text.CatPick(t.part[pi].Get<RichTable>());
					else
					if(pi < t.GetPartCount() - 1 || t.GetPartLength(pi))
						cell.text.Cat(t.Get(pi, style), style);
				tab[i][j].ClearText();
			}
		}
	tab.Normalize();
	RefreshAll();
}
void wxListBox::DoSetItems(const wxArrayString& items, void **clientData)
{
    DoClear();

    size_t count = items.GetCount();
    if ( !count )
        return;

    m_strings->Alloc(count);

    m_itemsClientData.Alloc(count);
    for ( size_t n = 0; n < count; n++ )
    {
        size_t index = DoAppendOnly(items[n]);

        m_itemsClientData.Insert(clientData ? clientData[n] : NULL, index);
    }

    m_updateScrollbarY = true;

    RefreshAll();
}
Example #29
0
// -------------------------------------------------------------------------------- //
void guAlListBox::ReloadItems( bool reset )
{
    wxArrayInt Selection;
    int FirstVisible = GetVisibleRowsBegin();

    if( reset )
        SetSelection( -1 );
    else
        Selection = GetSelectedItems( false );

    m_Items->Empty();

    GetItemsList();
    m_Items->Insert( new guAlbumItem( 0, wxString::Format( wxT( "%s (%lu)" ), _( "All" ), m_Items->Count() ) ), 0 );
    SetItemCount( m_Items->Count() );

    if( !reset )
    {
      SetSelectedItems( Selection );
      ScrollToRow( FirstVisible );
    }
    RefreshAll();
}
Example #30
0
void SymbolList::ActionList::SetAllItems() {
	m_items.clear();

	Freeze();

	if (m_searchText.empty()) {
		m_items.resize(m_actions.size());
		for (unsigned int i = 0; i < m_actions.size(); ++i) {
			m_items[i].id = i;
			m_items[i].action = &m_actions[i];
		}

		//sort(m_items.begin(), m_items.end());
		SetItemCount(m_items.size());
	}
	else {
		Find(m_searchText, false);
	}

	SetSelection(-1);
	RefreshAll();
	Thaw();
}