BYTE CMainFrame::getFocusFlags() { BYTE result; if(m_hasFocus) result |= MAINHASFOCUS; TextView *view = getActiveTextView(); if(view) { result |= (view->getId() == 0) ? PANEL0ACTIVE : PANEL1ACTIVE; } return result; }
void CMainFrame::OnEditPaste() { TextView *view = getActiveTextView(); if(view == NULL) { return; } const String t = getClipboardText(); CWinDiffDoc *doc = view->getDocument(); doc->setDoc(view->getId(),DIFFDOC_BUF,t); view->refreshBoth(); }
void CMainFrame::ajourMenuItems() { TextView *view = getActiveTextView(); bool hasView = view != NULL; CWinDiffDoc *doc = getDoc(); const Diff &diff = doc->m_diff; if(!hasView) { enableMenuItem(this, ID_EDIT_COPY , false); enableMenuItem(this, ID_EDIT_SELECTALL , false); enableToolbarButtonAndMenuItem(ID_EDIT_FIND , false); enableToolbarButtonAndMenuItem(ID_EDIT_FIND_NEXT , false); enableToolbarButtonAndMenuItem(ID_EDIT_FIND_PREV , false); enableToolbarButtonAndMenuItem(ID_EDIT_PREV_DIFF , false); enableMenuItem(this, ID_EDIT_GOTO , false); enableMenuItem(this, ID_EDIT_REFRESHFILES , false); enableMenuItem(this, ID_VIEW_HIGHLIGHTCOMPAREEQUAL , false); enableToolbarButtonAndMenuItem(ID_EDIT_NEXT_DIFF , false); enableToolbarButtonAndMenuItem(ID_EDIT_SHOWDETAILS , false); showStatusBarPanes(false); } else { const bool hasText = !diff.getDoc(view->getId()).isEmpty(); enableMenuItem(this, ID_EDIT_COPY , !view->getSelectedRange().isEmpty()); enableMenuItem(this, ID_EDIT_SELECTALL , hasText); enableToolbarButtonAndMenuItem(ID_EDIT_FIND , hasText); enableToolbarButtonAndMenuItem(ID_EDIT_FIND_NEXT , hasText); enableToolbarButtonAndMenuItem(ID_EDIT_FIND_NEXT , hasText); enableToolbarButtonAndMenuItem(ID_EDIT_FIND_PREV , hasText); enableToolbarButtonAndMenuItem(ID_EDIT_FIND_PREV , hasText); enableMenuItem(this, ID_EDIT_GOTO , hasText); enableMenuItem(this, ID_EDIT_REFRESHFILES , diff.hasFileDoc()); enableMenuItem(this, ID_VIEW_HIGHLIGHTCOMPAREEQUAL , doc->m_filter.hasLineFilter()); if(!doc->m_filter.hasLineFilter()) { checkMenuItem(this, ID_VIEW_HIGHLIGHTCOMPAREEQUAL, false); } enableToolbarButtonAndMenuItem( ID_EDIT_SHOWDETAILS , !diff.isEmpty() && !diff.getDiffLines()[view->getCurrentLine()].linesAreEqual()); enableToolbarButtonAndMenuItem( ID_EDIT_PREV_DIFF , !diff.isEmpty() && (view->getCurrentLine() > diff.getFirstDiffLine())); enableToolbarButtonAndMenuItem( ID_EDIT_NEXT_DIFF , !diff.isEmpty() && (view->getCurrentLine() < diff.getLastDiffLine())); showStatusBarPanes(!diff.isEmpty()); } updateNameFontSizeMenuItems(getOptions().m_nameFontSizePct); }
void CMainFrame::onFileMruFile(int index) { TextView *view = getActiveTextView(); if(view == NULL) return; try { const String fname = theApp.getRecentFile(index); if(ACCESS(fname, 4) < 0) { const int errorCode = errno; showWarning(getErrnoText()); if(errorCode == ENOENT) { theApp.removeFromRecentFiles(index); } return; } CWinDiffDoc *doc = view->getDocument(); doc->setDoc(view->getId(),DIFFDOC_FILE, fname); Invalidate(FALSE); //view->refreshBoth(); } catch(Exception e) { showException(e); } }
void CMainFrame::OnEditShowDetails() { if(!isToolbarButtonEnabled(ID_EDIT_SHOWDETAILS)) { return; } TextView *view = getActiveTextView(); if(view == NULL) { return; } if(!view->hasPartner()) { return; } String s1, s2; if(view->getId() == 0) { s1 = view->getCurrentString(); s2 = view->getPartner()->getCurrentString(); } else { s2 = view->getCurrentString(); s1 = view->getPartner()->getCurrentString(); } CZoomDlg dlg(s1,s2, view); dlg.DoModal(); }