Exemple #1
0
void CDComView::DrawLine(long nLine, SFullLine *sFullLine, SDComCfg *pDComCfg, CMyMemDC* pDC)
{
    int nCol;
    int nOffs;
    STextRendition sTextRendition;
    int nMultiplier = 1;

    if (pDC->IsPrinting())
    {
        nMultiplier = -1;
    }

    memset(&sTextRendition, 0, sizeof(sTextRendition));
    nOffs = 0;
    for (nCol = 0; nCol < SB_NUM_COLS; nCol++)
    {
        if ((sTextRendition != sFullLine->sTextRendition[nCol]) ||
                (sFullLine->szLine[nCol] == 0) ||
                (nCol >= (SB_NUM_COLS - 1)))
        {
            sTextRendition = sFullLine->sTextRendition[nCol];
            pDC->TextOut(
                nOffs * m_sizeCharDimensions.cx,
                (nLine * m_sizeCharDimensions.cy) * nMultiplier,
                sFullLine->szLine + nOffs, nCol - nOffs);
            nOffs = nCol;
            SetupColors(sTextRendition, pDComCfg, pDC);
            if (sFullLine->szLine[nCol] == 0)
            {
                break;
            }
        }
    }
}
Exemple #2
0
BOOL CConfigDlg::OnInitDialog()
{
    CSizeDialog::OnInitDialog();

    m_cNormalEdit.LimitText(sizeof(m_tmpKeyMap[m_nCurrentButton].m_szNormalKey));
    m_cCtrlEdit.LimitText(sizeof(m_tmpKeyMap[m_nCurrentButton].m_szCtrlKey));
    m_cShiftEdit.LimitText(sizeof(m_tmpKeyMap[m_nCurrentButton].m_szShiftKey));

    SetupColors(&m_foreStatic, m_foreColors, true);
    SetupColors(&m_backStatic, m_backColors, false);

    GetConfig();
    RenderSample();

    PopulateControls();
    return TRUE;
}
Exemple #3
0
bool THTMLFrame::LoadHTML(dcmapWCSTR pHTML,dcmapWCSTR pBaseURL,IDCMapModule* pProcessModule)
{
	MetaSection="";
	pProcessor = pProcessModule;
	SetupColors();

	CurrentHtml = pHTML;
	BaseURL = pBaseURL?pBaseURL:L"";
	return DoLoadHTML();
}
Exemple #4
0
int THTMLFrame::OnMessage(int MSG,DWORD wParam,DWORD lParam,IDCMapObject* pSender)
{
	switch(MSG)
	{
	   case DCMM_SKIN_CHANGED:
		 SetupColors();
		 //Html->Reformat();
		 Reload(pProcessor);
		 break;
	}
}
void CMainWindow::SetupWindow(bool bUTF8)
{
	SendEditor(SCI_SETCODEPAGE, bUTF8 ? SC_CP_UTF8 : GetACP());

	SendEditor(SCI_SETUNDOCOLLECTION, 1);
	::SetFocus(m_hWndEdit);
	SendEditor(EM_EMPTYUNDOBUFFER);
	SendEditor(SCI_SETSAVEPOINT);
	SendEditor(SCI_GOTOPOS, 0);

	SetupColors(true);

	::ShowWindow(m_hWndEdit, SW_SHOW);
}
bool CMainWindow::Initialize()
{
	m_hWndEdit = ::CreateWindow(
		L"Scintilla",
		L"Source",
		WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_CLIPCHILDREN,
		CW_USEDEFAULT, CW_USEDEFAULT,
		CW_USEDEFAULT, CW_USEDEFAULT,
		*this,
		nullptr,
		hResource,
		nullptr);
	if (!m_hWndEdit)
		return false;

	RECT rect;
	GetClientRect(*this, &rect);
	::SetWindowPos(m_hWndEdit, HWND_TOP,
		rect.left, rect.top,
		rect.right-rect.left, rect.bottom-rect.top,
		SWP_SHOWWINDOW);

	m_directFunction = SendMessage(m_hWndEdit, SCI_GETDIRECTFUNCTION, 0, 0);
	m_directPointer = SendMessage(m_hWndEdit, SCI_GETDIRECTPOINTER, 0, 0);

	// Set up the global default style. These attributes are used wherever no explicit choices are made.
	SetAStyle(STYLE_DEFAULT, ::GetSysColor(COLOR_WINDOWTEXT), ::GetSysColor(COLOR_WINDOW),
		CRegStdDWORD(L"Software\\TortoiseGit\\UDiffFontSize", 10),
		CUnicodeUtils::StdGetUTF8(CRegStdString(L"Software\\TortoiseGit\\UDiffFontName", L"Consolas")).c_str());
	SendEditor(SCI_SETTABWIDTH, CRegStdDWORD(L"Software\\TortoiseGit\\UDiffTabSize", 4));
	SendEditor(SCI_SETREADONLY, TRUE);
	LRESULT pix = SendEditor(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<LPARAM>("_99999"));
	SendEditor(SCI_SETMARGINWIDTHN, 0, pix);
	SendEditor(SCI_SETMARGINWIDTHN, 1);
	SendEditor(SCI_SETMARGINWIDTHN, 2);
	//Set the default windows colors for edit controls
	SetupColors(false);
	if (CRegStdDWORD(L"Software\\TortoiseGit\\ScintillaDirect2D", FALSE) != FALSE)
	{
		SendEditor(SCI_SETTECHNOLOGY, SC_TECHNOLOGY_DIRECTWRITERETAIN);
		SendEditor(SCI_SETBUFFEREDDRAW, 0);
	}
	SendEditor(SCI_SETVIEWWS, 1);
	SendEditor(SCI_SETWHITESPACESIZE, 2);
	SendEditor(SCI_STYLESETVISIBLE, STYLE_CONTROLCHAR, TRUE);

	return true;
}
COutlook2Ctrl::COutlook2Ctrl()
{
	m_iSize = 200;//AfxGetApp()->GetProfileInt(_T("Settings"),_T("OutbarSize"),200);
	m_iDragging = 0;
	m_iDragoffset = 0;
	hDragCur = AfxGetApp()->LoadCursor(AFX_IDC_HSPLITBAR); // sometime fails .. 
	if (!hDragCur) hDragCur = AfxGetApp()->LoadStandardCursor(MAKEINTRESOURCE(IDC_SIZEWE)); 

#if(WINVER >= 0x0500)
	hHandCur = LoadCursor(NULL, IDC_HAND);
#else
	hHandCur = LoadCursor(NULL, IDC_ARROW);
#endif

	LOGFONT lf;
	HFONT hf = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
	CFont * gf = CFont::FromHandle(hf);
	gf->GetLogFont(&lf);
	lf.lfUnderline = TRUE;
	ftHotItems.CreateFontIndirect(&lf);
	lf.lfUnderline = FALSE;

	ftItems.CreateFontIndirect(&lf);

	lf.lfWeight = FW_SEMIBOLD;
	ftFolders.CreateFontIndirect(&lf);

	lf.lfHeight = 20;
	ftCaption.CreateFontIndirect(&lf);


	m_csCaption = _T("");

	 
	SetupColors();

	m_iNumFoldersDisplayed = -1;
	m_iFolderHeight = 24;
	m_iItemHeight = 18;
	m_iSelectedFolder = 0;
	m_iSubItemHeight = 17;

	iHiFolder = iHiLink = -1;
	pLastHilink = NULL;
}
Exemple #8
0
bool THTMLFrame::DoLoadHTML()
{
	if(m_bInside) return false;

	int v = Html->VScrollBarPosition;
	int h = Html->HScrollBarPosition;

	String PreMetaSection = MetaSection;
	Html->LoadFromString(CurrentHtml,BaseURL);
	Caption = Html->DocumentTitle;
	if(PreMetaSection != MetaSection)
	{
		 SetupColors();
		 Html->Reformat();
	}

	Html->VScrollBarPosition=v;
	Html->HScrollBarPosition=h;
	return true;
}
Exemple #9
0
void THTMLFrame::OnChnageSkin()
{
	SetupColors();
}
Exemple #10
0
void THTMLFrame::OnShow()
{
	SetupColors();
}
LRESULT CALLBACK CMainWindow::WinMsgHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if (uMsg == TaskBarButtonCreated)
	{
		SetUUIDOverlayIcon(hwnd);
	}
	switch (uMsg)
	{
	case WM_CREATE:
		{
			m_hwnd = hwnd;
			Initialize();
		}
		break;
	case WM_COMMAND:
		{
			return DoCommand(LOWORD(wParam));
		}
		break;
	case WM_MOUSEWHEEL:
		{
			if (GET_KEYSTATE_WPARAM(wParam) == MK_SHIFT)
			{
				// scroll sideways
				SendEditor(SCI_LINESCROLL, -GET_WHEEL_DELTA_WPARAM(wParam)/40, 0);
			}
			else
				return DefWindowProc(hwnd, uMsg, wParam, lParam);
		}
		break;
	case WM_SIZE:
		{
			RECT rect;
			GetClientRect(*this, &rect);
			if (m_bShowFindBar)
			{
				::SetWindowPos(m_hWndEdit, HWND_TOP,
					rect.left, rect.top,
					rect.right - rect.left, rect.bottom - rect.top - int(30 * CDPIAware::Instance().ScaleFactorY()),
					SWP_SHOWWINDOW);
				::SetWindowPos(m_FindBar, HWND_TOP,
					rect.left, rect.bottom - int(30 * CDPIAware::Instance().ScaleFactorY()),
					rect.right - rect.left, int(30 * CDPIAware::Instance().ScaleFactorY()),
					SWP_SHOWWINDOW);
			}
			else
			{
				::SetWindowPos(m_hWndEdit, HWND_TOP,
					rect.left, rect.top,
					rect.right-rect.left, rect.bottom-rect.top,
					SWP_SHOWWINDOW);
				::ShowWindow(m_FindBar, SW_HIDE);
			}
		}
		break;
	case WM_GETMINMAXINFO:
		{
			auto mmi = reinterpret_cast<MINMAXINFO*>(lParam);
			mmi->ptMinTrackSize.x = 100;
			mmi->ptMinTrackSize.y = 100;
			return 0;
		}
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	case WM_CLOSE:
		::DestroyWindow(m_hwnd);
		break;
	case WM_SETFOCUS:
		SetFocus(m_hWndEdit);
		break;
	case WM_SYSCOLORCHANGE:
		SetupColors(true);
		break;
	case COMMITMONITOR_FINDMSGNEXT:
		{
			SendEditor(SCI_CHARRIGHT);
			SendEditor(SCI_SEARCHANCHOR);
			m_bMatchCase = !!wParam;
			m_findtext = reinterpret_cast<LPCTSTR>(lParam);
			if (SendEditor(SCI_SEARCHNEXT, m_bMatchCase ? SCFIND_MATCHCASE : 0, reinterpret_cast<LPARAM>(CUnicodeUtils::StdGetUTF8(m_findtext).c_str())) == -1)
			{
				FLASHWINFO fwi;
				fwi.cbSize = sizeof(FLASHWINFO);
				fwi.uCount = 3;
				fwi.dwTimeout = 100;
				fwi.dwFlags = FLASHW_ALL;
				fwi.hwnd = m_hwnd;
				FlashWindowEx(&fwi);
			}
			SendEditor(SCI_SCROLLCARET);
		}
		break;
	case COMMITMONITOR_FINDMSGPREV:
		{
			SendEditor(SCI_SEARCHANCHOR);
			m_bMatchCase = !!wParam;
			m_findtext = reinterpret_cast<LPCTSTR>(lParam);
			if (SendEditor(SCI_SEARCHPREV, m_bMatchCase ? SCFIND_MATCHCASE : 0, reinterpret_cast<LPARAM>(CUnicodeUtils::StdGetUTF8(m_findtext).c_str())) == -1)
			{
				FLASHWINFO fwi;
				fwi.cbSize = sizeof(FLASHWINFO);
				fwi.uCount = 3;
				fwi.dwTimeout = 100;
				fwi.dwFlags = FLASHW_ALL;
				fwi.hwnd = m_hwnd;
				FlashWindowEx(&fwi);
			}
			SendEditor(SCI_SCROLLCARET);
		}
		break;
	case COMMITMONITOR_FINDEXIT:
		{
			RECT rect;
			GetClientRect(*this, &rect);
			m_bShowFindBar = false;
			::ShowWindow(m_FindBar, SW_HIDE);
			::SetWindowPos(m_hWndEdit, HWND_TOP,
				rect.left, rect.top,
				rect.right-rect.left, rect.bottom-rect.top,
				SWP_SHOWWINDOW);
		}
		break;
	case COMMITMONITOR_FINDRESET:
		SendEditor(SCI_SETSELECTIONSTART, 0);
		SendEditor(SCI_SETSELECTIONEND, 0);
		SendEditor(SCI_SEARCHANCHOR);
		break;
	default:
		return DefWindowProc(hwnd, uMsg, wParam, lParam);
	}

	return 0;
};