当前位置: 首页>>代码示例>>C++>>正文


C++ wxLogDebug函数代码示例

本文整理汇总了C++中wxLogDebug函数的典型用法代码示例。如果您正苦于以下问题:C++ wxLogDebug函数的具体用法?C++ wxLogDebug怎么用?C++ wxLogDebug使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wxLogDebug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnMouseOverDisplayable


//.........这里部分代码省略.........
        if (MMalloc.assigned<seec::cm::MallocState>()) {
          auto const &Malloc = MMalloc.get<seec::cm::MallocState>();
          if (Malloc.getAllocatorStmt())
            Notifier->createNotify<ConEvHighlightStmt>(nullptr);
        }
      }
    }
  }

  MouseOver = Ev.getDisplayableShared();

  auto const Node = MouseOver.get();

  if (!Node) {
    if (Recording)
      Recording->recordEventL("StateGraphViewer.MouseOverNone");
  }
  else if (auto const DV = llvm::dyn_cast<DisplayableValue>(Node)) {
    if (auto Access = CurrentAccess->getAccess()) {
      Notifier->createNotify<ConEvHighlightValue>(&(DV->getValue()),
                                                  CurrentAccess);
    }

    if (Recording) {
      std::vector<std::unique_ptr<IAttributeReadOnly>> Attrs;
      addAttributesForValue(Attrs, DV->getValue());
      Recording->recordEventV("StateGraphViewer.MouseOverValue", Attrs);
    }
  }
  else if (auto const DD = llvm::dyn_cast<DisplayableDereference>(Node)) {
    if (auto Access = CurrentAccess->getAccess()) {
      Notifier->createNotify<ConEvHighlightValue>(&(DD->getPointer()),
                                                  CurrentAccess);
    }

    if (Recording) {
      std::vector<std::unique_ptr<IAttributeReadOnly>> Attrs;
      addAttributesForValue(Attrs, DD->getPointer());
      Recording->recordEventV("StateGraphViewer.MouseOverDereference", Attrs);
    }
  }
  else if (auto const DF = llvm::dyn_cast<DisplayableFunctionState>(Node)) {
    auto const Decl = DF->getFunctionState().getFunctionDecl();
    Notifier->createNotify<ConEvHighlightDecl>(Decl);

    if (Recording) {
      auto const &FS = DF->getFunctionState();
      Recording->recordEventL("StateGraphViewer.MouseOverFunctionState",
                              make_attribute("function", FS.getNameAsString()));
    }
  }
  else if (auto const DL = llvm::dyn_cast<DisplayableLocalState>(Node)) {
    auto const Decl = DL->getLocalState().getDecl();
    Notifier->createNotify<ConEvHighlightDecl>(Decl);

    if (Recording) {
      // TODO
    }
  }
  else if (auto const DP = llvm::dyn_cast<DisplayableParamState>(Node)) {
    auto const Decl = DP->getParamState().getDecl();
    Notifier->createNotify<ConEvHighlightDecl>(Decl);

    if (Recording) {
      // TODO
    }
  }
  else if (auto const DG = llvm::dyn_cast<DisplayableGlobalVariable>(Node)) {
    auto const Decl = DG->getGlobalVariable().getClangValueDecl();
    Notifier->createNotify<ConEvHighlightDecl>(Decl);

    if (Recording) {
      // TODO
    }
  }
  else if (auto const DA = llvm::dyn_cast<DisplayableReferencedArea>(Node)) {
    if (auto Access = CurrentAccess->getAccess()) {
      auto const Start = DA->getAreaStart();
      auto const MayMalloc = CurrentProcess->getDynamicMemoryAllocation(Start);
      if (MayMalloc.assigned<seec::cm::MallocState>()) {
        auto const &Malloc = MayMalloc.get<seec::cm::MallocState>();
        if (auto const S = Malloc.getAllocatorStmt())
          Notifier->createNotify<ConEvHighlightStmt>(S);
      }
    }

    if (Recording) {
      Recording->recordEventL("StateGraphViewer.MouseOverReferencedArea",
                              make_attribute("start", DA->getAreaStart()),
                              make_attribute("end", DA->getAreaEnd()));
    }
  }
  else {
    wxLogDebug("Mouse over unknown Displayable.");

    if (Recording) {
      Recording->recordEventL("StateGraphViewer.MouseOverUnknown");
    }
  }
}
开发者ID:mheinsen,项目名称:seec,代码行数:101,代码来源:StateGraphViewer.cpp

示例2: wxPanel

raBid::raBid(const wxWindow* parent): wxPanel((wxWindow*)parent) {
	int i = 0;
	int j = 0;
	int best_width = 0;
	int temp_width = 0;
	int temp_height = 0;

	m_game = NULL;
	m_min_bid = 0;

	// Initializing the value of all the buttons to NULL
	for(i = 0; i < raBID_TOTAL_BTNS; ++i)
		m_buttons[i] = NULL;

	m_button_all = NULL;
	m_button_pass = NULL;

	// Calculate the best width for the buttons
	// The best width should be able to contain all bids from 14
	// to 28 and the strings "All" and "Pass"

	best_width = 0;
	for(i = 0 ; i < raBID_TOTAL_BTNS; i++) {
		this->GetTextExtent(wxString::Format(wxT("%d"), i + 14),
							&temp_width, &temp_height);
		best_width = std::max(best_width, temp_width);
	}

	this->GetTextExtent(wxT("All"), &temp_width, &temp_height);
	best_width = std::max(best_width, temp_width);
	this->GetTextExtent(wxT("Pass"), &temp_width, &temp_height);
	best_width = std::max(best_width, temp_width);

	wxLogDebug(wxString::Format(wxT("Best width %d"), best_width));

#ifdef __WXMSW__
	this->SetWindowStyle(wxRAISED_BORDER);
#endif

	m_main_panel = new wxPanel(this);
	if(!m_main_panel) {
		wxLogError(wxString::Format(wxT("Failed to create main panel. %s:%d"), wxT(__FILE__), __LINE__));
		return;
	}

#ifdef __WXMSW__
	m_main_panel->SetWindowStyle(wxSUNKEN_BORDER);
#endif

	m_main_panel->SetBackgroundColour(*wxWHITE);
	m_main_sizer = new wxGridSizer(0, 0, 0, 0);


	// TODO : Add error checks
	m_main_panel_sizer = new wxBoxSizer(wxVERTICAL);

	m_head_panel = new wxPanel(m_main_panel);
	//m_head_panel->SetWindowStyle(wxRAISED_BORDER);
	m_head_panel->SetBackgroundColour(raCLR_HEAD_DARK);
	m_head_panel->SetForegroundColour(*wxWHITE);

	m_bold_font = m_head_panel->GetFont();
	m_bold_font.SetWeight(wxFONTWEIGHT_BOLD);
	m_head_panel->SetFont(m_bold_font);

	m_head_panel_sizer = new wxGridSizer(0, 0, 0, 0);
	m_head_panel_text = new wxStaticText(m_head_panel, -1, wxT("Enter Bid"));
	m_head_panel_sizer->Add(m_head_panel_text, 0,
							wxALIGN_CENTER_HORIZONTAL| wxALIGN_CENTER_VERTICAL|wxALL, 2);

	m_head_panel->SetSizer(m_head_panel_sizer);

	m_bidbtn_panel = new wxPanel(m_main_panel);
	//m_bidbtn_panel->SetWindowStyle(wxSUNKEN_BORDER);
	m_bidbtn_panel_sizer = new wxGridSizer(5, 3, 0, 0);

	for(i = 0; i < raBID_BTN_ROWS; i++) {
		for(j = 0; j < raBID_BTN_COLS; j++) {
			m_buttons[(i * raBID_BTN_COLS) + j] = new wxButton(m_bidbtn_panel,
					raBID_BTN_ID_START + (i * raBID_BTN_COLS) + j,
					wxString::Format(wxT("%d"), (i * raBID_BTN_COLS) + j + 14),
					wxDefaultPosition, wxSize(best_width, -1));
			m_bidbtn_panel_sizer->Add(m_buttons[(i * raBID_BTN_COLS) + j], 0,
									  wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 1);
			//m_buttons[(i * raBID_BTN_COLS) + j]->SetSize(10, 20);
			//m_buttons[(i * raBID_BTN_COLS) + j]->SetWindowStyle(wxNO_BORDER);
			m_buttons[(i * raBID_BTN_COLS) + j]->SetEventHandler(this->GetEventHandler());
		}
	}

	m_bidbtn_panel->SetSizer(m_bidbtn_panel_sizer);
	m_bidbtn_panel_sizer->Fit(m_bidbtn_panel);

	// Create panel, assosiated sizer to hold the buttons
	// to bid "All" and "Pass"

	m_btns_panel = new wxPanel(m_main_panel);
	m_btns_panel_sizer = new wxGridSizer(1, 2, 0, 0);

	m_button_all = new wxButton(m_btns_panel, raBID_BTN_ID_ALL, wxT("All"));
//.........这里部分代码省略.........
开发者ID:TodorBalabanov,项目名称:rosanne,代码行数:101,代码来源:rabid.cpp

示例3: UnRef

bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type)
{
    UnRef();

    char anim_type[12];
    switch (type)
    {
    case wxANIMATION_TYPE_GIF:
        strcpy(anim_type, "gif");
        break;

    case wxANIMATION_TYPE_ANI:
        strcpy(anim_type, "ani");
        break;

    default:
        anim_type[0] = '\0';
        break;
    }

    // create a GdkPixbufLoader
    GError *error = NULL;
    GdkPixbufLoader *loader;
    if (type != wxANIMATION_TYPE_INVALID && type != wxANIMATION_TYPE_ANY)
        loader = gdk_pixbuf_loader_new_with_type(anim_type, &error);
    else
        loader = gdk_pixbuf_loader_new();

    if (!loader)
    {
        wxLogDebug(wxT("Could not create the loader for '%s' animation type"), anim_type);
        return false;
    }

    // connect to loader signals
    g_signal_connect(loader, "area-updated", G_CALLBACK(gdk_pixbuf_area_updated), this);

    guchar buf[2048];
    while (stream.IsOk())
    {
        // read a chunk of data
        stream.Read(buf, sizeof(buf));

        // fetch all data into the loader
        if (!gdk_pixbuf_loader_write(loader, buf, stream.LastRead(), &error))
        {
            gdk_pixbuf_loader_close(loader, &error);
            wxLogDebug(wxT("Could not write to the loader"));
            return false;
        }
    }

    // load complete
    if (!gdk_pixbuf_loader_close(loader, &error))
    {
        wxLogDebug(wxT("Could not close the loader"));
        return false;
    }

    // wait until we get the last area_updated signal
    return true;
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:62,代码来源:animate.cpp

示例4: wxCharCodeWXToOSX


//.........这里部分代码省略.........
        case 'o': case 'O':   keycode = kVK_ANSI_O; break;
        case 'p': case 'P':   keycode = kVK_ANSI_P; break;
        case 'q': case 'Q':   keycode = kVK_ANSI_Q; break;
        case 'r': case 'R':   keycode = kVK_ANSI_R; break;
        case 's': case 'S':   keycode = kVK_ANSI_S; break;
        case 't': case 'T':   keycode = kVK_ANSI_T; break;
        case 'u': case 'U':   keycode = kVK_ANSI_U; break;
        case 'v': case 'V':   keycode = kVK_ANSI_V; break;
        case 'w': case 'W':   keycode = kVK_ANSI_W; break;
        case 'x': case 'X':   keycode = kVK_ANSI_X; break;
        case 'y': case 'Y':   keycode = kVK_ANSI_Y; break;
        case 'z': case 'Z':   keycode = kVK_ANSI_Z; break;
            
        case '0':             keycode = kVK_ANSI_0; break;
        case '1':             keycode = kVK_ANSI_1; break;
        case '2':             keycode = kVK_ANSI_2; break;
        case '3':             keycode = kVK_ANSI_3; break;
        case '4':             keycode = kVK_ANSI_4; break;
        case '5':             keycode = kVK_ANSI_5; break;
        case '6':             keycode = kVK_ANSI_6; break;
        case '7':             keycode = kVK_ANSI_7; break;
        case '8':             keycode = kVK_ANSI_8; break;
        case '9':             keycode = kVK_ANSI_9; break;

#ifdef __clang__
    #pragma clang diagnostic pop
#endif // __clang__
            
        case WXK_BACK:        keycode = kVK_Delete; break;
        case WXK_TAB:         keycode = kVK_Tab; break;
        case WXK_RETURN:      keycode = kVK_Return; break;
        case WXK_ESCAPE:      keycode = kVK_Escape; break;
        case WXK_SPACE:       keycode = kVK_Space; break;
        case WXK_DELETE:      keycode = kVK_ForwardDelete; break;
            
        case WXK_SHIFT:       keycode = kVK_Shift; break;
        case WXK_ALT:         keycode = kVK_Option; break;
        case WXK_RAW_CONTROL: keycode = kVK_Control; break;
        case WXK_CONTROL:     keycode = kVK_Command; break;
            
        case WXK_CAPITAL:     keycode = kVK_CapsLock; break;
        case WXK_END:         keycode = kVK_End; break;
        case WXK_HOME:        keycode = kVK_Home; break;
        case WXK_LEFT:        keycode = kVK_LeftArrow; break;
        case WXK_UP:          keycode = kVK_UpArrow; break;
        case WXK_RIGHT:       keycode = kVK_RightArrow; break;
        case WXK_DOWN:        keycode = kVK_DownArrow; break;
            
        case WXK_HELP:        keycode = kVK_Help; break;
            
            
        case WXK_NUMPAD0:     keycode = kVK_ANSI_Keypad0; break;
        case WXK_NUMPAD1:     keycode = kVK_ANSI_Keypad1; break;
        case WXK_NUMPAD2:     keycode = kVK_ANSI_Keypad2; break;
        case WXK_NUMPAD3:     keycode = kVK_ANSI_Keypad3; break;
        case WXK_NUMPAD4:     keycode = kVK_ANSI_Keypad4; break;
        case WXK_NUMPAD5:     keycode = kVK_ANSI_Keypad5; break;
        case WXK_NUMPAD6:     keycode = kVK_ANSI_Keypad6; break;
        case WXK_NUMPAD7:     keycode = kVK_ANSI_Keypad7; break;
        case WXK_NUMPAD8:     keycode = kVK_ANSI_Keypad8; break;
        case WXK_NUMPAD9:     keycode = kVK_ANSI_Keypad9; break;
        case WXK_F1:          keycode = kVK_F1; break;
        case WXK_F2:          keycode = kVK_F2; break;
        case WXK_F3:          keycode = kVK_F3; break;
        case WXK_F4:          keycode = kVK_F4; break;
        case WXK_F5:          keycode = kVK_F5; break;
        case WXK_F6:          keycode = kVK_F6; break;
        case WXK_F7:          keycode = kVK_F7; break;
        case WXK_F8:          keycode = kVK_F8; break;
        case WXK_F9:          keycode = kVK_F9; break;
        case WXK_F10:         keycode = kVK_F10; break;
        case WXK_F11:         keycode = kVK_F11; break;
        case WXK_F12:         keycode = kVK_F12; break;
        case WXK_F13:         keycode = kVK_F13; break;
        case WXK_F14:         keycode = kVK_F14; break;
        case WXK_F15:         keycode = kVK_F15; break;
        case WXK_F16:         keycode = kVK_F16; break;
        case WXK_F17:         keycode = kVK_F17; break;
        case WXK_F18:         keycode = kVK_F18; break;
        case WXK_F19:         keycode = kVK_F19; break;
        case WXK_F20:         keycode = kVK_F20; break;
            
        case WXK_PAGEUP:      keycode = kVK_PageUp; break;
        case WXK_PAGEDOWN:    keycode = kVK_PageDown; break;
            
        case WXK_NUMPAD_DELETE:    keycode = kVK_ANSI_KeypadClear; break;
        case WXK_NUMPAD_EQUAL:     keycode = kVK_ANSI_KeypadEquals; break;
        case WXK_NUMPAD_MULTIPLY:  keycode = kVK_ANSI_KeypadMultiply; break;
        case WXK_NUMPAD_ADD:       keycode = kVK_ANSI_KeypadPlus; break;
        case WXK_NUMPAD_SUBTRACT:  keycode = kVK_ANSI_KeypadMinus; break;
        case WXK_NUMPAD_DECIMAL:   keycode = kVK_ANSI_KeypadDecimal; break;
        case WXK_NUMPAD_DIVIDE:    keycode = kVK_ANSI_KeypadDivide; break;
            
        default:
            wxLogDebug( "Unrecognised keycode %d", code );
            keycode = static_cast<CGKeyCode>(-1);
    }
    
    return keycode;
}
开发者ID:emutavchi,项目名称:pxCore,代码行数:101,代码来源:app.cpp

示例5: wxMkdir

bool BundleManager::DownloadDir(const wxString& url, const wxFileName& path, wxProgressDialog& dlg) {
	// Get list of files and folders
	RemoteProfile rp;
	vector<cxFileInfo> fiList;
	CURLcode errorCode = m_remoteThread.GetRemoteListWait(url, rp, fiList);
	if (errorCode != CURLE_OK) goto error;

	// Download files and folders
	{
		unsigned int retryCount = 0;
		for (vector<cxFileInfo>::const_iterator p = fiList.begin(); p != fiList.end(); ++p) {
			if (p->m_isDir) {
				// Create subdir
				wxFileName dir = path;
				dir.AppendDir(p->m_name);
				wxMkdir(dir.GetPath());

				const wxString dirName = p->m_name + wxT('/');
				if (!dlg.Pulse(dirName)) return false;

				// Download contents
				const wxString dirUrl = url + dirName;
				if (!DownloadDir(dirUrl, dir, dlg)) return false;
			}
			else {
				wxString filename = p->m_name;
#ifdef __WXMSW__
				filename = UrlEncode::EncodeFilename(filename); // Make filename safe for win
#endif
				wxFileName filePath = path;
				filePath.SetFullName(filename);
				const wxString pathStr = filePath.GetFullPath();

				if (!dlg.Pulse(filename)) return false;

				// Download file
				const wxString fileUrl = url + p->m_name;
				errorCode = m_remoteThread.Download(fileUrl, pathStr, rp);
				
				// Check for errors
				if (errorCode != CURLE_OK) goto error;

				// There has been some cases where the download has ended
				// up with an empty file but no error. As a workaround
				// we give it one more try and then return an error.
				if (filePath.GetSize() == 0 && p->m_size != 0) {
					if (retryCount == 0) {
						wxLogDebug(wxT("Received empty file! Retrying download"));
						++retryCount;
						--p;
						continue;
					}
					else {
						errorCode = CURLE_PARTIAL_FILE;
						goto error;
					}
				}

				// Set modDate
				filePath.SetTimes(NULL, &p->m_modDate, NULL);

				retryCount = 0;
			}
		}
	}

	return true;

error:
	wxMessageBox(m_remoteThread.GetErrorText(errorCode), _("Download Error"), wxICON_ERROR|wxOK, this);
	return false;
}
开发者ID:dxtravi,项目名称:e,代码行数:72,代码来源:BundleManager.cpp

示例6: wxLogDebug

void wxHandheldInstallCtrl::InsertUserDestinations( handheld_dest_array_type& handheld_dest_array )
{
    wxLogDebug( wxT( "Entering wxHandheldInstallCtrl::InsertUserDestinations()" ) );
    if ( handheld_dest_array.IsEmpty() ) {
        return;
    }

    // Insert by rows, starting at index zero. Achieve by getting number
    // of items in listctrl.
    int             row_to_insert;
    wxString        ram_or_card_string;
    wxString		is_usb_pause_string;
    wxArrayString   row_cells_contents;
    wxArrayInt      matching_row_numbers;
    // Insert them
    for ( size_t n = 0; n < handheld_dest_array.GetCount(); n++ ) 
    {
        row_to_insert =  m_usersListCtrl->GetItemCount();
            // Convert our handheld_target_storage_mode to the string in the column
            if( handheld_dest_array[ n ]->handheld_target_storage_mode == plkrHANDHELD_TARGET_STORAGE_MODE_SD_CARD )
            {
                ram_or_card_string = _( "SD Card" );
            } 
            else if( handheld_dest_array[ n ]->handheld_target_storage_mode == plkrHANDHELD_TARGET_STORAGE_MODE_MEMORY_STICK ) 
            {
                ram_or_card_string = _( "M.Stick" );
            } 
            else if( handheld_dest_array[ n ]->handheld_target_storage_mode == plkrHANDHELD_TARGET_STORAGE_MODE_COMPACT_FLASH )
            {
                ram_or_card_string = _( "CF Card" );
            } 
            else 
            {
                // All others are RAM.
                ram_or_card_string = _( "RAM" );
            }
            // Convert our is_usb_pause to the string in the column
            if( handheld_dest_array[ n ]->is_usb_pause == 1 )
            {
                is_usb_pause_string = _( "Yes" );
            } 
            else 
            {
                is_usb_pause_string = _( "No" ); 
            }
        // Only insert it if that user/RAM combo doesn't doesn't already exists in the
        // Empty matches from last iteration
        matching_row_numbers.Empty();
        row_cells_contents.Empty();
        
        // Make the row cell contents to look for:
        // NOTE: these must be added in the order of the columns!
        row_cells_contents.Add( handheld_dest_array[ n ]->user_name );
        row_cells_contents.Add( ram_or_card_string );
        // The card directory column goes in here
        row_cells_contents.Add( is_usb_pause_string );
        
        // Look to see if there is matching rows...
        m_usersListCtrl->find_matching_rows( row_cells_contents, &matching_row_numbers );
        // ...and if there isn't any matches...
        if ( matching_row_numbers.IsEmpty() ) 
        {
            // ..then insert row:
            m_usersListCtrl->InsertItem( row_to_insert, handheld_dest_array[ n ]->user_name, m_usersListCtrlImageId );
            m_usersListCtrl->SetItem( row_to_insert, RAM_OR_CARD_COLUMN, ram_or_card_string );
            // The 3rd column, DIRECTORY_ON_CARD_COLUMN, would go here.
            m_usersListCtrl->SetItem( row_to_insert, IS_USB_PAUSE_COLUMN, is_usb_pause_string );
        }
    }
    // Clear arrays to free memory
    matching_row_numbers.Clear();
    row_cells_contents.Clear();
    wxLogDebug( wxT( "Finished wxHandheldInstallCtrl::InsertUserDestinations()" ) );
}
开发者ID:TimofonicJunkRoom,项目名称:plucker-1,代码行数:74,代码来源:hhictrl.cpp

示例7: wxExecute

long wxExecute( const wxString& command, int flags, wxProcess *process )
{
    wxCHECK_MSG( !command.empty(), 0, wxT("can't exec empty command") );
    wxLogDebug(wxString(wxT("Launching: ")) + command);

#if wxUSE_THREADS
    // fork() doesn't mix well with POSIX threads: on many systems the program
    // deadlocks or crashes for some reason. Probably our code is buggy and
    // doesn't do something which must be done to allow this to work, but I
    // don't know what yet, so for now just warn the user (this is the least we
    // can do) about it
    wxASSERT_MSG( wxThread::IsMain(),
                    _T("wxExecute() can be called only from the main thread") );
#endif // wxUSE_THREADS

    int argc = 0;
    wxChar *argv[WXEXECUTE_NARGS];
    wxString argument;
    const wxChar *cptr = command.c_str();
    wxChar quotechar = wxT('\0'); // is arg quoted?
    bool escaped = false;

    // split the command line in arguments
    do
    {
        argument=wxT("");
        quotechar = wxT('\0');

        // eat leading whitespace:
        while ( wxIsspace(*cptr) )
            cptr++;

        if ( *cptr == wxT('\'') || *cptr == wxT('"') )
            quotechar = *cptr++;

        do
        {
            if ( *cptr == wxT('\\') && ! escaped )
            {
                escaped = true;
                cptr++;
                continue;
            }

            // all other characters:
            argument += *cptr++;
            escaped = false;

            // have we reached the end of the argument?
            if ( (*cptr == quotechar && ! escaped)
                 || (quotechar == wxT('\0') && wxIsspace(*cptr))
                 || *cptr == wxT('\0') )
            {
                wxASSERT_MSG( argc < WXEXECUTE_NARGS,
                              wxT("too many arguments in wxExecute") );

                argv[argc] = new wxChar[argument.length() + 1];
                wxStrcpy(argv[argc], argument.c_str());
                argc++;

                // if not at end of buffer, swallow last character:
                if(*cptr)
                    cptr++;

                break; // done with this one, start over
            }
        } while(*cptr);
    } while(*cptr);
    argv[argc] = NULL;

    long lRc;
#if defined(__DARWIN__)
    // wxMacExecute only executes app bundles.
    // It returns an error code if the target is not an app bundle, thus falling
    // through to the regular wxExecute for non app bundles.
    lRc = wxMacExecute(argv, flags, process);
    if( lRc != ((flags & wxEXEC_SYNC) ? -1 : 0))
        return lRc;
#endif

    // do execute the command
    lRc = wxExecute(argv, flags, process);

    // clean up
    argc = 0;
    while( argv[argc] )
        delete [] argv[argc++];

    return lRc;
}
开发者ID:project-renard-survey,项目名称:chandler,代码行数:90,代码来源:utilsunx.cpp

示例8: wxLogSysError

// ----------------------------------------------------------------------------
// wxHIDDevice::Create
//
//  nClass is the HID Page such as
//      kHIDPage_GenericDesktop
//  nType is the HID Usage such as
//      kHIDUsage_GD_Joystick,kHIDUsage_GD_Mouse,kHIDUsage_GD_Keyboard
//  nDev is the device number to use
//
// ----------------------------------------------------------------------------
bool wxHIDDevice::Create (int nClass, int nType, int nDev)
{
    //Create the mach port
    if(IOMasterPort(bootstrap_port, &m_pPort) != kIOReturnSuccess)
    {
        wxLogSysError(wxT("Could not create mach port"));
        return false;
    }

    //Dictionary that will hold first
    //the matching dictionary for determining which kind of devices we want,
    //then later some registry properties from an iterator (see below)
    //
    //The call to IOServiceMatching filters down the
    //the services we want to hid services (and also eats the
    //dictionary up for us (consumes one reference))
    CFMutableDictionaryRef pDictionary = IOServiceMatching(kIOHIDDeviceKey);
    if(pDictionary == NULL)
    {
        wxLogSysError( wxT("IOServiceMatching(kIOHIDDeviceKey) failed") );
        return false;
    }

    //Here we'll filter down the services to what we want
    if (nType != -1)
    {
        CFNumberRef pType = CFNumberCreate(kCFAllocatorDefault,
                                    kCFNumberIntType, &nType);
        CFDictionarySetValue(pDictionary, CFSTR(kIOHIDPrimaryUsageKey), pType);
        CFRelease(pType);
    }
    if (nClass != -1)
    {
        CFNumberRef pClass = CFNumberCreate(kCFAllocatorDefault,
                                    kCFNumberIntType, &nClass);
        CFDictionarySetValue(pDictionary, CFSTR(kIOHIDPrimaryUsagePageKey), pClass);
        CFRelease(pClass);
    }

    //Now get the matching services
    io_iterator_t pIterator;
    if( IOServiceGetMatchingServices(m_pPort,
                        pDictionary, &pIterator) != kIOReturnSuccess )
    {
        wxLogSysError(wxT("No Matching HID Services"));
        return false;
    }

    //Were there any devices matched?
    if(pIterator == 0)
        return false; // No devices found

    //Now we iterate through them
    io_object_t pObject;
    while ( (pObject = IOIteratorNext(pIterator)) != 0)
    {
        if(--nDev != 0)
        {
            IOObjectRelease(pObject);
            continue;
        }

        if ( IORegistryEntryCreateCFProperties
             (
                pObject,
                &pDictionary,
                kCFAllocatorDefault,
                kNilOptions
             ) != KERN_SUCCESS )
        {
            wxLogDebug(wxT("IORegistryEntryCreateCFProperties failed"));
        }

        //
        // Now we get the attributes of each "product" in the iterator
        //

        //Get [product] name
        CFStringRef cfsProduct = (CFStringRef)
            CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductKey));
        m_szProductName =
            wxCFStringRef( wxCFRetain(cfsProduct)
                               ).AsString();

        //Get the Product ID Key
        CFNumberRef cfnProductId = (CFNumberRef)
            CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductIDKey));
        if (cfnProductId)
        {
            CFNumberGetValue(cfnProductId, kCFNumberIntType, &m_nProductId);
//.........这里部分代码省略.........
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:101,代码来源:hid.cpp

示例9: wxLogDebug

bool MyPicsApp::OnInit()
{    
    wxImage::AddHandler( new wxJPEGHandler );
    wxImage::AddHandler( new wxICOHandler );

    // extract the applications resources to files, so we can use them.
    // we could have just put all
    // the resources in the .zip file, but then how would i have 
    // demostrated the other ExtractXXX functions? :)

    // extract all resources of same type (in this case imagess 
    // pecified as type "image" in the .rc file),in one call, 
    // u can specify any type you want, but if you
    // use a number, make shure its an unsigned int OVER 255.
    // Also note that the exCount param passed here is optional.
    int exCount=0;
    bool resOk = m_Resources.ExtractResources(wxT("image"), &exCount);
    if(resOk)
    {
        wxLogDebug(wxT("%d files extracted to %s using ExtractResources()"),
        exCount, m_Resources.GetResourceDir());
    }

    // extract a single resource file "wxmswres.h" of type "txtfile"
    // note that the resource name sould be the same in the .rc file
    // as the desired extracted file name INCLUDING EXTENSION, same
    // goes for ExtractResources()
    resOk = resOk && m_Resources.ExtractResource(wxT("wxmswres.h"),
        wxT("txtfile"));

    if(resOk)
    {
        wxLogDebug(wxT("resource file wxmswres.h extracted to %s using ExtractResource()"),
            m_Resources.GetResourceDir());
    }

    // extract resources contained in a zip file, in this case, the .mo 
    // catalog files, compressed to reduce .exe size
    exCount=0;
    resOk = resOk && m_Resources.ExtractZipResources(wxT("langcats"),
        wxT("zipfile"), &exCount);
    if(resOk)
    {
        wxLogDebug(wxT("%d files extracted to %s using ExtractZipResources()"),
            exCount, m_Resources.GetResourceDir());
    }

    // if the ExtractXXX functions returned true, the resources were
    // extracted successfully, but still you can check if some
    // resource is actually there using this function
    if(m_Resources.RcExtracted(wxT("wx_es.mo")))
        wxLogDebug(wxT("guess what??, wx_ex.mo was extracted successfully"));

    if(!resOk)
    {
        // oops! something went wrong, we better quit here
        wxMessageBox(_("Failed to extract the app´s resources.\nTerminating app..."),
            _("Fatal Error"), wxOK | wxCENTRE | wxICON_ERROR);
        return false;
    }

    // ask user for application language
    DlgLang dlg(NULL);
    wxString langName = dlg.GetSelLanguage();

    // now set the locale & load the app & standar wxWidgets catalogs
    // (previously extracted), but only if selected language was spanish, 
    // since wxWidgets & strings in source code are in english
    
    // set lookup path to our resource dir first!! , or wxLocale
    // will NOT find the catalogs & fail!
    m_Locale.AddCatalogLookupPathPrefix(m_Resources.GetResourceDir());

    bool iInitOk = false; bool cInitOk = false;
    int langId = langName==_("Spanish") ? 
        wxLANGUAGE_SPANISH_MODERN : wxLANGUAGE_ENGLISH_US;

    iInitOk= m_Locale.Init(langId, wxLOCALE_CONV_ENCODING);
    if(!iInitOk)
        wxLogDebug(wxT("Failed to initialize locale!"));

    if(iInitOk && langId == wxLANGUAGE_SPANISH_MODERN)
    {
        cInitOk = m_Locale.AddCatalog(wxT("wx_es"));
        cInitOk = cInitOk && m_Locale.AddCatalog(wxT("mypics_es"));
    }
    if(!cInitOk)
        wxLogDebug(wxT("Failed to load one or more catalogs!"));

    // create the app´s main window (go look at MyFrame´s creation code)
    MyFrame* pFrame = new MyFrame(NULL);
    pFrame->Maximize();
    pFrame->Show();
    SetTopWindow(pFrame);
    return true;
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:96,代码来源:MyPicsApp.cpp

示例10: Stop

void SjPlayer::DoReceiveSignal(int signal, uintptr_t extraLong)
{
	if( !m_impl->InitXine() ) {
		return; // error
	}

	if( signal == THREAD_PREPARE_NEXT )
	{
		// find out the next url to play
		wxString	newUrl;
		//long		newQueueId = 0;
		long		newQueuePos = m_queue.GetCurrPos();

		// try to get next url from queue
		newQueuePos = m_queue.GetNextPos(SJ_PREVNEXT_REGARD_REPEAT);
		if( newQueuePos == -1 )
		{
			// try to enqueue auto-play url
			g_mainFrame->m_autoCtrl.DoAutoPlayIfEnabled(false /*ignoreTimeouts*/);
			newQueuePos = m_queue.GetNextPos(SJ_PREVNEXT_REGARD_REPEAT);

			if( newQueuePos == -1 )
			{
				// no chance, there is nothing more to play ...
				if( signal == THREAD_OUT_OF_DATA )
				{
					Stop();
					SendSignalToMainThread(IDMODMSG_PLAYER_STOPPED_BY_EOQ);
				}
				return;
			}
		}
		newUrl = m_queue.GetUrlByPos(newQueuePos);
		//newQueueId = m_queue.GetIdByPos(newQueuePos);

		// has the URL just failed? try again in the next message look
		wxLogDebug(wxT(" ... SjPlayer::ReceiveSignal(): new URL is \"%s\""), newUrl.c_str());

		if( m_failedUrls.Index( newUrl ) != wxNOT_FOUND )
		{
			wxLogDebug(wxT(" ... SjPlayer::ReceiveSignal(): the URL has failed before, starting over."));
			m_queue.SetCurrPos(newQueuePos);
			SendSignalToMainThread(signal); // start over
			return;
		}

		// try to create the next stream
        if( m_impl->m_currStream ) {
			delete m_impl->m_currStream;
			m_impl->m_currStream = NULL;
		}
		m_impl->m_currStream = new SjXineStream(m_impl, newUrl);
		if( !m_impl->m_currStream->XinePlay() ) {
			wxLogDebug(wxT(" ... SjPlayer::ReceiveSignal(): cannot create the new stream."));
			delete m_impl->m_currStream;
			m_impl->m_currStream = NULL;
		}

		// realize the new position in the UI
		m_queue.SetCurrPos(newQueuePos);
		SendSignalToMainThread(IDMODMSG_TRACK_ON_AIR_CHANGED);
	}
}
开发者ID:antonivich,项目名称:Silverjuke,代码行数:63,代码来源:player_impl_xine.cpp

示例11: wxASSERT


//.........这里部分代码省略.........
    wxASSERT( aTable != NULL );

    MList.ReadFootprintFiles( aTable, !aLibraryName ? NULL : &aLibraryName );

    if( MList.GetErrorCount() )
    {
        MList.DisplayErrors( this );
        return wxEmptyString;
    }

    if( MList.GetCount() == 0 )
    {
        wxString tmp;

        for( unsigned i = 0;  i < libraries.GetCount();  i++ )
        {
            tmp += libraries[i] + wxT( "\n" );
        }

        msg.Printf( _( "No footprints could be read from library file(s):\n\n%s\nin any of "
                       "the library search paths.  Verify your system is configured properly "
                       "so the footprint libraries can be found." ), GetChars( tmp ) );
        DisplayError( aWindow, msg );
        return wxEmptyString;
    }

    if( !aKeyWord.IsEmpty() )       // Create a list of modules found by keyword.
    {
        for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
        {
            if( KeyWordOk( aKeyWord, MList.GetItem( ii ).GetKeywords() ) )
            {
                wxArrayString   cols;
                cols.Add( MList.GetItem( ii ).GetFootprintName() );
                cols.Add( MList.GetItem( ii ).GetNickname() );
                rows.push_back( cols );
            }
        }
    }
    else if( !aMask.IsEmpty() )     // Create a list of modules found by pattern
    {
        for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
        {
            const wxString& candidate = MList.GetItem( ii ).GetFootprintName();

            if( WildCompareString( aMask, candidate, false ) )
            {
                wxArrayString   cols;
                cols.Add( MList.GetItem( ii ).GetFootprintName() );
                cols.Add( MList.GetItem( ii ).GetNickname() );
                rows.push_back( cols );
            }
        }
    }
    else                            // Create the full list of modules
    {
        for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
        {
            wxArrayString   cols;
            cols.Add( MList.GetItem( ii ).GetFootprintName() );
            cols.Add( MList.GetItem( ii ).GetNickname() );
            rows.push_back( cols );
        }
    }

    if( !rows.empty() )
    {
        wxArrayString headers;

        headers.Add( _( "Footprint" ) );
        headers.Add( _( "Library" ) );

        msg.Printf( _( "Footprints [%d items]" ), (int) rows.size() );

        EDA_LIST_DIALOG dlg( aWindow, msg, headers, rows, oldName, DisplayCmpDoc );

        if( dlg.ShowModal() == wxID_OK )
        {
            fpname = dlg.GetTextSelection();

            fpname = dlg.GetTextSelection( 1 ) + wxT( ":" ) + fpname;

            SkipNextLeftButtonReleaseEvent();
        }
        else
            fpname.Empty();
    }
    else
    {
        DisplayError( aWindow, _( "No footprint found." ) );
        fpname.Empty();
    }

    if( fpname != wxEmptyString )
        oldName = fpname;

    wxLogDebug( wxT( "Footprint '%s' was selected." ), GetChars( fpname ) );

    return fpname;
}
开发者ID:natsfr,项目名称:kicad,代码行数:101,代码来源:loadcmp.cpp

示例12: GetCrossHairPosition

MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
                                               FP_LIB_TABLE*   aTable,
                                               bool            aUseFootprintViewer,
                                               wxDC*           aDC )
{
    MODULE*     module = NULL;
    wxPoint     curspos = GetCrossHairPosition();
    wxString    moduleName, keys;
    wxString    libName = aLibrary;
    bool        allowWildSeach = true;

    static wxArrayString HistoryList;
    static wxString      lastComponentName;

    // Ask for a component name or key words
    DIALOG_GET_COMPONENT dlg( this, HistoryList, _( "Load Footprint" ), aUseFootprintViewer );

    dlg.SetComponentName( lastComponentName );

    if( dlg.ShowModal() == wxID_CANCEL )
        return NULL;

    if( dlg.m_GetExtraFunction )
    {
        // SelectFootprintFromLibBrowser() returns the "full" footprint name, i.e.
        // <lib_name>/<footprint name> or FPID format "lib_name:fp_name:rev#"
        moduleName = SelectFootprintFromLibBrowser();
    }
    else
    {
        moduleName = dlg.GetComponentName();
    }

    if( moduleName.IsEmpty() )  // Cancel command
    {
        m_canvas->MoveCursorToCrossHair();
        return NULL;
    }

    if( dlg.IsKeyword() )                          // Selection by keywords
    {
        allowWildSeach = false;
        keys = moduleName;
        moduleName = SelectFootprint( this, libName, wxEmptyString, keys, aTable );

        if( moduleName.IsEmpty() )                 // Cancel command
        {
            m_canvas->MoveCursorToCrossHair();
            return NULL;
        }
    }
    else if( moduleName.Contains( wxT( "?" ) )
           || moduleName.Contains( wxT( "*" ) ) )  // Selection wild card
    {
        allowWildSeach = false;
        moduleName     = SelectFootprint( this, libName, moduleName, wxEmptyString, aTable );

        if( moduleName.IsEmpty() )
        {
            m_canvas->MoveCursorToCrossHair();
            return NULL;                           // Cancel command.
        }
    }

    FPID fpid;

    wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL,
                 wxString::Format( wxT( "Could not parse FPID string '%s'." ),
                                   GetChars( moduleName ) ) );

    try
    {
        module = loadFootprint( fpid );
    }
    catch( const IO_ERROR& ioe )
    {
        wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
                    fpid.Format().c_str(), GetChars( ioe.errorText ) );
    }

    if( !module && allowWildSeach )                // Search with wild card
    {
        allowWildSeach = false;

        wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' );
        moduleName = wildname;

        moduleName = SelectFootprint( this, libName, moduleName, wxEmptyString, aTable );

        if( moduleName.IsEmpty() )
        {
            m_canvas->MoveCursorToCrossHair();
            return NULL;    // Cancel command.
        }
        else
        {
            FPID fpid;

            wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL,
                         wxString::Format( wxT( "Could not parse FPID string '%s'." ),
//.........这里部分代码省略.........
开发者ID:natsfr,项目名称:kicad,代码行数:101,代码来源:loadcmp.cpp

示例13: getLocale

void StateGraphViewerPanel::OnContextMenu(wxContextMenuEvent &Ev)
{
  if (!MouseOver)
    return;
  
  UErrorCode Status = U_ZERO_ERROR;
  auto const TextTable = seec::getResource("TraceViewer",
                                           getLocale(),
                                           Status,
                                           "StateGraphViewer");
  if (U_FAILURE(Status)) {
    wxLogDebug("Couldn't get StateGraphViewer resources.");
    return;
  }
  
  auto const TheNode = MouseOver.get();
  
  if (auto const DV = llvm::dyn_cast<DisplayableValue>(TheNode)) {
    auto const ValuePtr = &(DV->getValue());
    
    wxMenu CM{};
    
    addValueNavigation(*this, CurrentAccess, CM, *ValuePtr, *CurrentProcess,
                       Recording);
    
    // Allow the user to select the Value's layout engine.
    std::unique_lock<std::mutex> LockLayoutHandler(LayoutHandlerMutex);
    auto const Engines = LayoutHandler->listLayoutEnginesSupporting(*ValuePtr);
    LockLayoutHandler.unlock();
    
    if (Engines.size() > 1) {
      auto SM = seec::makeUnique<wxMenu>();
      
      for (auto const E : Engines) {
        auto const LazyName = E->getName();
        if (!LazyName)
          continue;
        
        UErrorCode Status = U_ZERO_ERROR;
        auto const Name = LazyName->get(Status, getLocale());
        if (U_FAILURE(Status))
          continue;
        
        std::string UTF8Name;
        Name.toUTF8String(UTF8Name);
        
        auto const EngineID = reinterpret_cast<uintptr_t>(E);
        
        BindMenuItem(
          SM->Append(wxID_ANY, wxString{UTF8Name}),
          [=] (wxEvent &Ev) -> void {
            {
              std::lock_guard<std::mutex> LLH(this->LayoutHandlerMutex);
              this->LayoutHandler->setLayoutEngine(*ValuePtr, EngineID);
            }
            this->renderGraph();
          });
      }
      
      CM.AppendSubMenu(SM.release(),
                       seec::getwxStringExOrEmpty(TextTable,
                                                  "CMValueDisplayAs"));
    }
    
    PopupMenu(&CM);
  }
  else if (auto const DD = llvm::dyn_cast<DisplayableDereference>(TheNode)) {
    auto const ValOfPtr = &(DD->getPointer());
    
    wxMenu CM{};
    
    BindMenuItem(
      CM.Append(wxID_ANY,
                seec::getwxStringExOrEmpty(TextTable, "CMDereferenceUse")),
      [=] (wxEvent &Ev) -> void {
        {
          std::lock_guard<std::mutex> LLH(this->LayoutHandlerMutex);
          this->LayoutHandler->setAreaReference(*ValOfPtr);
        }
        this->renderGraph();
      });
    
    PopupMenu(&CM);
  }
  else if (auto const DF = llvm::dyn_cast<DisplayableFunctionState>(TheNode)) {
    wxMenu CM{};
    
    auto const FnPtr = &(DF->getFunctionState());
    
    BindMenuItem(
      CM.Append(wxID_ANY,
                seec::getwxStringExOrEmpty(TextTable,
                                           "CMFunctionRewindEntry")),
      [=] (wxEvent &Ev) -> void {
        raiseMovementEvent(*this, this->CurrentAccess,
          [=] (seec::cm::ProcessState &State) {
            return seec::cm::moveToFunctionEntry(*FnPtr);
          });
      });
    
//.........这里部分代码省略.........
开发者ID:mheinsen,项目名称:seec,代码行数:101,代码来源:StateGraphViewer.cpp

示例14: locker

bool wxGISRasterDataset::Open(void)
{
	if(m_bIsOpened)
		return true;

	wxCriticalSectionLocker locker(m_CritSect);


	m_poDataset = (GDALDataset *) GDALOpen( wgWX2MB(m_sPath.c_str()), GA_ReadOnly );
	if( m_poDataset == NULL )
		return false;

	int nXSize = m_poDataset->GetRasterXSize();
	int nYSize = m_poDataset->GetRasterYSize();

	bool bHasOverviews = false;


	char** papszFileList = m_poDataset->GetFileList();
    if( CSLCount(papszFileList) == 0 )
    {
        wxLogDebug(wxT( "Files: none associated" ));
    }
    else
    {
        wxLogDebug(wxT("Files: %s"), wgMB2WX(papszFileList[0]) );
        for(int i = 1; papszFileList[i] != NULL; i++ )
		{
			wxString sFileName = wgMB2WX(papszFileList[i]);
			if(sFileName.Find(wxT(".rrd")) != wxNOT_FOUND || sFileName.Find(wxT(".ovr")) != wxNOT_FOUND)
				bHasOverviews = true;
			wxLogDebug( wxT("       %s"), sFileName.c_str() );
		}
    }
    CSLDestroy( papszFileList );

	CPLSetConfigOption( "USE_RRD", "YES" );
	CPLSetConfigOption( "HFA_USE_RRD", "YES" );
	CPLSetConfigOption( "COMPRESS_OVERVIEW", "LZW" );

	bool bAskCreateOvr = false;
	if(!bHasOverviews && bAskCreateOvr)
	{
		int anOverviewList[5] = { 4, 8, 16, 32, 64 };
		CPLErr err = m_poDataset->BuildOverviews( "CUBIC", 5, anOverviewList, 0, NULL, GDALDummyProgress, NULL );
		//"NEAREST", "GAUSS", "CUBIC", "AVERAGE", "MODE", "AVERAGE_MAGPHASE" or "NONE" 
	}

	//GDALDriver* pDrv = m_poDataset->GetDriver();
	//const char* desc = pDrv->GetDescription();
	//wxLogDebug( wxT("Driver: %s/%s"), wgMB2WX(GDALGetDriverShortName( pDrv )), wgMB2WX(GDALGetDriverLongName( pDrv )) );

	//char** papszMetadata = m_poDataset->GetMetadata();
 //   if( CSLCount(papszMetadata) > 0 )
 //   {
 //       wxLogDebug( wxT( "Metadata:" ));
 //       for(int i = 0; papszMetadata[i] != NULL; i++ )
 //       {
 //           wxLogDebug( wxT( "  %s"), wgMB2WX(papszMetadata[i]) );
 //       }
 //   }

	///* -------------------------------------------------------------------- */
	///*      Report "IMAGE_STRUCTURE" metadata.                              */
	///* -------------------------------------------------------------------- */
 //   papszMetadata = m_poDataset->GetMetadata("IMAGE_STRUCTURE");
 //   if( CSLCount(papszMetadata) > 0 )
 //   {
 //       wxLogDebug( wxT( "Image Structure Metadata:" ));
 //       for(int i = 0; papszMetadata[i] != NULL; i++ )
 //       {
 //           wxLogDebug( wxT(  "  %s"), wgMB2WX(papszMetadata[i]) );
 //       }
 //   }

	///* -------------------------------------------------------------------- */
	///*      Report subdatasets.                                             */
	///* -------------------------------------------------------------------- */
 //   papszMetadata = m_poDataset->GetMetadata("SUBDATASETS");
 //   if( CSLCount(papszMetadata) > 0 )
 //   {
 //       wxLogDebug( wxT( "Subdatasets:" ));
 //       for(int i = 0; papszMetadata[i] != NULL; i++ )
 //       {
 //           wxLogDebug( wxT( "  %s"), wgMB2WX(papszMetadata[i]) );
 //       }
 //   }

	///* -------------------------------------------------------------------- */
	///*      Report geolocation.                                             */
	///* -------------------------------------------------------------------- */
 //   papszMetadata = m_poDataset->GetMetadata("GEOLOCATION");
 //   if( CSLCount(papszMetadata) > 0 )
 //   {
 //       wxLogDebug( wxT( "Geolocation:" ));
 //       for(int i = 0; papszMetadata[i] != NULL; i++ )
 //       {
 //           wxLogDebug( wxT( "  %s"), wgMB2WX(papszMetadata[i]) );
 //       }
 //   }
//.........这里部分代码省略.........
开发者ID:jacklibj,项目名称:r5,代码行数:101,代码来源:rasterdataset.cpp

示例15: Pa_GetHostApiCount

void DevicePrefs::OnHost(wxCommandEvent & e)
{
   // Bail if we have no hosts
   if (mHostNames.size() < 1)
      return;

   // Find the index for the host API selected
   int index = -1;
   wxString apiName = mHostNames[mHost->GetCurrentSelection()];
   int nHosts = Pa_GetHostApiCount();
   for (int i = 0; i < nHosts; ++i) {
      wxString name(Pa_GetHostApiInfo(i)->name, wxConvLocal);
      if (name == apiName) {
         index = i;
         break;
      }
   }
   // We should always find the host!
   if (index < 0) {
      wxLogDebug(wxT("DevicePrefs::OnHost(): API index not found"));
      return;
   }

   int nDevices = Pa_GetDeviceCount();

   if (nDevices == 0) {
      mHost->Clear();
      mHost->Append(_("No audio interfaces"), (void *) NULL);
      mHost->SetSelection(0);
   }

   const std::vector<DeviceSourceMap> &inMaps  = DeviceManager::Instance()->GetInputDeviceMaps();
   const std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();

   wxArrayString playnames;
   wxArrayString recordnames;
   size_t i;
   int devindex;  /* temp variable to hold the numeric ID of each device in turn */
   wxString device;
   wxString recDevice;

   recDevice = mRecordDevice;
   if (this->mRecordSource != wxT(""))
      recDevice += wxString(": ", wxConvLocal) + mRecordSource;

   mRecord->Clear();
   for (i = 0; i < inMaps.size(); i++) {
      if (index == inMaps[i].hostIndex) {
         device   = MakeDeviceSourceString(&inMaps[i]);
         devindex = mRecord->Append(device);
         // We need to const cast here because SetClientData is a wx function
         // It is okay beause the original variable is non-const.
         mRecord->SetClientData(devindex, const_cast<DeviceSourceMap *>(&inMaps[i]));
         if (device == recDevice) {  /* if this is the default device, select it */
            mRecord->SetSelection(devindex);
         }
      }
   }

   mPlay->Clear();
   for (i = 0; i < outMaps.size(); i++) {
      if (index == outMaps[i].hostIndex) {
         device   = MakeDeviceSourceString(&outMaps[i]);
         devindex = mPlay->Append(device);
         mPlay->SetClientData(devindex, const_cast<DeviceSourceMap *>(&outMaps[i]));
         if (device == mPlayDevice) {  /* if this is the default device, select it */
            mPlay->SetSelection(devindex);
         }
      }
   }
   
   /* deal with not having any devices at all */
   if (mPlay->GetCount() == 0) {
      playnames.Add(_("No devices found"));
      mPlay->Append(playnames[0], (void *) NULL);
      mPlay->SetSelection(0);
   }
   if (mRecord->GetCount() == 0) {
      recordnames.Add(_("No devices found"));
      mRecord->Append(recordnames[0], (void *) NULL);
      mRecord->SetSelection(0);
   }

   /* what if we have no device selected? we should choose the default on 
    * this API, as defined by PortAudio. We then fall back to using 0 only if
    * that fails */
   if (mPlay->GetCount() && mPlay->GetSelection() == wxNOT_FOUND) {
      DeviceSourceMap *defaultMap = DeviceManager::Instance()->GetDefaultOutputDevice(index);
      if (defaultMap)
         mPlay->SetStringSelection(MakeDeviceSourceString(defaultMap));

      if (mPlay->GetSelection() == wxNOT_FOUND) {
         mPlay->SetSelection(0);
      }
   }

   if (mRecord->GetCount() && mRecord->GetSelection() == wxNOT_FOUND) {
      DeviceSourceMap *defaultMap = DeviceManager::Instance()->GetDefaultInputDevice(index);
      if (defaultMap)
         mRecord->SetStringSelection(MakeDeviceSourceString(defaultMap));
//.........这里部分代码省略.........
开发者ID:tuanmasterit,项目名称:audacity,代码行数:101,代码来源:DevicePrefs.cpp


注:本文中的wxLogDebug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。