void CLuaCFGMenu::UpdateSelection(const gchar *var)
{
    gtk_widget_hide(m_pInputField);
    gtk_widget_hide(m_pComboBox);
    gtk_widget_hide(m_pDirInputBox);
    
    const SEntry *entry = GetVariables()[var];
    
    switch (entry->type)
    {
        case TYPE_STRING:
            gtk_entry_set_text(GTK_ENTRY(m_pInputField), entry->val.c_str());
            gtk_widget_show(m_pInputField);
            break;
        case TYPE_DIR:
            gtk_entry_set_text(GTK_ENTRY(m_pDirInput), entry->val.c_str());
            gtk_widget_show(m_pDirInputBox);
            break;
        case TYPE_BOOL:
        case TYPE_LIST:
            SetComboBox(var);
            gtk_widget_show(m_pComboBox);
            break;
    }
}
Beispiel #2
0
wyBool
BlobMgmt::ExamineData()
{
	DWORD				dwbytestoread = 0;
	wyInt32				headersize = 0;
	wyWChar				*buff;
	wyString			datastr;
	wyInt32				fileformat = 0;
	wyString			dataformat;
			
	if(!m_piub->m_data)
		return wyFalse;

	//Finding the fileformat whether its utf-8, utf-16(ucs2) or ansi 
	fileformat = DetectFileFormat(m_piub->m_data, dwbytestoread, &headersize);
	
	if(fileformat == NCP_UTF16)
	{
		buff = (wyWChar *)(m_piub->m_data + headersize);

		buff[(dwbytestoread - headersize)/sizeof(wyWChar)] = 0;

		datastr.SetAs(buff);

		dataformat.SetAs("ucs2"); //For setting the combo box value

	}
	else if(fileformat != NCP_UTF8)
	{
		dataformat.SetAs("unicode (utf-8)");

		if(m_piub->m_data)
				datastr.SetAs(m_piub->m_data + headersize);
		// there is a chance that the data may be Utf8 without BOM, so we are checking for the pattern
		if(CheckForUtf8(datastr) == wyFalse)
		{
				datastr.SetAs(m_piub->m_data, wyFalse); 
				dataformat.SetAs("US-ascii/Ansi");
		}
	}
   	
	else
	{
		dataformat.SetAs("unicode (utf-8)");
		datastr.SetAs(m_piub->m_data + headersize);
	}

	m_encodingtype.SetAs(dataformat);
	InitEncodingType();

	//Sets the combo box
	SetComboBox(dataformat.GetAsWideChar());

	return wyTrue;	
}
Beispiel #3
0
void CuEditableListCtrlDuplicateDbSelectLocation::EditValue (int iItem, int iSubItem, CRect rcCell)
{
	if (iSubItem < 1)
		return;

	CString strItem = GetItemText (iItem, iSubItem);
	strItem.TrimLeft();
	strItem.TrimRight();
	CComboBox* pCombo = (CComboBox*)COMBO_GetComboBox();
	int iIndex = -1;

	switch (iSubItem)
	{
	case NEW_LOC:
		InitSortComboBox();
		SetComboBox (iItem, iSubItem, rcCell, (LPCTSTR)strItem);
		break;
	default:
		break;
	}
}
void CLuaCFGMenu::CoreUpdateLanguage()
{
    GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(m_pVarListView)));
    GtkTreeIter it;
    
    if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &it))
    {
        do
        {
            gchar *var;
            gtk_tree_model_get(GTK_TREE_MODEL(store), &it, COLUMN_VAR, &var, -1);
            gtk_list_store_set(store, &it, COLUMN_TITLE, GetTranslation(var),
                               COLUMN_DESC, GetTranslation(GetVariables()[var]->desc.c_str()), -1);
            g_free(var);
        }
        while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &it));
    }
    
    gtk_label_set(GTK_LABEL(m_pDirButtonLabel), GetTranslation("Browse"));
    
    std::string sel = CurSelection();
    if (!sel.empty() && ((GetVariables()[sel]->type == TYPE_BOOL) || (GetVariables()[sel]->type == TYPE_LIST)))
        SetComboBox(sel);
}