void CDirView::OnUpdateFirstdiff(CCmdUI* pCmdUI)
{
- int firstDiff = GetFirstDifferentItem();
- if (firstDiff > -1)
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable(GetFirstDifferentItem() > -1);
}
// Go to last diff
void CDirView::OnUpdateLastdiff(CCmdUI* pCmdUI)
{
- int firstDiff = GetFirstDifferentItem();
- if (firstDiff > -1)
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable(GetFirstDifferentItem() > -1);
}
// Go to next diff
// Check if different files were found and
// there is different item after focused item
- if ((lastDiff > -1) && (focused < lastDiff))
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable((lastDiff > -1) && (focused < lastDiff));
}
// Go to prev diff
// Check if different files were found and
// there is different item before focused item
- if ((firstDiff > -1) && (firstDiff < focused))
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable((firstDiff > -1) && (firstDiff < focused));
}
void CDirView::OnCurdiff()
void CDirView::OnUpdateCurdiff(CCmdUI* pCmdUI)
{
- int selection = GetFirstSelectedInd();
- if (selection > -1)
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable(GetFirstSelectedInd() > -1);
}
int CDirView::GetFocusedItem()
int sel = -1;
sel = m_pList->GetNextItem(sel, LVNI_SELECTED);
const DIFFITEM& di = GetDiffItem(sel);
- if (IsItemDeletableOnBoth(di))
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable(IsItemDeletableOnBoth(di));
}
}
// and they may not all have the same setting
// so I'm not trying this right now
- if (GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED))
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable(GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED));
BCMenu *pPopup = (BCMenu*) pCmdUI->m_pSubMenu;
if (pPopup == NULL)
void CLocationView::OnUpdateFileSave(CCmdUI* pCmdUI)
{
CMergeDoc *pd = GetDocument();
-
- if (pd->m_ptBuf[0]->IsModified() || pd->m_ptBuf[1]->IsModified())
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(pd->m_ptBuf[0]->IsModified() || pd->m_ptBuf[1]->IsModified());
}
/**
void CLocationView::OnUpdateFileSaveLeft(CCmdUI* pCmdUI)
{
CMergeDoc *pd = GetDocument();
-
- if (!pd->m_ptBuf[0]->GetReadOnly() && pd->m_ptBuf[0]->IsModified())
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(!pd->m_ptBuf[0]->GetReadOnly() && pd->m_ptBuf[0]->IsModified());
}
/**
void CLocationView::OnUpdateFileSaveMiddle(CCmdUI* pCmdUI)
{
CMergeDoc *pd = GetDocument();
-
- if (pd->m_nBuffers > 2 && !pd->m_ptBuf[1]->GetReadOnly() && pd->m_ptBuf[1]->IsModified())
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(pd->m_nBuffers > 2 && !pd->m_ptBuf[1]->GetReadOnly() && pd->m_ptBuf[1]->IsModified());
}
/**
void CLocationView::OnUpdateFileSaveRight(CCmdUI* pCmdUI)
{
CMergeDoc *pd = GetDocument();
-
- if (!pd->m_ptBuf[pd->m_nBuffers - 1]->GetReadOnly() && pd->m_ptBuf[pd->m_nBuffers - 1]->IsModified())
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(!pd->m_ptBuf[pd->m_nBuffers - 1]->GetReadOnly() && pd->m_ptBuf[pd->m_nBuffers - 1]->IsModified());
}
void CMainFrame::OnUpdatePluginUnpackMode(CCmdUI* pCmdUI)
{
- if (GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED))
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable(GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED));
if (pCmdUI->m_nID == ID_UNPACK_MANUAL)
pCmdUI->SetRadio(PLUGIN_MANUAL == g_bUnpackerMode);
void CMainFrame::OnUpdatePluginPrediffMode(CCmdUI* pCmdUI)
{
- if (GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED))
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable(GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED));
if (pCmdUI->m_nID == ID_PREDIFFER_MANUAL)
pCmdUI->SetRadio(PLUGIN_MANUAL == g_bPredifferMode);
*/
void CMainFrame::OnUpdateReloadPlugins(CCmdUI* pCmdUI)
{
- if (GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED))
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable(GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED));
}
void CMainFrame::OnReloadPlugins()
}
const DirDocList &dirdocs = GetAllDirDocs();
- if (!dirdocs.IsEmpty())
- pCmdUI->Enable(TRUE);
- else
- pCmdUI->Enable(FALSE);
+ pCmdUI->Enable(!dirdocs.IsEmpty());
}
/**
*/
void CMergeDoc::OnUpdateFileSaveAsMiddle(CCmdUI* pCmdUI)
{
- if (m_nBuffers == 3)
- {
- pCmdUI->Enable(true);
- }
- else
- {
- pCmdUI->Enable(false);
- }
+ pCmdUI->Enable(m_nBuffers == 3);
}
/**
if (nCurrentDiff == -1)
{
int nNewDiff = pd->m_diffList.LineToDiff(pos.y);
- if (nNewDiff != -1 && pd->m_diffList.IsDiffSignificant(nNewDiff))
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(nNewDiff != -1 && pd->m_diffList.IsDiffSignificant(nNewDiff));
}
else
pCmdUI->Enable(true);
void CMergeEditView::OnUpdateFileSaveLeft(CCmdUI* pCmdUI)
{
CMergeDoc *pd = GetDocument();
-
- if (!IsReadOnly(0) && pd->m_ptBuf[0]->IsModified())
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(!IsReadOnly(0) && pd->m_ptBuf[0]->IsModified());
}
/**
void CMergeEditView::OnUpdateFileSaveMiddle(CCmdUI* pCmdUI)
{
CMergeDoc *pd = GetDocument();
-
- if (pd->m_nBuffers == 3 && !IsReadOnly(1) && pd->m_ptBuf[1]->IsModified())
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(pd->m_nBuffers == 3 && !IsReadOnly(1) && pd->m_ptBuf[1]->IsModified());
}
/**
void CMergeEditView::OnUpdateFileSaveRight(CCmdUI* pCmdUI)
{
CMergeDoc *pd = GetDocument();
-
- if (!IsReadOnly(pd->m_nBuffers - 1) && pd->m_ptBuf[pd->m_nBuffers - 1]->IsModified())
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(!IsReadOnly(pd->m_nBuffers - 1) && pd->m_ptBuf[pd->m_nBuffers - 1]->IsModified());
}
/**
if (pd->m_ptBuf[nPane]->IsModified())
bModified = true;
}
- if (bModified)
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(bModified);
}
/**
*/
void CMergeEditView::OnUpdateViewMargin(CCmdUI* pCmdUI)
{
- bool bViewMargin = GetOptionsMgr()->GetBool(OPT_VIEW_FILEMARGIN);
pCmdUI->Enable(true);
- pCmdUI->SetCheck(bViewMargin);
+ pCmdUI->SetCheck(GetOptionsMgr()->GetBool(OPT_VIEW_FILEMARGIN));
}
/**
{
const bool bIsCurrentScheme = (m_CurSourceDef->type == (pCmdUI->m_nID - ID_COLORSCHEME_FIRST));
pCmdUI->SetRadio(bIsCurrentScheme);
-
- bool syntaxHLEnabled = GetOptionsMgr()->GetBool(OPT_SYNTAX_HIGHLIGHT);
- if (syntaxHLEnabled)
- pCmdUI->Enable(true);
- else
- pCmdUI->Enable(false);
+ pCmdUI->Enable(GetOptionsMgr()->GetBool(OPT_SYNTAX_HIGHLIGHT));
}
/**