本文整理汇总了C++中wxASSERT_MSG函数的典型用法代码示例。如果您正苦于以下问题:C++ wxASSERT_MSG函数的具体用法?C++ wxASSERT_MSG怎么用?C++ wxASSERT_MSG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxASSERT_MSG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WXUNUSED
wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
{
wxASSERT_MSG( m_data, wxT("Drop source: no data") );
if (!m_data)
return (wxDragResult) wxDragNone;
if (m_data->GetFormatCount() == 0)
return (wxDragResult) wxDragNone;
OSErr result;
DragReference theDrag;
RgnHandle dragRegion;
if ((result = NewDrag(&theDrag)))
{
return wxDragNone ;
}
// add data to drag
size_t formatCount = m_data->GetFormatCount() ;
wxDataFormat *formats = new wxDataFormat[formatCount] ;
m_data->GetAllFormats( formats ) ;
ItemReference theItem = 1 ;
for ( size_t i = 0 ; i < formatCount ; ++i )
{
size_t dataSize = m_data->GetDataSize( formats[i] ) ;
Ptr dataPtr = new char[dataSize] ;
m_data->GetDataHere( formats[i] , dataPtr ) ;
OSType type = formats[i].GetFormatId() ;
if ( type == 'TEXT' )
{
dataSize-- ;
dataPtr[ dataSize ] = 0 ;
wxString st( (wxChar*) dataPtr ) ;
wxCharBuffer buf = st.mb_str( wxConvLocal) ;
AddDragItemFlavor(theDrag, theItem, type , buf.data(), strlen(buf), 0);
}
else if (type == kDragFlavorTypeHFS )
{
HFSFlavor theFlavor ;
OSErr err = noErr;
CInfoPBRec cat;
wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
cat.hFileInfo.ioFDirIndex = 0;
err = PBGetCatInfoSync(&cat);
if (err == noErr )
{
theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
if (theFlavor.fileSpec.parID == fsRtParID) {
theFlavor.fileCreator = 'MACS';
theFlavor.fileType = 'disk';
} else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
theFlavor.fileCreator = 'MACS';
theFlavor.fileType = 'fold';
} else {
theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
}
AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
}
}
else
{
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
}
delete[] dataPtr ;
}
delete[] formats ;
dragRegion = NewRgn();
RgnHandle tempRgn = NewRgn() ;
EventRecord* ev = NULL ;
#if !TARGET_CARBON // TODO
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
#else
EventRecord rec ;
ev = &rec ;
wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
#endif
const short dragRegionOuterBoundary = 10 ;
const short dragRegionInnerBoundary = 9 ;
SetRectRgn( dragRegion , ev->where.h - dragRegionOuterBoundary ,
ev->where.v - dragRegionOuterBoundary ,
ev->where.h + dragRegionOuterBoundary ,
ev->where.v + dragRegionOuterBoundary ) ;
SetRectRgn( tempRgn , ev->where.h - dragRegionInnerBoundary ,
ev->where.v - dragRegionInnerBoundary ,
ev->where.h + dragRegionInnerBoundary ,
ev->where.v + dragRegionInnerBoundary ) ;
DiffRgn( dragRegion , tempRgn , dragRegion ) ;
DisposeRgn( tempRgn ) ;
//.........这里部分代码省略.........
示例2: wxUnusedVar
// ----------------------------------------------------------------------------
void clKeyboardManager::Initialize(bool isRefreshRequest)
// ----------------------------------------------------------------------------
{
wxUnusedVar(isRefreshRequest);
m_menuTable.clear();
// First, try to load accelerators from %appdata% keybindings.conf
// containing merged default + user defined accerators
// Second, try loading from default accerators in %appdata% + accerators.conf
clKeyboardBindingConfig config;
if( not config.Exists()) //does keybindings.conf exist?
{
#if defined(LOGGING)
LOGIT( _T("[%s]"), _("Keyboard manager: No configuration found - importing old settings"));
#endif
//CL_DEBUG("Keyboard manager: No configuration found - importing old settings");
// Decide which file we want to load, take the user settings file first
// GetUserDataDir() == "c:\Users\<username>\AppData\Roaming\<appname>\config\keybindings.conf"
// GetDataDir() == executable directory
// Old accererator setting are in %appdata%
wxFileName fnOldSettings(wxStandardPaths::Get().GetTempDir(), _T("keyMnuAccels.conf"));
wxString personality = Manager::Get()->GetPersonalityManager()->GetPersonality();
fnOldSettings.SetName(personality + _T(".") + fnOldSettings.GetName());
wxFileName fnFileToLoad;
bool canDeleteOldSettings(false);
// If %appdata% accerators.conf exist, use it
if(fnOldSettings.FileExists())
{
fnFileToLoad = fnOldSettings;
//-canDeleteOldSettings = true;
}
else // else use executable dir accerators.conf.default accerators
{
//-fnFileToLoad = fnDefaultOldSettings;
wxASSERT_MSG(0, _("clKeyboardManager::Initialize() missing accerators.conf file"));
}
if(fnFileToLoad.FileExists())
{
#if defined(LOGGING)
LOGIT( _T("KeyboardManager:Importing settings from:\n\t[%s]"), fnFileToLoad.GetFullPath().wx_str());
#endif
// Apply the old settings to the menus
wxString content;
if(not ReadFileContent(fnFileToLoad, content)) return;
wxArrayString lines = ::wxStringTokenize(content, _T("\r\n"), wxTOKEN_STRTOK);
for(size_t i = 0; i < lines.GetCount(); ++i)
{
#if defined(LOGGING)
#if wxVERSION_NUMBER > 3000
LOGIT( _T("AccelFile[%u:%s]"), (unsigned)i, lines.Item(i).wx_str() );
#else
LOGIT( _T("AccelFile[%u:%s]"), i, lines.Item(i).wx_str() );
#endif
#endif
wxArrayString parts = ::wxStringTokenize(lines.Item(i), _T("|"), wxTOKEN_RET_EMPTY);
if(parts.GetCount() < 3) continue;
MenuItemData binding;
binding.resourceID = parts.Item(0);
binding.parentMenu = parts.Item(1);
binding.action = parts.Item(2);
if(parts.GetCount() == 4) {
binding.accel = parts.Item(3);
}
m_menuTable.insert(std::make_pair(binding.resourceID, binding));
}
if(canDeleteOldSettings) {
if (fnFileToLoad.FileExists())
::wxRemoveFile(fnFileToLoad.GetFullPath());
}
}
}
else //config exists: "keybindings.conf"
{
config.Load();
m_menuTable = config.GetBindings();
}
// Load the default settings and add any new entries from accerators.conf
MenuItemDataMap_t defaultEntries = DoLoadDefaultAccelerators();
// Remove any map items nolonger matching the menu structure
for (MenuItemDataMap_t::iterator mapIter = m_menuTable.begin(); mapIter != m_menuTable.end(); ++mapIter)
{
mnuContinue:
if (mapIter == m_menuTable.end()) break;
//search menu structure map for map menuId
if ( defaultEntries.count(mapIter->first) == 0)
{ // menuID nolonger exists
#if defined(LOGGING)
wxString mapAccel = mapIter->second.accel;
wxString mapParent = mapIter->second.parentMenu;
wxString mapMnuID = mapIter->first;
LOGIT( _T("Removing ID mismatch[%s][%s][%s]"), mapMnuID.wx_str(), mapParent.wx_str(), mapAccel.wx_str());
#endif
//.........这里部分代码省略.........
示例3: wxASSERT_MSG
void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") );
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid dialog") );
if (m_resizing) return; /* I don't like recursions */
m_resizing = true;
int old_x = m_x;
int old_y = m_y;
int old_width = m_width;
int old_height = m_height;
if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
{
if (x != -1) m_x = x;
if (y != -1) m_y = y;
if (width != -1) m_width = width;
if (height != -1) m_height = height;
}
else
{
m_x = x;
m_y = y;
m_width = width;
m_height = height;
}
/*
if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
{
if (width == -1) m_width = 80;
}
if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
{
if (height == -1) m_height = 26;
}
*/
int minWidth = GetMinWidth(),
minHeight = GetMinHeight(),
maxWidth = GetMaxWidth(),
maxHeight = GetMaxHeight();
if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
if ((m_x != -1) || (m_y != -1))
{
if ((m_x != old_x) || (m_y != old_y))
{
/* we set the position here and when showing the dialog
for the first time in idle time */
gtk_widget_set_uposition( m_widget, m_x, m_y );
}
}
if ((m_width != old_width) || (m_height != old_height))
{
gtk_widget_set_usize( m_widget, m_width, m_height );
/* actual resizing is deferred to GtkOnSize in idle time and
when showing the dialog */
m_sizeSet = false;
}
m_resizing = false;
}
示例4: wxLogApiError
void wxTaskBarJumpListImpl::LoadKnownCategory(const wxString& title)
{
IApplicationDocumentLists *docList = 0;
HRESULT hr = CoCreateInstance
(
wxCLSID_ApplicationDocumentLists,
NULL,
CLSCTX_INPROC_SERVER,
wxIID_IApplicationDocumentLists,
reinterpret_cast<void **>(&docList)
);
if ( FAILED(hr) )
{
wxLogApiError("CoCreateInstance(wxCLSID_ApplicationDocumentLists)", hr);
return;
}
if ( !m_appID.empty() )
docList->SetAppID(m_appID.wc_str());
IObjectArray *array = NULL;
wxASSERT_MSG( title == "Recent" || title == "Frequent", "Invalid title." );
hr = docList->GetList
(
title == "Recent" ? ADLT_RECENT : ADLT_FREQUENT,
0,
wxIID_IObjectArray,
reinterpret_cast<void **>(&array)
);
if ( FAILED(hr) )
{
wxLogApiError("IApplicationDocumentLists::GetList", hr);
return;
}
UINT count = 0;
array->GetCount(&count);
for (UINT i = 0; i < count; ++i)
{
IUnknown *collectionItem = NULL;
hr = array->GetAt(i, wxIID_IUnknown,
reinterpret_cast<void **>(&collectionItem));
if ( FAILED(hr) )
{
wxLogApiError("IObjectArray::GetAt", hr);
continue;
}
IShellLink *shellLink = NULL;
IShellItem *shellItem = NULL;
wxTaskBarJumpListItem* item = NULL;
if ( SUCCEEDED(collectionItem->QueryInterface(
wxIID_IShellLink, reinterpret_cast<void**>(&shellLink))) )
{
item = GetItemFromIShellLink(shellLink);
shellLink->Release();
}
else if ( SUCCEEDED(collectionItem->QueryInterface(
wxIID_IShellItem, reinterpret_cast<void**>(&shellItem))) )
{
item = GetItemFromIShellItem(shellItem);
shellItem->Release();
}
else
{
wxLogError("Can not query interfaces: IShellLink or IShellItem.");
}
if ( item )
{
if ( title == wxT("Frequent") )
m_frequent->Append(item);
else
m_recent->Append(item);
}
collectionItem->Release();
}
array->Release();
docList->Release();
}
示例5: wxASSERT_MSG
// Begin drag
bool wxDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen, wxRect* rect)
{
wxASSERT_MSG( (m_hImageList != 0), wxT("Image list must not be null in BeginDrag."));
wxASSERT_MSG( (window != 0), wxT("Window must not be null in BeginDrag."));
m_fullScreen = fullScreen;
if (rect)
m_boundingRect = * rect;
bool ret = (ImageList_BeginDrag(GetHimageList(), 0, hotspot.x, hotspot.y) != 0);
if (!ret)
{
wxFAIL_MSG( wxT("BeginDrag failed.") );
return false;
}
if (m_cursor.IsOk())
{
#if wxUSE_SIMPLER_DRAGIMAGE
m_oldCursor = window->GetCursor();
window->SetCursor(m_cursor);
#else
if (!m_hCursorImageList)
{
#ifndef SM_CXCURSOR
// Smartphone may not have these metric symbol
int cxCursor = 16;
int cyCursor = 16;
#else
int cxCursor = ::GetSystemMetrics(SM_CXCURSOR);
int cyCursor = ::GetSystemMetrics(SM_CYCURSOR);
#endif
m_hCursorImageList = (WXHIMAGELIST) ImageList_Create(cxCursor, cyCursor, ILC_MASK, 1, 1);
}
// See if we can find the cursor hotspot
wxPoint curHotSpot(hotspot);
// Although it seems to produce the right position, when the hotspot goeos
// negative it has strange effects on the image.
// How do we stop the cursor jumping right and below of where it should be?
#if 0
ICONINFO iconInfo;
if (::GetIconInfo((HICON) (HCURSOR) m_cursor.GetHCURSOR(), & iconInfo) != 0)
{
curHotSpot.x -= iconInfo.xHotspot;
curHotSpot.y -= iconInfo.yHotspot;
}
#endif
//wxString msg;
//msg.Printf("Hotspot = %d, %d", curHotSpot.x, curHotSpot.y);
//wxLogDebug(msg);
// First add the cursor to the image list
HCURSOR hCursor = (HCURSOR) m_cursor.GetHCURSOR();
int cursorIndex = ImageList_AddIcon((HIMAGELIST) m_hCursorImageList, (HICON) hCursor);
wxASSERT_MSG( (cursorIndex != -1), wxT("ImageList_AddIcon failed in BeginDrag."));
if (cursorIndex != -1)
{
ImageList_SetDragCursorImage((HIMAGELIST) m_hCursorImageList, cursorIndex, curHotSpot.x, curHotSpot.y);
}
#endif
}
#if !wxUSE_SIMPLER_DRAGIMAGE
if (m_cursor.IsOk())
::ShowCursor(FALSE);
#endif
m_window = window;
::SetCapture(GetHwndOf(window));
return true;
}
示例6: wxASSERT_MSG
wxTaskBarJumpListItem*
wxTaskBarJumpListCategory::FindItemByPosition(size_t pos) const
{
wxASSERT_MSG( pos < m_items.size(), "invalid pos." );
return m_items[pos];
}
示例7: wxCHECK_MSG
bool
wxGLCanvasX11::ConvertWXAttrsToGL(const int *wxattrs, int *glattrs, size_t n)
{
wxCHECK_MSG( n >= 16, false, _T("GL attributes buffer too small") );
/*
Different versions of GLX API use rather different attributes lists, see
the following URLs:
- <= 1.2: http://www.opengl.org/sdk/docs/man/xhtml/glXChooseVisual.xml
- >= 1.3: http://www.opengl.org/sdk/docs/man/xhtml/glXChooseFBConfig.xml
Notice in particular that
- GLX_RGBA is boolean attribute in the old version of the API but a
value of GLX_RENDER_TYPE in the new one
- Boolean attributes such as GLX_DOUBLEBUFFER don't take values in the
old version but must be followed by True or False in the new one.
*/
if ( !wxattrs )
{
size_t i = 0;
// use double-buffered true colour by default
glattrs[i++] = GLX_DOUBLEBUFFER;
if ( GetGLXVersion() < 13 )
{
// default settings if attriblist = 0
glattrs[i++] = GLX_RGBA;
glattrs[i++] = GLX_DEPTH_SIZE; glattrs[i++] = 1;
glattrs[i++] = GLX_RED_SIZE; glattrs[i++] = 1;
glattrs[i++] = GLX_GREEN_SIZE; glattrs[i++] = 1;
glattrs[i++] = GLX_BLUE_SIZE; glattrs[i++] = 1;
glattrs[i++] = GLX_ALPHA_SIZE; glattrs[i++] = 0;
}
else // recent GLX can choose the defaults on its own just fine
{
// we just need to have a value after GLX_DOUBLEBUFFER
glattrs[i++] = True;
}
glattrs[i] = None;
wxASSERT_MSG( i < n, _T("GL attributes buffer too small") );
}
else // have non-default attributes
{
size_t p = 0;
for ( int arg = 0; wxattrs[arg] != 0; )
{
// check if we have any space left, knowing that we may insert 2
// more elements during this loop iteration and we always need to
// terminate the list with None (hence -3)
if ( p > n - 3 )
return false;
// indicates whether we have a boolean attribute
bool isBoolAttr = false;
switch ( wxattrs[arg++] )
{
case WX_GL_BUFFER_SIZE:
glattrs[p++] = GLX_BUFFER_SIZE;
break;
case WX_GL_LEVEL:
glattrs[p++] = GLX_LEVEL;
break;
case WX_GL_RGBA:
if ( GetGLXVersion() >= 13 )
{
// this is the default GLX_RENDER_TYPE anyhow
continue;
}
glattrs[p++] = GLX_RGBA;
isBoolAttr = true;
break;
case WX_GL_DOUBLEBUFFER:
glattrs[p++] = GLX_DOUBLEBUFFER;
isBoolAttr = true;
break;
case WX_GL_STEREO:
glattrs[p++] = GLX_STEREO;
isBoolAttr = true;
break;
case WX_GL_AUX_BUFFERS:
glattrs[p++] = GLX_AUX_BUFFERS;
break;
case WX_GL_MIN_RED:
glattrs[p++] = GLX_RED_SIZE;
break;
case WX_GL_MIN_GREEN:
//.........这里部分代码省略.........
示例8: wxDialog
PrefsDialog::PrefsDialog(wxWindow * parent)
: wxDialog(parent, wxID_ANY, wxString(_("Audacity Preferences")),
wxDefaultPosition,
wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
ShuttleGui S(this, eIsCreating);
S.StartVerticalLay(true);
{
S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, true);
{
mCategories = new wxTreebook(this, wxID_ANY);
S.Prop(1);
S.AddWindow(mCategories, wxEXPAND);
wxWindow *w;
// Parameters are: AppPage( page, name, IsSelected, imageId)
w = new DevicePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new PlaybackPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new RecordingPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
#ifdef EXPERIMENTAL_MIDI_OUT
w = new MidiIOPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
#endif
w = new QualityPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new GUIPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new TracksPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new ImportExportPrefs(mCategories);mCategories->AddPage(w, w->GetName(), false, 0);
w = new ProjectsPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new LibraryPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new SpectrumPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new DirectoriesPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new WarningsPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new EffectsPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
#ifdef EXPERIMENTAL_THEME_PREFS
w = new ThemePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
#endif
// w = new BatchPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new KeyConfigPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
w = new MousePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0);
}
S.EndHorizontalLay();
}
S.EndVerticalLay();
S.AddStandardButtons(eOkButton | eCancelButton);
size_t selected = gPrefs->Read(wxT("/Prefs/PrefsCategory"), 0L);
if (selected < 0 || selected >= mCategories->GetPageCount()) {
selected = 0;
}
mCategories->SetSelection(selected);
#if defined(__WXGTK__)
mCategories->GetTreeCtrl()->EnsureVisible(mCategories->GetTreeCtrl()->GetRootItem());
#endif
// mCategories->SetSizeHints(-1, -1, 790, 600); // 790 = 800 - (border * 2)
Layout();
Fit();
wxSize sz = GetSize();
wxASSERT_MSG(sz.x <= 800 && sz.y <= 600, wxT("Preferences dialog exceeds max size"));
if (sz.x > 800) {
sz.x = 800;
}
if (sz.y > 600) {
sz.y = 600;
}
SetSizeHints(sz.x, sz.y, 800, 600);
// Center after all that resizing, but make sure it doesn't end up
// off-screen
CentreOnParent();
}
示例9: PostEvent
void ClangWorkerThread::ProcessRequest(ThreadRequest* request)
{
// Send start event
PostEvent(wxEVT_CLANG_PCH_CACHE_STARTED, "");
ClangThreadRequest* task = dynamic_cast<ClangThreadRequest*>(request);
wxASSERT_MSG(task, "ClangWorkerThread: NULL task");
{
// A bit of optimization
wxCriticalSectionLocker locker(m_criticalSection);
if(task->GetContext() == CTX_CachePCH && m_cache.Contains(task->GetFileName())) {
// Nothing to be done here
PostEvent(wxEVT_CLANG_PCH_CACHE_ENDED, task->GetFileName());
return;
}
}
CL_DEBUG(wxT("==========> [ ClangPchMakerThread ] ProcessRequest started: %s"), task->GetFileName().c_str());
CL_DEBUG(wxT("ClangWorkerThread:: processing request %d"), (int)task->GetContext());
ClangCacheEntry cacheEntry = findEntry(task->GetFileName());
CXTranslationUnit TU = cacheEntry.TU;
CL_DEBUG(wxT("ClangWorkerThread:: found cached TU: %p"), (void*)TU);
bool reparseRequired = true;
if(!TU) {
// First time creating the TU
TU = DoCreateTU(task->GetIndex(), task, true);
reparseRequired = false;
cacheEntry.lastReparse = time(NULL);
cacheEntry.TU = TU;
cacheEntry.sourceFile = task->GetFileName();
}
if(!TU) {
CL_DEBUG(wxT("Failed to parse Translation UNIT..."));
PostEvent(wxEVT_CLANG_TU_CREATE_ERROR, task->GetFileName());
return;
}
if(reparseRequired && task->GetContext() == ::CTX_ReparseTU) {
DoSetStatusMsg(wxString::Format(wxT("clang: re-parsing file %s..."), task->GetFileName().c_str()));
// We need to reparse the TU
CL_DEBUG(wxT("Calling clang_reparseTranslationUnit... [CTX_ReparseTU]"));
if(clang_reparseTranslationUnit(TU, 0, NULL, clang_defaultReparseOptions(TU)) == 0) {
CL_DEBUG(wxT("Calling clang_reparseTranslationUnit... done [CTX_ReparseTU]"));
cacheEntry.lastReparse = time(NULL);
} else {
CL_DEBUG(wxT("An error occurred during reparsing of the TU for file %s. TU: %p"),
task->GetFileName().c_str(), (void*)TU);
// The only thing that left to be done here, is to dispose the TU
clang_disposeTranslationUnit(TU);
PostEvent(wxEVT_CLANG_TU_CREATE_ERROR, task->GetFileName());
return;
}
}
// Construct a cache-returner class
// which makes sure that the TU is cached
// when we leave the current scope
CacheReturner cr(this, cacheEntry);
// Prepare the 'End' event
wxCommandEvent eEnd(wxEVT_CLANG_PCH_CACHE_ENDED);
ClangThreadReply* reply = new ClangThreadReply;
reply->context = task->GetContext();
reply->filterWord = task->GetFilterWord();
reply->filename = task->GetFileName().c_str();
reply->results = NULL;
wxFileName realFileName(reply->filename);
if(realFileName.GetFullName().StartsWith(CODELITE_CLANG_FILE_PREFIX)) {
realFileName.SetFullName(realFileName.GetFullName().Mid(strlen(CODELITE_CLANG_FILE_PREFIX)));
}
reply->filename = realFileName.GetFullPath();
if(task->GetContext() == CTX_CodeCompletion || task->GetContext() == CTX_WordCompletion ||
task->GetContext() == CTX_Calltip) {
CL_DEBUG(wxT("Calling clang_codeCompleteAt..."));
ClangThreadRequest::List_t usList = task->GetModifiedBuffers();
usList.push_back(std::make_pair(task->GetFileName(), task->GetDirtyBuffer()));
ClangUnsavedFiles usf(usList);
CL_DEBUG(wxT("Location: %s:%u:%u"), task->GetFileName().c_str(), task->GetLine(), task->GetColumn());
reply->results = clang_codeCompleteAt(TU, cstr(task->GetFileName()), task->GetLine(), task->GetColumn(),
usf.GetUnsavedFiles(), usf.GetCount(),
clang_defaultCodeCompleteOptions()
#if HAS_LIBCLANG_BRIEFCOMMENTS
| CXCodeComplete_IncludeBriefComments
#endif
);
//.........这里部分代码省略.........
示例10: WXUNUSED
void wxOverlayImpl::Clear(wxDC* WXUNUSED(dc))
{
wxASSERT_MSG( IsOk() , _("You cannot Clear an overlay that is not inited") );
CGRect box = CGRectMake( m_x - 1, m_y - 1 , m_width + 2 , m_height + 2 );
CGContextClearRect( m_overlayContext, box );
}
示例11: MakeUserDataRec
void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter )
{
myData->menuitems = NULL ;
myData->currentfilter = 0 ;
myData->saveMode = false ;
if ( filter && filter[0] )
{
wxString filter2(filter) ;
int filterIndex = 0;
bool isName = true ;
wxString current ;
for( unsigned int i = 0; i < filter2.Len() ; i++ )
{
if( filter2.GetChar(i) == wxT('|') )
{
if( isName ) {
myData->name.Add( current ) ;
}
else {
myData->extensions.Add( current.MakeUpper() ) ;
++filterIndex ;
}
isName = !isName ;
current = wxEmptyString ;
}
else
{
current += filter2.GetChar(i) ;
}
}
// we allow for compatibility reason to have a single filter expression (like *.*) without
// an explanatory text, in that case the first part is name and extension at the same time
wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ;
if ( current.IsEmpty() )
myData->extensions.Add( myData->name[filterIndex] ) ;
else
myData->extensions.Add( current.MakeUpper() ) ;
if ( filterIndex == 0 || isName )
myData->name.Add( current.MakeUpper() ) ;
++filterIndex ;
const size_t extCount = myData->extensions.GetCount();
for ( size_t i = 0 ; i < extCount; i++ )
{
wxUint32 fileType;
wxUint32 creator;
wxString extension = myData->extensions[i];
if (extension.GetChar(0) == '*')
extension = extension.Mid(1); // Remove leading *
if (extension.GetChar(0) == '.')
{
extension = extension.Mid(1); // Remove leading .
}
if (wxFileName::MacFindDefaultTypeAndCreator( extension, &fileType, &creator ))
{
myData->filtermactypes.Add( (OSType)fileType );
}
else
{
myData->filtermactypes.Add( '****' ) ; // We'll fail safe if it's not recognized
}
}
}
}
示例12: StrPrintf
bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
{
// This is for python:
if( aFileSet.size() != 1 )
{
UTF8 msg = StrPrintf( "Pcbnew:%s() takes only a single filename", __func__ );
DisplayError( this, msg );
return false;
}
wxString fullFileName( aFileSet[0] );
// We insist on caller sending us an absolute path, if it does not, we say it's a bug.
wxASSERT_MSG( wxFileName( fullFileName ).IsAbsolute(),
wxT( "bug in single_top.cpp or project manager." ) );
if( !LockFile( fullFileName ) )
{
wxString msg = wxString::Format( _(
"PCB file '%s' is already open." ),
GetChars( fullFileName )
);
DisplayError( this, msg );
return false;
}
if( GetScreen()->IsModify() )
{
int response = YesNoCancelDialog( this, _(
"The current board has been modified. Do you wish to save the changes?" ),
wxEmptyString,
_( "Save and Load" ),
_( "Load Without Saving" )
);
if( response == wxID_CANCEL )
return false;
else if( response == wxID_YES )
SavePcbFile( GetBoard()->GetFileName(), CREATE_BACKUP_FILE );
else
{
// response == wxID_NO, fall thru
}
}
wxFileName pro = fullFileName;
pro.SetExt( ProjectFileExtension );
bool is_new = !wxFileName::IsFileReadable( fullFileName );
// If its a non-existent schematic and caller thinks it exists
if( is_new && !( aCtl & KICTL_CREATE ) )
{
// notify user that fullFileName does not exist, ask if user wants to create it.
wxString ask = wxString::Format( _(
"Board '%s' does not exist. Do you wish to create it?" ),
GetChars( fullFileName )
);
if( !IsOK( this, ask ) )
return false;
}
Clear_Pcb( false ); // pass false since we prompted above for a modified board
IO_MGR::PCB_FILE_T pluginType = plugin_type( fullFileName, aCtl );
bool converted = pluginType != IO_MGR::LEGACY && pluginType != IO_MGR::KICAD;
if( !converted )
{
// PROJECT::SetProjectFullName() is an impactful function. It should only be
// called under carefully considered circumstances.
// The calling code should know not to ask me here to change projects unless
// it knows what consequences that will have on other KIFACEs running and using
// this same PROJECT. It can be very harmful if that calling code is stupid.
Prj().SetProjectFullName( pro.GetFullPath() );
// load project settings before BOARD
LoadProjectSettings();
}
if( is_new )
{
OnModify();
}
else
{
BOARD* loadedBoard = 0; // it will be set to non-NULL if loaded OK
PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
try
{
PROPERTIES props;
char xbuf[30];
char ybuf[30];
// EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
sprintf( xbuf, "%d", GetPageSizeIU().x );
//.........这里部分代码省略.........
示例13: wxASSERT_MSG
wxUnixTimerImpl::~wxUnixTimerImpl()
{
wxASSERT_MSG( !m_isRunning, wxT("must have been stopped before") );
}
示例14: wxASSERT_MSG
void wxMenuItem::SetItemLabel( const wxString& string )
{
wxString str = string;
if ( str.empty() && !IsSeparator() )
{
wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
str = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR |
wxSTOCK_WITH_MNEMONIC);
}
// Some optimization to avoid flicker
wxString oldLabel = m_text;
oldLabel = wxStripMenuCodes(oldLabel);
oldLabel.Replace(wxT("_"), wxEmptyString);
wxString label1 = wxStripMenuCodes(str);
wxString oldhotkey = GetHotKey(); // Store the old hotkey in Ctrl-foo format
wxCharBuffer oldbuf = wxGTK_CONV( GetGtkHotKey(*this) ); // and as <control>foo
DoSetText(str);
if (oldLabel == label1 &&
oldhotkey == GetHotKey()) // Make sure we can change a hotkey even if the label is unaltered
return;
if (m_menuItem)
{
GtkLabel *label;
if (m_labelWidget)
label = (GtkLabel*) m_labelWidget;
else
label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
// set new text
gtk_label_set( label, wxGTK_CONV( m_text ) );
// reparse key accel
(void)gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV(m_text) );
gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) );
}
guint accel_key;
GdkModifierType accel_mods;
gtk_accelerator_parse( (const char*) oldbuf, &accel_key, &accel_mods);
if (accel_key != 0)
{
gtk_widget_remove_accelerator( GTK_WIDGET(m_menuItem),
m_parentMenu->m_accel,
accel_key,
accel_mods );
}
wxCharBuffer buf = wxGTK_CONV( GetGtkHotKey(*this) );
gtk_accelerator_parse( (const char*) buf, &accel_key, &accel_mods);
if (accel_key != 0)
{
gtk_widget_add_accelerator( GTK_WIDGET(m_menuItem),
"activate",
m_parentMenu->m_accel,
accel_key,
accel_mods,
GTK_ACCEL_VISIBLE);
}
}
示例15: Top
//.........这里部分代码省略.........
Push(ReportIdentifiedWorldsState);
} else if(el=="unidentifiedWorlds") {
Push(ReportUnidentifiedWorldsState);
} else if(el=="uninhabitedWorlds") {
Push(ReportUninhabitedWorldsState);
} else {
Push(ReportUnknownState);
}
} else if (t == ReportMapState) {
if (el == "ulx") {
Push(ReportMapULXState);
}
if (el == "lrx") {
Push(ReportMapLRXState);
}
if (el == "uly") {
Push(ReportMapULYState);
}
if (el == "lry") {
Push(ReportMapLRYState);
}
} else if(t==ReportStatusState) {
if(el=="tech") {
Push(ReportStatusTechState);
} else if(el=="numPlanets") {
Push(ReportStatusNumPlanetsState);
} else if(el=="population") {
Push(ReportStatusPopulationState);
} else if(el=="industry") {
Push(ReportStatusIndustryState);
} else if(el=="stockpiles") {
Push(ReportStatusStockpilesState);
} else {
wxASSERT_MSG(false, "This should never happen.");
}
} else if(t==ReportStatusTechState) {
if(el=="drive") {
Push(ReportStatusDriveState);
} else if(el=="weapons") {
Push(ReportStatusWeaponsState);
} else if(el=="shields") {
Push(ReportStatusShieldsState);
} else if(el=="cargo") {
Push(ReportStatusCargoState);
} else {
wxASSERT_MSG(false, "This should never happen.");
}
} else if(t==ReportStatusStockpilesState) {
if(el=="capital") {
Push(ReportStatusCapitalState);
} else if(el=="material") {
Push(ReportStatusMaterialState);
} else if(el=="colonists") {
Push(ReportStatusColonistsState);
} else {
wxASSERT_MSG(false, "This should never happen.");
}
} else if(t==ReportAlienRacesState) {
if(el=="alienRace") {
m_aliens.AddNew(attr[1], attr[3]);
Push(ReportAlienRaceState);
} else {
wxASSERT_MSG(false, "This should never happen.");
}
} else if(t==ReportAlienRaceState) {
if(el=="tech") {