コード例 #1
0
void InteractivePointer::update(int posX, int posY, QVector<int> val1, QVector<int> val2, int mode)
{
    // Also update current position.
    updatePosition(posX, posY);

    if (mode == 0)                      // Zoom view
    {
        this->setFixedWidth(pointerSizeX());
        this->setFixedHeight(pointerSizeY());

        zoomView(val1, winSize());
    }
    else if (mode == 1)                 // Difference view
    {
        this->setFixedWidth(pointerSizeX());
        this->setFixedHeight(pointerSizeY());

        diffView(val1, val2, winSize());
    }
    else                                // Text View
    {
        // The reason we are not adjusting the font, and/or window size here, is to help users with poor eyesight
        // to avoid small letters. So let a user find his desired font size, and adjust the pointer accordingly.        
        this->setFixedWidth(winSize() * (m_pixelsWideT + m_pixelsWideS));
        this->setFixedHeight(winSize() * (m_pixelsHighS));

        this->setLineWidth(pointerSizeY());
        textView(val1, winSize());
    }
}
コード例 #2
0
ファイル: codelitediff.cpp プロジェクト: eranif/codelite
void CodeLiteDiff::OnDiff(wxCommandEvent& event)
{
    bool tempfile(false);
    NewFileComparison dlg(EventNotifier::Get()->TopFrame(), m_leftFile);
    if(dlg.ShowModal() == wxID_OK) {
        if(m_leftFile.GetName().StartsWith("Untitled")) {
            tempfile = true;
            m_leftFile = SaveEditorToTmpfile(m_mgr->GetActiveEditor());
            if(!m_leftFile.IsOk()) {
                CL_DEBUG("CodeLiteDiff::OnDiff: call to SaveEditorToTmpfile() failed for m_leftFile");
                return;
            }
        }
        wxString secondFile = dlg.GetTextCtrlFileName()->GetValue();
        if(secondFile.StartsWith("Untitled")) {
            tempfile = true;
            IEditor* editor = m_mgr->FindEditor(secondFile);
            if(!editor) {
                CL_DEBUG("CodeLiteDiff::OnDiff: call to FindEditor() failed");
                return;
            }
            wxFileName rightFn = SaveEditorToTmpfile(editor);
            if(!rightFn.IsOk()) {
                CL_DEBUG("CodeLiteDiff::OnDiff: call to SaveEditorToTmpfile() failed for secondFile");
                return;
            }
            secondFile = rightFn.GetFullPath();
        }

        // Check that we're not trying to diff an editor against itself
        // If we are and it's been edited, diff against the unaltered version
        if(m_leftFile.GetFullPath() == secondFile) {
            IEditor* editor = m_mgr->FindEditor(secondFile);
            if(editor && editor->IsModified()) {
                wxFileName rightFn = SaveEditorToTmpfile(editor);
                if(!rightFn.IsOk()) {
                    CL_DEBUG("CodeLiteDiff::OnDiff: call to SaveEditorToTmpfile() failed for secondFile");
                    return;
                }
                secondFile = rightFn.GetFullPath();

            } else {
                CL_DEBUG("CodeLiteDiff::OnDiff: trying to diff an editor against itself");
                return;
            }
        }

        clDiffFrame diffView(EventNotifier::Get()->TopFrame(), m_leftFile, secondFile, tempfile);
        diffView.ShowModal();
    }
}