bool wxSymbolListCtrl::DoSetCurrent(int current)
{
    wxASSERT_MSG( current == wxNOT_FOUND ||
                    (current >= m_minSymbolValue && current <= m_maxSymbolValue),
                  _T("wxSymbolListCtrl::DoSetCurrent(): invalid symbol value") );

    if ( current == m_current )
    {
        // nothing to do
        return false;
    }

    if ( m_current != wxNOT_FOUND )
        RefreshLine(SymbolValueToLineNumber(m_current));

    m_current = current;

    if ( m_current != wxNOT_FOUND )
    {
        int lineNo = SymbolValueToLineNumber(m_current);

        // if the line is not visible at all, we scroll it into view but we
        // don't need to refresh it -- it will be redrawn anyhow
        if ( !IsVisible(lineNo) )
        {
            ScrollToLine(lineNo);
        }
        else // line is at least partly visible
        {
            // it is, indeed, only partly visible, so scroll it into view to
            // make it entirely visible
            while ( unsigned(lineNo) == GetLastVisibleLine() &&
                    ScrollToLine(GetVisibleBegin()+1) )
                ;

            // but in any case refresh it as even if it was only partly visible
            // before we need to redraw it entirely as its background changed
            RefreshLine(lineNo);
        }
    }

    return true;
}
Beispiel #2
0
void ProsodyDisplay::OnMouse(wxMouseEvent& event)
{//============================================
	int line;
	int ix;
	int xpos=0;


	wxClientDC dc(this);
	PrepareDC(dc);
	wxPoint pt(event.GetLogicalPosition(dc));

	if(selected_ph >= 0)
	{
		// find line for previously selected phoneme
		for(line=0; line<num_lines; line++)
			if(linetab[line+1] > selected_ph) break;
		RefreshLine(line);
		selected_ph = -1;
	}

	line = pt.y / FRAMEHEIGHT;

	// find which phoneme is selected on this line
	for(ix=linetab[line]; (ix<linetab[line+1]) && (ix<numph); ix++)
	{
		xpos += GetWidth(&phlist[ix]);
		if(xpos > pt.x)
		{
			selected_ph = ix;
			SelectPh(selected_ph);
			break;
		}
	}

	RefreshLine(line);

	if(event.RightDown())
	{
		PopupMenu(menu_prosody);
	}

}  // end of ProsodyDisplay::OnMouse
Beispiel #3
0
void ListSvcs::purgeData()
{
  QListViewItem *item=list_log_list->selectedItem();
  if(item==NULL) {
    return;
  }
  SvcRecDialog *dialog=new SvcRecDialog(item->text(0),this,"dialog");
  dialog->exec();
  delete dialog;
  RefreshLine(item);
}
Beispiel #4
0
void
ClueListBox::SetClueNumber(unsigned int number)
{
    int index = FindClue(number);
    wxASSERT(index != wxNOT_FOUND || number == 0);
    SetSelection(index);
    if (index != wxNOT_FOUND)
    {
        RefreshLine(index);
        //Update(); // We shouldn't really need this
    }
}
Beispiel #5
0
//
// Handle the wxEVT_KILL_FOCUS event
//
void
KeyView::OnKillFocus(wxFocusEvent & event)
{
   // Allow further processing
   event.Skip();

   // Refresh the selected line to adjust visual highlighting.
   if (GetSelection() != wxNOT_FOUND)
   {
      RefreshLine(GetSelection());
   }
}
Beispiel #6
0
bool wxVListBox::DoSetCurrent(int current)
{
    wxASSERT_MSG( current == wxNOT_FOUND ||
                    (current >= 0 && (size_t)current < GetItemCount()),
                  _T("wxVListBox::DoSetCurrent(): invalid item index") );

    if ( current == m_current )
    {
        // nothing to do
        return false;
    }

    if ( m_current != wxNOT_FOUND )
        RefreshLine(m_current);

    m_current = current;

    if ( m_current != wxNOT_FOUND )
    {
        // if the line is not visible at all, we scroll it into view but we
        // don't need to refresh it -- it will be redrawn anyhow
        if ( !IsVisible(m_current) )
        {
            ScrollToLine(m_current);
        }
        else // line is at least partly visible
        {
            // it is, indeed, only partly visible, so scroll it into view to
            // make it entirely visible
            while ( (size_t)m_current == GetLastVisibleLine() &&
                    ScrollToLine(GetVisibleBegin()+1) ) ;

            // but in any case refresh it as even if it was only partly visible
            // before we need to redraw it entirely as its background changed
            RefreshLine(m_current);
        }
    }

    return true;
}
Beispiel #7
0
bool ClueListBox::SetClue(const puz::Clue * clue)
{
    int index = FindClue(clue);
    // This doesn't work for diagramless puzzles
    // wxASSERT(index != wxNOT_FOUND || number == _T(""));
    SetSelection(index);
    if (index != wxNOT_FOUND)
    {
        RefreshLine(index);
        return true;
    }
    else
        return false;
}
Beispiel #8
0
void MacroCart::editMacroData()
{
    QListViewItem *item=rdcart_macro_list->selectedItem();

    if((item==NULL)||(item->text(0).isEmpty())) {
        return;
    }
    unsigned line=item->text(0).toUInt()-1;
    EditMacro *edit=new EditMacro(rdcart_events->command(line),this,"edit");
    if(edit->exec()!=-1) {
        RefreshLine(item);
        UpdateLength();
    }
    delete edit;
}
Beispiel #9
0
void MacroCart::AddLine(unsigned line,RDMacro *cmd)
{
    unsigned curr_line;

    QListViewItem *item=rdcart_macro_list->firstChild();
    for(int i=0; i<rdcart_macro_list->childCount(); i++) {
        if(((curr_line=(item->text(0).toUInt()-1))>=line)&&
                (!item->text(0).isEmpty())) {
            item->setText(0,QString().sprintf("%03u",curr_line+2));
        }
        item=item->nextSibling();
    }
    rdcart_events->insert(line,cmd);
    item=new QListViewItem(rdcart_macro_list);
    item->setText(0,QString().sprintf("%03u",line+1));
    RefreshLine(item);
    rdcart_macro_list->setSelected(item,true);
}
Beispiel #10
0
bool wxVListBox::Select(size_t item, bool select)
{
    wxCHECK_MSG( m_selStore, false,
                 _T("Select() may only be used with multiselection listbox") );

    wxCHECK_MSG( item < GetItemCount(), false,
                 _T("Select(): invalid item index") );

    bool changed = m_selStore->SelectItem(item, select);
    if ( changed )
    {
        // selection really changed
        RefreshLine(item);
    }

    DoSetCurrent(item);

    return changed;
}
Beispiel #11
0
/**
 * @brief RefreshPointGeometry refresh point on scene.
 * @param point point.
 */
void VToolPoint::RefreshPointGeometry(const VPointF &point)
{
    this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
    this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
    QRectF rec = QRectF(0, 0, radius*2/factor, radius*2/factor);
    rec.translate(-rec.center().x(), -rec.center().y());
    this->setRect(rec);
    this->setPos(point.toQPointF());
    this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
    disconnect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
    QFont font = namePoint->font();
    font.setPointSize(static_cast<qint32>(namePoint->FontSize()/factor));
    namePoint->setFont(font);
    namePoint->setText(point.name());
    namePoint->setPos(QPointF(point.mx(), point.my()));
    connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
    RefreshLine();
    this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
}
Beispiel #12
0
//
// Handle the wxEVT_SET_FOCUS event
//
void
KeyView::OnSetFocus(wxFocusEvent & event)
{
   // Allow further processing
   event.Skip();

   // Refresh the selected line to pull in any changes while
   // focus was away...like when setting a new key value.  This
   // will also refresh the visual (highlighted) state.
   if (GetSelection() != wxNOT_FOUND)
   {
      RefreshLine(GetSelection());
   }

#if wxUSE_ACCESSIBILITY
   // Tell accessibility of the change
   mAx->SetCurrentLine(GetSelection());
#endif
}
Beispiel #13
0
bool wxVListBox::SelectRange(size_t from, size_t to)
{
    wxCHECK_MSG( m_selStore, false,
                 _T("SelectRange() may only be used with multiselection listbox") );

    // make sure items are in correct order
    if ( from > to )
    {
        size_t tmp = from;
        from = to;
        to = tmp;
    }

    wxCHECK_MSG( to < GetItemCount(), false,
                    _T("SelectRange(): invalid item index") );

    wxArrayInt changed;
    if ( !m_selStore->SelectRange(from, to, true, &changed) )
    {
        // too many items have changed, we didn't record them in changed array
        // so we have no choice but to refresh everything between from and to
        RefreshLines(from, to);
    }
    else // we've got the indices of the changed items
    {
        const size_t count = changed.GetCount();
        if ( !count )
        {
            // nothing changed
            return false;
        }

        // refresh just the lines which have really changed
        for ( size_t n = 0; n < count; n++ )
        {
            RefreshLine(changed[n]);
        }
    }

    // something changed
    return true;
}
void muhkuh_dirlistbox::StartEdit(unsigned int n)
{
    size_t sizLineCount;


    // get old line count
    sizLineCount = m_astrPaths.GetCount();
    if( n<sizLineCount )
    {
        // set the text ctrl contents
        m_ptTextCtrl->SetValue(m_astrPaths.Item(n));

        m_ptTextCtrl->Show(true);
        m_ptBrowseButton->Show(true);

        sizActiveItem = n;
        // Redraw the modified line
        RefreshLine(n);

        // set the focus to the text ctrl
        m_ptTextCtrl->SetFocus();
    }
}
Beispiel #15
0
void LayPause(Layer *layer, bool pause)
{
	Window *win;

	if (layer->l_pause.d == pause)
		return;

	if ((layer->l_pause.d = pause)) {
		/* Start pausing */
		layer->l_pause.top = layer->l_pause.bottom = -1;
		return;
	}

	/* Unpause. So refresh the regions in the displays! */
	if (layer->l_pause.top == -1 && layer->l_pause.bottom == -1)
		return;

	if (layer->l_layfn == &WinLf)	/* Currently, this will always be the case! */
		win = layer->l_data;
	else
		win = NULL;

	for (Canvas *cv = layer->l_cvlist; cv; cv = cv->c_lnext) {
		if (!cv->c_slorient)
			continue;	/* Wasn't split, so already updated. */

		display = cv->c_display;

		for (Viewport *vp = cv->c_vplist; vp; vp = vp->v_next) {
			for (int line = layer->l_pause.top; line <= layer->l_pause.bottom; line++) {
				int xs, xe;

				if (line + vp->v_yoff >= vp->v_ys && line + vp->v_yoff <= vp->v_ye &&
				    ((xs = layer->l_pause.left[line]) >= 0) &&
				    ((xe = layer->l_pause.right[line]) >= 0)) {
					xs += vp->v_xoff;
					xe += vp->v_xoff;

					if (xs < vp->v_xs)
						xs = vp->v_xs;
					if (xe > vp->v_xe)
						xe = vp->v_xe;

					if (layer->l_encoding == UTF8 && xe < vp->v_xe && win) {
						struct mline *ml = win->w_mlines + line;
						if (dw_left(ml, xe, UTF8))
							xe++;
					}

					if (xs <= xe)
						RefreshLine(line + vp->v_yoff, xs, xe, 0);
				}
			}
		}

		if (cv == D_forecv) {
			int cx = layer->l_x + cv->c_xoff;
			int cy = layer->l_y + cv->c_yoff;

			if (cx < cv->c_xs)
				cx = cv->c_xs;
			if (cy < cv->c_ys)
				cy = cv->c_ys;
			if (cx > cv->c_xe)
				cx = cv->c_xe;
			if (cy > cv->c_ye)
				cy = cv->c_ye;

			GotoPos(cx, cy);
		}
	}

	for (int line = layer->l_pause.top; line <= layer->l_pause.bottom; line++)
		layer->l_pause.left[line] = layer->l_pause.right[line] = -1;
}