本文整理汇总了C++中PluginManager::NotifyPlugins方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginManager::NotifyPlugins方法的具体用法?C++ PluginManager::NotifyPlugins怎么用?C++ PluginManager::NotifyPlugins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginManager
的用法示例。
在下文中一共展示了PluginManager::NotifyPlugins方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveProject
void Autosave::SaveProject(cbProject *p, int method)
{
PluginManager *plm = Manager::Get()->GetPluginManager();
switch(method)
{
case 0:
{
if(p->GetModified())
{
if(::wxRenameFile(p->GetFilename(), p->GetFilename() + _T(".bak")))
if(p->Save())
{
CodeBlocksEvent e(cbEVT_PROJECT_SAVE, 0, p);
plm->NotifyPlugins(e);
}
}
wxFileName file = p->GetFilename();
file.SetExt(_T("layout"));
wxString filename = file.GetFullPath();
if(::wxRenameFile(filename, filename + _T(".bak")))
p->SaveLayout();
break;
}
case 1:
{
if(p->GetModified() && p->Save())
{
CodeBlocksEvent e(cbEVT_PROJECT_SAVE, 0, p);
plm->NotifyPlugins(e);
}
p->SaveLayout();
break;
}
case 2:
case 3: // doesn't really make sense to keep so many versions of a project file
{
if (p->IsLoaded() == false)
return;
if(p->GetModified())
{
ProjectLoader loader(p);
if(loader.Save(p->GetFilename() + _T(".save")))
{
CodeBlocksEvent e(cbEVT_PROJECT_SAVE, 0, p);
plm->NotifyPlugins(e);
}
p->SetModified(); // the actual project file is still not updated!
}
wxFileName file = wxFileName(p->GetFilename());
file.SetExt(_T("layout"));
wxString filename = file.GetFullPath();
wxString temp = filename + _T(".temp");
wxString save = filename + _T(".save");
if(::wxFileExists(filename) && ::wxCopyFile(filename, temp))
{
p->SaveLayout();
::wxRenameFile(filename, save);
::wxRenameFile(temp, filename);
}
break;
}
default:
break;
}
}
示例2: OnTimer
void Autosave::OnTimer(wxTimerEvent& e)
{
if(e.GetId() == 10000)
{
PluginManager *plm = Manager::Get()->GetPluginManager();
int method = Manager::Get()->GetConfigManager(_T("autosave"))->ReadInt(_T("method"));
ProjectManager *pm = Manager::Get()->GetProjectManager();
if(pm && pm->GetActiveProject())
{
if(cbProject * p = pm->GetActiveProject())
{
switch(method)
{
case 0:
{
if(p->GetModified())
{
if(::wxRenameFile(p->GetFilename(), p->GetFilename() + _T(".bak")))
if(p->Save())
{
CodeBlocksEvent e(cbEVT_PROJECT_SAVE, 0, p);
plm->NotifyPlugins(e);
}
}
wxFileName file = p->GetFilename();
file.SetExt(_T("layout"));
wxString filename = file.GetFullPath();
if(::wxRenameFile(filename, filename + _T(".bak")))
p->SaveLayout();
break;
}
case 1:
{
if(p->GetModified() && p->Save())
{
CodeBlocksEvent e(cbEVT_PROJECT_SAVE, 0, p);
plm->NotifyPlugins(e);
}
p->SaveLayout();
break;
}
case 2:
case 3: // doesn't really make sense to keep so many versions of a project file
{
if (p->IsLoaded() == false)
return;
if(p->GetModified())
{
ProjectLoader loader(p);
if(loader.Save(p->GetFilename() + _T(".save")))
{
CodeBlocksEvent e(cbEVT_PROJECT_SAVE, 0, p);
plm->NotifyPlugins(e);
}
p->SetModified(); // the actual project file is still not updated!
}
wxFileName file = wxFileName(p->GetFilename());
file.SetExt(_T("layout"));
wxString filename = file.GetFullPath();
wxString temp = filename + _T(".temp");
wxString save = filename + _T(".save");
if(::wxFileExists(filename) && ::wxCopyFile(filename, temp))
{
p->SaveLayout();
::wxRenameFile(filename, save);
::wxRenameFile(temp, filename);
}
break;
}
}
}
}
}
else if(e.GetId() == 20000)
{
int method = Manager::Get()->GetConfigManager(_T("autosave"))->ReadInt(_T("method"));
EditorManager* em = Manager::Get()->GetEditorManager();
if(em)
{
for(int i = 0; i < em->GetEditorsCount(); ++i)
{
cbEditor* ed = em->GetBuiltinEditor(em->GetEditor(i));
if(ed && ed->GetModified())
{
wxFileName fn(ed->GetFilename());
switch(method)
{
case 0:
{
if(::wxRenameFile(fn.GetFullPath(), fn.GetFullPath() + _T(".bak")))
cbSaveToFile(fn.GetFullPath(), ed->GetControl()->GetText(), ed->GetEncoding(), ed->GetUseBom());
break;
}
case 1:
{
ed->Save();
break;
}
case 2:
//.........这里部分代码省略.........