Exemplo n.º 1
0
void TextComponent::CreateInspector(){

	std::function<void(std::string)> collback = [&](std::string name){
		ChangeText(name);
	};
	auto data = Window::CreateInspector();
	Window::AddInspector(new TemplateInspectorDataSet<std::string>("Text", &impl->mText, collback), data);
	Window::ViewInspector("Text", this, data);
}
DialogSelectHardware::DialogSelectHardware(QWidget *parent, int selectDevice) :
    QDialog(parent),
    ui(new Ui::DialogSelectHardware)
{
    deviceCount        = 0;
    deviceProp         = NULL;
    this->selectDevice = selectDevice;

    ui->setupUi(this);
    connect(ui->deviceComboBox , SIGNAL(currentIndexChanged(int)) , this , SLOT(ChangeText(int)));
    connect(ui->pushButton     , SIGNAL(clicked())                , this , SLOT(setDevice()));
    setListDevice();
    ChangeText(0);
}
Exemplo n.º 3
0
void TextRenderer::InsertText(const std::string& insert_str)
{
    if( !insert_str.empty() )
    {
        std::string old_str = GetText();
        int idx = utf8::trans(old_str.c_str()).from_offset(curPos);
    
        std::string new_str(old_str, 0, idx);
        new_str.append(insert_str);
        new_str.append(old_str, idx, old_str.length() - idx);
    
        ChangeText(new_str, curPos+utf8::trans(insert_str.c_str()).length());
    }
}
Exemplo n.º 4
0
void 
lt_XMLParser::Impl::ChangeTextOCR(
  const GUTF8String &value,
  const int width,
  const int height,
  const GP<DjVuFile> &dfile)
{
  if(value.length() && value.downcase() != "false")
  {
    const GP<ByteStream> bs=OCRcallback(value,DjVuImage::create(dfile));
    if( bs && bs->size() )
    {
      const GP<lt_XMLTags> tags(lt_XMLTags::create(bs));
      ChangeText(width,height,*dfile,*tags);
    }
  }
}
Exemplo n.º 5
0
void
lt_XMLParser::Impl::parse_text(
  const int width,
  const int height,
  const lt_XMLTags &GObject,
  DjVuFile &dfile )
{
  GPosition textPos = GObject.contains(hiddentexttag);
  if(textPos)
  {
    // loop through the hidden text - there should only be one 
    // if there are more ??only the last one will be saved??
    GPList<lt_XMLTags> textTags = GObject[textPos];
    GPosition pos = textTags;
    ChangeText(width,height,dfile,*textTags[pos]);
  }
}
Exemplo n.º 6
0
void CGUIContextHelp::Refresh(char* text)
{
	ChangeText(text);

/*
	background->Resize(sx+6,sy+2);
	
	background = new CGUIRectHost(-3,-1,sx+6,sy+2,backColor);
	SetPos(-3,-1);
	SetSize(sx+6,sy+2);
	border[0] = new CBltLine(x,y,x+sx,y,borderColor);
	border[1] = new CBltLine(x+sx,y,x+sx,y+sy,borderColor);
	border[2] = new CBltLine(x+sx,y+sy,x,y+sy,borderColor);
	border[3] = new CBltLine(x,y+sy,x,y,borderColor);
	background->RemoveFromTrash();

	SetVisible(0);
	Move(3,1);
*/

}
Exemplo n.º 7
0
void CPicDlgQuery::ShowPerson(){
	Person& person = vecPerson.at(m_currentPerson);
    
    ChangeText(IDC_STATICBIRTH     , CCharset::AnsiToUnicode(person.birth.dateNumToString()));
    ChangeText(IDC_STATICSEX       , CCharset::AnsiToUnicode(person.sex));
    ChangeText(IDC_STATICMARRIAGE  , CCharset::AnsiToUnicode(person.marriage));
    ChangeText(IDC_STATICEDUCATION , CCharset::AnsiToUnicode(person.education));
    ChangeText(IDC_STATICTALL      , CCharset::AnsiToUnicode(CStringManager::Format("%d", person.tall)));
    ChangeText(IDC_STATICWEIGHT    , CCharset::AnsiToUnicode(CStringManager::Format("%d", person.weight)));
    ChangeText(IDC_STATICHOUSE     , CCharset::AnsiToUnicode(person.house));
	
	string split;
	string fatherPension;
	if (person.fatherPension != "")
	{
		fatherPension = "是否有养老金:" + person.fatherPension;
	}
	if (person.fatherJob != "" && person.fatherPension != "")
	{
		split = ",";
	}
	ChangeText(IDC_STATICFATHERJOB , CCharset::AnsiToUnicode(person.fatherJob + split + fatherPension));
	split = "";
	string motherPension;
	if (person.motherJob != "" && person.motherPension != "")
	{
		split = ",";
	}
	if (person.motherPension != "")
	{
		motherPension = "是否有养老金:" + person.motherPension;
	}
	ChangeText(IDC_STATICMOTHERJOB , CCharset::AnsiToUnicode(person.motherJob + split + motherPension));
    ChangeText(IDC_STATICHOUSEADDR , CCharset::AnsiToUnicode(person.houseAddr));
    ChangeText(IDC_STATICINTRODUCE , CCharset::AnsiToUnicode(person.introduce));
    ChangeText(IDC_STATICJOBNATURE , CCharset::AnsiToUnicode(person.jobNature));
    ChangeText(IDC_STATICCAR       , CCharset::AnsiToUnicode(person.car));
	if (person.salary != 0)
	{
		ChangeText(IDC_STATICSALARY, CCharset::AnsiToUnicode(CStringManager::Format("%d", person.salary)));
	}
	else
	{
		ChangeText(IDC_STATICSALARY, L"");
	}
	
    ChangeText(IDC_STATICHOUSEHOLD , CCharset::AnsiToUnicode(person.household));
    ChangeText(IDC_STATICHOUSEATTRI, CCharset::AnsiToUnicode(person.houseAttri));

	if (bSecretShow == false)
	{
		wstring strSecret = CCharset::AnsiToUnicode(GetConfig(secret, string));
		ChangeText(IDC_STATICNAME,    person.name    == "" ? _T("") : strSecret.c_str());
		ChangeText(IDC_STATICJOBNAME, person.jobName == "" ? _T("") : strSecret.c_str());
		ChangeText(IDC_STATICMOBILE,  person.mobile  == "" ? _T("") : strSecret.c_str());
		ChangeText(IDC_STATICQQ,      person.qq      == "" ? _T("") : strSecret.c_str());
		ChangeText(IDC_STATICWECHAT,  person.weChat  == "" ? _T("") : strSecret.c_str());
	}
	else
	{
		ChangeText(IDC_STATICNAME,    CCharset::AnsiToUnicode(person.name));
		ChangeText(IDC_STATICJOBNAME, CCharset::AnsiToUnicode(person.jobName));
		ChangeText(IDC_STATICMOBILE,  CCharset::AnsiToUnicode(person.mobile));
		ChangeText(IDC_STATICQQ,      CCharset::AnsiToUnicode(person.qq));
		ChangeText(IDC_STATICWECHAT,  CCharset::AnsiToUnicode(person.weChat));
	}
    
	picCur = 0;
	ShowPersonPic();

	if (m_currentPerson == firstPerson) m_personPre.EnableWindow(FALSE);
    else m_personPre.EnableWindow(TRUE);
	if (m_currentPerson == vecPerson.size() - 1) m_personNext.EnableWindow(FALSE);
    else m_personNext.EnableWindow(TRUE);
	
}
Exemplo n.º 8
0
void TextRenderer::OnKeyPressEvent(GdkEventKey* event)
{
    if( curPos<0 )
        return;

    // :TODO: "key_binding" - осталось полностью перевести на CallHotKey()
    if( CanShiftOnly(event->state) )
    {
        switch( event->keyval )
        {
        case GDK_Left:  case GDK_KP_Left:
            if( curPos>0 )
                MoveCursor(curPos - 1);
            break;
        case GDK_Right: case GDK_KP_Right:
            {
                int len = utf8::trans(GetText()).length();
                if( curPos<len )
                    MoveCursor(curPos + 1);
            }
            break;
        case GDK_Up:    case GDK_KP_Up:
            MoveCursorToLine(true);
            break;
        case GDK_Down:  case GDK_KP_Down:
            MoveCursorToLine(false);
            break;
        case GDK_Home:  case GDK_KP_Home:
            MoveCursor(0);
            break;
        case GDK_End:  case GDK_KP_End:
            MoveCursor( utf8::trans(GetText()).length() );
            break;
        case GDK_Delete:  case GDK_KP_Delete:
            {
                std::string old_str = GetText();
                utf8::trans tr(old_str.c_str());
                if( curPos<tr.length() )
                {
                    std::string new_str(old_str, 0, tr.from_offset(curPos));

                    int after_idx = tr.from_offset(curPos+1);
                    new_str.append(old_str, after_idx, old_str.length() - after_idx);

                    ChangeText(new_str, curPos);
                }
            }
            break;
        case GDK_BackSpace:
            {
                std::string old_str = GetText();
                if( curPos > 0 )
                {
                    utf8::trans tr(old_str.c_str());
                    std::string new_str(old_str, 0, tr.from_offset(curPos-1));

                    int idx = tr.from_offset(curPos);
                    new_str.append(old_str, idx, old_str.length() - idx);

                    ChangeText(new_str, curPos-1);
                }
            }
            break;
        default:
            {
                int u_c = gdk_keyval_to_unicode(event->keyval);
                // вставка символов
                if( u_c )
                {
                    if( !g_unichar_isprint(u_c) )
                        u_c = 0;
                }
                else
                {
                    if( event->keyval == GDK_Return )
                        u_c = '\n';
                    else if( event->keyval == GDK_Tab )
                        u_c = '\t';
                }

                if( u_c )
                {
                    char utf8_c[7];
                    utf8_c[ g_unichar_to_utf8(u_c, utf8_c) ] = 0;

                    //std::string old_str = GetText();
                    //int idx = utf8::trans(old_str.c_str()).from_offset(curPos);
                    //
                    //std::string new_str(old_str, 0, idx);
                    //new_str.append(utf8_c);
                    //new_str.append(old_str, idx, old_str.length() - idx);
                    //
                    //ChangeText(new_str, curPos+1);
                    InsertText(utf8_c);
                }
                break;
            }
        }
    }
    // классические горячие клавишы
    CallHotKey(*this, event);

    curStt->OnInput(*this);
}
Exemplo n.º 9
0
void TextComponent::Initialize(){

	impl->mModel = gameObject->GetComponent<TextureModelComponent>();

	ChangeText(impl->mText);
}