示例#1
0
wyBool
BlobMgmt::InitDlgVales()
{
	wyString codepage;

    //if find dialog is open, we need to close find dialog 
	if(pGlobals->m_pcmainwin->m_finddlg)
	{
		DestroyWindow(pGlobals->m_pcmainwin->m_finddlg);
		pGlobals->m_pcmainwin->m_finddlg = NULL;
	}

	VERIFY(m_hwndtab   = GetDlgItem(m_hwnddlg, IDC_MAINTAB));
	VERIFY(m_hwndedit  = GetDlgItem(m_hwnddlg, IDC_TEXT));
	VERIFY(m_hwndimage = GetDlgItem(m_hwnddlg, IDC_IMAGE));
	VERIFY(m_hwndnull  = GetDlgItem(m_hwnddlg, IDC_SETNULL));
	VERIFY(m_hwndcombo = GetDlgItem(m_hwnddlg, IDC_COMBO));
    
	InsertTab(m_hwndtab, 0, _(L"Text"));
    InsertTab(m_hwndtab, 1, _(L"Image"));
	
	// if its not word wrap then we need to destroy it.
	SetEditWordWrap(m_hwndedit, wyTrue, wyTrue);
    
	// just for the sake hide both of them
	VERIFY(ShowWindow(m_hwndimage, FALSE));
	VERIFY(ShowWindow(m_hwndedit, FALSE));

	if(m_piub && m_piub->m_isnull == wyTrue)
    {
		SendMessage(GetDlgItem(m_hwnddlg, IDC_SETNULL), BM_SETCHECK, BST_CHECKED, 0);
		DisableAll();
	}

	SetWindowLongPtr(m_hwndimage, GWLP_USERDATA,(LONG_PTR)this);
	SetWindowLongPtr(m_hwndedit, GWLP_USERDATA,(LONG_PTR)this);
	
	SendMessage(m_hwndedit, SCI_SETCODEPAGE, SC_CP_UTF8, 0);
	
	//To avoid printing of special characters in scintilla on ctrl+F and ctrl+H
	SendMessage (m_hwndedit, SCI_CLEARCMDKEY, (SCMOD_CTRL << 16)|'F', 0);
	SendMessage (m_hwndedit, SCI_CLEARCMDKEY, (SCMOD_CTRL << 16)|'H', 0);
	
    //Line added because to turn off the margin
    SendMessage(m_hwndedit, SCI_SETMARGINWIDTHN,1,0);
    
	//m_encodingtype.SetAs(codepage.GetString());
	
	//InitEncodingType();
	m_wporigtextproc =(WNDPROC)SetWindowLongPtr(m_hwndedit, GWLP_WNDPROC,(LONG_PTR)TextProc);
	m_wporigpaintproc =(WNDPROC)SetWindowLongPtr(m_hwndimage, GWLP_WNDPROC,(LONG_PTR)ImageProc);
	
	//initializing text in combobox
	InitComboText();
	ShowData();

    // set the font after reading it from ini file.
	SetEditFont(m_hwndedit);

	// if its not editable then we disable all except the ok button
	if(m_edit == wyFalse)
    {
		DisableAll();
		EnableWindow(GetDlgItem(m_hwnddlg, IDC_SETNULL), FALSE);
        EnableWindow(GetDlgItem(m_hwnddlg, IDC_TEXT), TRUE);
        SendMessage(GetDlgItem(m_hwnddlg, IDC_TEXT), EM_SETREADONLY, TRUE, TRUE);
        SetFocus(GetDlgItem(m_hwnddlg, IDC_TEXT));
	}

	m_checkboxstate = SendMessage(GetDlgItem(m_hwnddlg, IDC_SETNULL), BM_GETCHECK, 0, 0);
    SendMessage(m_hwndedit, SCI_EMPTYUNDOBUFFER, 0, 0);

	return wyTrue;
}
示例#2
0
//Function changes the word wrap mode for the edit control.
void
EditorFont::SetWordWrap(HWND hwndedit)
{
	SetEditWordWrap(hwndedit, wyTrue, wyTrue);
}