Example #1
0
/// Write the summary to disk.  Derived classes must call this method
/// from their constructors for the summary to be correctly written.
/// It uses the derived class's ReadData() to retrieve the data to
/// summarize.
void AliasBlockFile::WriteSummary()
{
   // Now checked carefully in the DirManager
   //wxASSERT( !wxFileExists(FILENAME(mFileName.GetFullPath())));

   // I would much rather have this code as part of the constructor, but
   // I can't call virtual functions from the constructor.  So we just
   // need to ensure that every derived class calls this in *its* constructor
   wxFFile summaryFile(mFileName.GetFullPath(), wxT("wb"));

   if( !summaryFile.IsOpened() ){
      // Never silence the Log w.r.t write errors; they always count
      // as new errors
      wxLogError(wxT("Unable to write summary data to file %s"),
                   mFileName.GetFullPath().c_str());
      // If we can't write, there's nothing to do.
      return;
   }

   // To build the summary data, call ReadData (implemented by the
   // derived classes) to get the sample data
   samplePtr sampleData = NewSamples(mLen, floatSample);
   this->ReadData(sampleData, floatSample, 0, mLen);

   void *summaryData = BlockFile::CalcSummary(sampleData, mLen,
                                            floatSample);
   summaryFile.Write(summaryData, mSummaryInfo.totalSummaryBytes);

   DeleteSamples(sampleData);
}
Example #2
0
void wxFileCtrl::ChangeToReportMode()
{
    ClearAll();
    SetSingleStyle( wxLC_REPORT );

    // do this since WIN32 does mm/dd/yy UNIX does mm/dd/yyyy
    // don't hardcode since mm/dd is dd/mm elsewhere
    int w, h;
    wxDateTime dt(22, wxDateTime::Dec, 2002, 22, 22, 22);
    wxString txt = dt.FormatDate() + wxT("22") + dt.Format(wxT("%I:%M:%S %p"));
    GetTextExtent(txt, &w, &h);

    InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, w );
    InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, w/2 );
    InsertColumn( 2, _("Type"), wxLIST_FORMAT_LEFT, w/2 );
    InsertColumn( 3, _("Modified"), wxLIST_FORMAT_LEFT, w );
#if defined(__UNIX__)
    GetTextExtent(wxT("Permissions 2"), &w, &h);
    InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, w );
#elif defined(__WIN32__)
    GetTextExtent(wxT("Attributes 2"), &w, &h);
    InsertColumn( 4, _("Attributes"), wxLIST_FORMAT_LEFT, w );
#endif

    UpdateFiles();
}
Example #3
0
// -------------------------------------------------------------------------------- //
bool guDbRadios::GetRadioStation( const int id, guRadioStation * radiostation )
{
  wxString query;
  wxSQLite3ResultSet dbRes;

  query = wxT( "SELECT radiostation_id, radiostation_scid, radiostation_source, radiostation_genreid, " \
               "radiostation_name, radiostation_link, radiostation_type, radiostation_br, radiostation_lc " \
                 "FROM radiostations WHERE " );
  query += wxString::Format( wxT( "radiostation_id = %u LIMIT 1;" ), id );

  dbRes = ExecuteQuery( query );
  if( dbRes.NextRow() )
  {
    radiostation->m_Id         = dbRes.GetInt( 0 );
    radiostation->m_SCId       = dbRes.GetInt( 1 );
    radiostation->m_Source     = dbRes.GetInt( 2 );
    radiostation->m_GenreId    = dbRes.GetInt( 3 );
    radiostation->m_Name       = dbRes.GetString( 4 );
    radiostation->m_Link       = dbRes.GetString( 5 );
    radiostation->m_Type       = dbRes.GetString( 6 );
    radiostation->m_BitRate    = dbRes.GetInt( 7 );
    radiostation->m_Listeners  = dbRes.GetInt( 8 );
    return true;
  }
  return false;
}
Example #4
0
bool pgExtension::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
{
	wxString sql = wxT("DROP EXTENSION ") + GetQuotedIdentifier();
	if (cascaded)
		sql += wxT(" CASCADE");
	return GetDatabase()->ExecuteVoid(sql);
}
Example #5
0
void wxGenericFileDialog::GetPaths( wxArrayString& paths ) const
{
    paths.Empty();
    if (m_list->GetSelectedItemCount() == 0)
    {
        paths.Add( GetPath() );
        return;
    }

    paths.Alloc( m_list->GetSelectedItemCount() );

    wxString dir = m_list->GetDir();
#ifdef __UNIX__
    if (dir != wxT("/"))
#endif
#ifdef __WXWINCE__
        if (dir != wxT("/") && dir != wxT("\\"))
#endif
            dir += wxFILE_SEP_PATH;

    wxListItem item;
    item.m_mask = wxLIST_MASK_TEXT;

    item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
    while ( item.m_itemId != -1 )
    {
        m_list->GetItem( item );
        paths.Add( dir + item.m_text );
        item.m_itemId = m_list->GetNextItem( item.m_itemId,
                                             wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
    }
}
void ViewInfo::WriteXMLAttributes(XMLWriter &xmlFile)
{
    selectedRegion.WriteXMLAttributes(xmlFile, wxT("sel0"), wxT("sel1"));
    xmlFile.WriteAttr(wxT("vpos"), vpos);
    xmlFile.WriteAttr(wxT("h"), h, 10);
    xmlFile.WriteAttr(wxT("zoom"), zoom, 10);
}
Example #7
0
void wxraytracerFrame::OnOpenFile( wxCommandEvent& WXUNUSED( event ) )
{
   wxString caption = wxT("Choose a file");
   
   wxString wildcard = wxT("BMP files (*.bmp)|*.bmp|"
                           "PNG files (*.png)|*.png|"
                           "JPEG files (*.jpg)|*.jpg|"
                           "TIFF files (*.tif)|*.tif");
   
   wxString defaultDir = wxEmptyString;
   wxString defaultFilename = wxEmptyString;
   
   wxFileDialog dialog(this, caption, defaultDir, defaultFilename, wildcard,
                        wxFD_OPEN|wxFD_FILE_MUST_EXIST);
   dialog.SetPath(currentPath);
   
   if (dialog.ShowModal() == wxID_OK)
   {
      currentPath = dialog.GetPath();
      wxImage* theImage = new wxImage();
      theImage->LoadFile(currentPath);
      
      if (!theImage->IsOk())
      {
         delete theImage;
         wxMessageBox(wxT("Sorry, could not load file."));
      }
      else
      {
         canvas->SetImage(*theImage);
         wxMenu* menuFile = GetMenuBar()->GetMenu(0);
         menuFile->Enable(menuFile->FindItem(wxT( "&Save As..."  )) , TRUE);
      }
   }
}
Example #8
0
void Tags::LoadDefaults()
{
   wxString path;
   wxString name;
   wxString value;
   long ndx;
   bool cont;

   // Set the parent group
   path = gPrefs->GetPath();
   gPrefs->SetPath(wxT("/Tags"));

   // Process all entries in the group
   cont = gPrefs->GetFirstEntry(name, ndx);
   while (cont) {
      gPrefs->Read(name, &value, wxT(""));

      if (name == wxT("ID3V2")) {
         // LLL:  This is obsolute, but it must be handled and ignored.
      }
      else {
         SetTag(name, value);
      }

      cont = gPrefs->GetNextEntry(name, ndx);
   }

   // Restore original group
   gPrefs->SetPath(path);
}
Example #9
0
wxArrayString KissMangaCom::GetPageLinks(wxString ChapterLink)
{
    wxArrayString pageLinks;

    CurlRequest cr;
    cr.SetUrl(ChapterLink);
    cr.SetAgent(agent);
    cr.SetCookies(cookies);
    cr.SetCompression(wxT("gzip"));
    wxString content;
    wxStringOutputStream sos(&content);
    cr.SetOutputStream(&sos);
    cr.ExecuteRequest();

    int indexStart = content.find(wxT("var lstImages")) + 13;
    int indexEnd = content.find(wxT("var lstImagesLoaded"), indexStart);

    if(indexStart > 12 && indexEnd > -1)
    {
        content = content.Mid(indexStart, indexEnd-indexStart);
        indexEnd = 0;

        // Example Entry: lstImages.push("http://2.bp.blogspot.com/-m2wUve_VBR8/VsFJRUDLJiI/AAAAAAAFMGc/7HfBG-sFqVA/s16000-Ic42/000.png");
        while((indexStart = content.find(wxT("lstImages.push(\""), indexEnd)) > -1)
        {
            indexStart += 16;
            indexEnd = content.find(wxT("\""), indexStart); // "\""
            pageLinks.Add(content.Mid(indexStart, indexEnd-indexStart));

            //wxYield();
        }
    }

    return pageLinks;
}
Example #10
0
CContactPage::CContactPage(wxWindow* parent, wxWindowID id)
  : wxPanel(parent, id, wxDefaultPosition, wxSize(0,0), wxCLIP_CHILDREN)
{
  Create(parent, id);
  m_RegExNumber.Compile(wxT("[[:digit:]]"), wxRE_ADVANCED);
  m_RegExNoNumber.Compile(wxT("[^[:digit:]]"), wxRE_ADVANCED);
}
void CDummyRepeaterThread::callback(const wxFloat32* input, wxFloat32* output, unsigned int nSamples, int id)
{
	::memset(output, 0x00, nSamples * sizeof(wxFloat32));

	if (m_stopped)
		return;

	if (m_transmit != CLIENT_RECEIVE)
		m_encodeAudio.addData(input, nSamples);

	m_decodeAudio.getData(output, nSamples);

	m_poll.clock();
	m_watchdog.clock();

	// Send the network poll if needed and restart the timer
	if (m_poll.hasExpired()) {
#if defined(__WINDOWS__)
		m_protocol->writePoll(wxT("win_dummy-") + VERSION);
#else
		m_protocol->writePoll(wxT("linux_dummy-") + VERSION);
#endif
		m_poll.reset();
	}
}
Example #12
0
int FbUpdateItem::DoUpdate()
{
	{
		wxString sql = wxT("ATTACH ? AS upd");
		FbSQLite3Statement stmt = m_database.PrepareStatement(sql);
		stmt.Bind(1, m_dataname);
		stmt.ExecuteUpdate();
	}

	int date = m_database.Int(DB_DATAFILE_DATE, wxT("SELECT value FROM upd.params WHERE id=?"));
	if (date <= m_code) return 0;

	wxString type = m_database.Str(DB_LIBRARY_TYPE, wxT("SELECT text FROM upd.params WHERE id=?"));
	if (type.Lower() != m_type) {
		FbLogError(_("Wrong update library type"), type);
		return 0;
	}

	FbSQLite3Transaction trans(&m_database, WXSQLITE_TRANSACTION_EXCLUSIVE);

	ExecDelete();
	ExecInsert();
	CalcCount();

	trans.Commit();

	m_database.ExecuteUpdate(wxT("DETACH upd"));

	return date;
}
Example #13
0
wxJoystick::wxJoystick(int joystick)
    : m_device(-1),
      m_joystick(joystick),
      m_thread(NULL)
{
    wxString dev_name;

    // old /dev structure
    dev_name.Printf( wxT("/dev/js%d"), (joystick == wxJOYSTICK1) ? 0 : 1);
    m_device = open(dev_name.fn_str(), O_RDONLY);

    // new /dev structure with "input" subdirectory
    if (m_device == -1)
    {
        dev_name.Printf( wxT("/dev/input/js%d"), (joystick == wxJOYSTICK1) ? 0 : 1);
        m_device = open(dev_name.fn_str(), O_RDONLY);
    }

    if (m_device != -1)
    {
        m_thread = new wxJoystickThread(m_device, m_joystick);
        m_thread->Create();
        m_thread->Run();
    }
}
void THISCLASS::OnStep() {
	// Get and check input image
	IplImage *inputimage = mCore->mDataStructureImageColor.mImage;
	if (! inputimage) {
		AddError(wxT("No input image."));
		return;
	}
	if (inputimage->nChannels != 3) {
		AddError(wxT("The input image is not a color image."));
		return;
	}

	// Check and update the background
	if (! mFinalImage) {
		mFinalImage = cvCloneImage(inputimage);
	} else if (mMode == sMode_Addition) {
		cvAdd(mFinalImage, inputimage, mFinalImage);
	} else if (mMode == sMode_Subtraction) {
		cvSub(mFinalImage, inputimage, mFinalImage);
	} else if (mMode == sMode_Multiplication) {
	}

	// Set the display
	DisplayEditor de(&mDisplayOutput);
	if (de.IsActive()) {
		de.SetMainImage(mFinalImage);
	}
}
void PostErrorMessage(const wxChar* t)
{
    wxString text;
    text << t << wxT("\nVýpis: ") << wxSysErrorMsg(wxSysErrorCode());
    wxMessageBox(text, wxT("Chyba!"), wxOK | wxICON_EXCLAMATION);
    //MessageBox(NULL, wxSysErrorMsg(wxSysErrorCode()), t, NULL);
}
Example #16
0
wxString wxTarOutputStream::PaxHeaderPath(const wxString& format,
                                          const wxString& path)
{
    wxString d = path.BeforeLast(wxT('/'));
    wxString f = path.AfterLast(wxT('/'));
    wxString ret;

    if (d.empty())
        d = wxT(".");

    ret.reserve(format.length() + path.length() + 16);

    size_t begin = 0;

    for (;;) {
        size_t end;
        end = format.find('%', begin);
        if (end == wxString::npos || end + 1 >= format.length())
            break;
        ret << format.substr(begin, end - begin);
        switch ( format[end + 1].GetValue() ) {
            case 'd': ret << d; break;
            case 'f': ret << f; break;
            case 'p': ret << wxGetProcessId(); break;
            case '%': ret << wxT("%"); break;
        }
        begin = end + 2;
    }

    ret << format.substr(begin);

    return ret;
}
CXReflectorPreferences::CXReflectorPreferences(wxWindow* parent, int id, const wxString& callsign,
						   const wxString& address, bool dplusEnabled, bool logEnabled) :
wxDialog(parent, id, wxString(_("XReflector Preferences"))),
m_reflector(NULL),
m_dplus(NULL),
m_miscellaneous(NULL)
{
	wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);

	wxNotebook* noteBook = new wxNotebook(this, -1);

	m_reflector = new CXReflectorReflectorSet(noteBook, -1, APPLICATION_NAME, callsign, address);
	noteBook->AddPage(m_reflector, _("Reflector"), true);

	m_dplus = new CXReflectorDPlusSet(noteBook, -1, APPLICATION_NAME, dplusEnabled);
	noteBook->AddPage(m_dplus, wxT("D-Plus"), false);

	m_miscellaneous = new CXReflectorMiscellaneousSet(noteBook, -1, APPLICATION_NAME, logEnabled);
	noteBook->AddPage(m_miscellaneous, wxT("Misc"), false);

	mainSizer->Add(noteBook, 1, wxALL | wxGROW, BORDER_SIZE);

	mainSizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);

	SetAutoLayout(true);
	Layout();

	mainSizer->Fit(this);
	mainSizer->SetSizeHints(this);

	SetSizer(mainSizer);
}
Example #18
0
wxString wxTarEntry::GetName(wxPathFormat format /*=wxPATH_NATIVE*/) const
{
    bool isDir = IsDir() && !m_Name.empty();

    // optimisations for common (and easy) cases
    switch (wxFileName::GetFormat(format)) {
        case wxPATH_DOS:
        {
            wxString name(isDir ? m_Name + wxT("\\") : m_Name);
            for (size_t i = 0; i < name.length(); i++)
                if (name[i] == wxT('/'))
                    name[i] = wxT('\\');
            return name;
        }

        case wxPATH_UNIX:
            return isDir ? m_Name + wxT("/") : m_Name;

        default:
            ;
    }

    wxFileName fn;

    if (isDir)
        fn.AssignDir(m_Name, wxPATH_UNIX);
    else
        fn.Assign(m_Name, wxPATH_UNIX);

    return fn.GetFullPath(format);
}
Example #19
0
void EnvVarsTableDlg::OnButtonOk(wxCommandEvent& event)
{
    EvnVarList vars;

    std::map<wxString, wxString> envSets;

    wxString content = m_textCtrlDefault->GetText();
    wxString name = wxT("Default");
    content.Trim().Trim(false);
    envSets[name] = content;

    for(size_t i = 1; i < m_notebook1->GetPageCount(); i++) {
        if(i == (size_t)m_notebook1->GetSelection()) {
            vars.SetActiveSet(m_notebook1->GetPageText(i));
        }

        EnvVarSetPage* page = (EnvVarSetPage*)m_notebook1->GetPage(i);
        wxString content = page->m_textCtrl->GetText();
        wxString name = m_notebook1->GetPageText(i);
        content.Trim().Trim(false);
        envSets[name] = content;
    }
    vars.SetEnvVarSets(envSets);
    EnvironmentConfig::Instance()->WriteObject(wxT("Variables"), &vars);
    
    // Notify that the environment variables were modified
    clCommandEvent eventSave(wxEVT_ENVIRONMENT_VARIABLES_MODIFIED);
    EventNotifier::Get()->AddPendingEvent(eventSave);
    
    event.Skip();
}
Example #20
0
// Static - Internally tars and zips use forward slashes for the path
// separator, absolute paths aren't allowed, and directory names have a
// trailing slash.  This function converts a path into this internal format,
// but without a trailing slash for a directory.
//
wxString wxTarEntry::GetInternalName(const wxString& name,
                                     wxPathFormat format /*=wxPATH_NATIVE*/,
                                     bool *pIsDir        /*=NULL*/)
{
    wxString internal;

    if (wxFileName::GetFormat(format) != wxPATH_UNIX)
        internal = wxFileName(name, format).GetFullPath(wxPATH_UNIX);
    else
        internal = name;

    bool isDir = !internal.empty() && internal.Last() == '/';
    if (pIsDir)
        *pIsDir = isDir;
    if (isDir)
        internal.erase(internal.length() - 1);

    while (!internal.empty() && *internal.begin() == '/')
        internal.erase(0, 1);
    while (!internal.empty() && internal.compare(0, 2, wxT("./")) == 0)
        internal.erase(0, 2);
    if (internal == wxT(".") || internal == wxT(".."))
        internal.clear();

    return internal;
}
Example #21
0
void RenderCanvas::OnTimerUpdate( wxTimerEvent& event )
{
   if(timer == NULL)
      return;
   
   //percent
   float completed = (float)pixelsRendered / (float)pixelsToRender;
      
   wxString progressString = wxString::Format(wxT("Rendering...%d%%"),
                                             (int)(completed*100));
   wxGetApp().SetStatusText( progressString , 0);
   
   //time elapsed
   long interval = timer->Time();
   
   wxTimeSpan timeElapsed(0, 0, 0, interval);
   
   //time remaining
   float remaining = 1.0f - completed;
   long msecRemain = (long)
                       (((double)interval / (completed*100)) * 100 * remaining);
   
   wxTimeSpan timeRemaining(0, 0, 0, msecRemain);
   
   wxString timeRemainString = timeRemaining.Format(wxT(" / ETA: %H:%M:%S"));
   wxString timeString = timeElapsed.Format(wxT("Elapsed Time: %H:%M:%S"));
   
   //only display ETA if something has been completed
   if(msecRemain >= 0)
      wxGetApp().SetStatusText( timeString + timeRemainString, 1);
   else
      wxGetApp().SetStatusText( timeString, 1);
}
Example #22
0
WxGUISizeProperty::WxGUISizeProperty( const wxString& label, const CGUISize& value)
	: wxPGProperty(label,GetUniquePropName())
{
	SetValue( WXVARIANT(value) );
	AddPrivateChild( new wxFloatProperty(wxT("width"), wxT("WIDTH"),value.m_fWidth) );
	AddPrivateChild( new wxFloatProperty(wxT("height"), wxT("HEIGHT"),value.m_fHeight) );
}
Example #23
0
wxString SjVisModule::GetDesiredRenderer()
{
	if( g_mainFrame )
	{
#if 0
		SjBassStream* hstream = g_mainFrame->m_player.RefCurrStream();
		if( hstream )
		{
			if( hstream->m_decoderModule
			        && hstream->m_decoderModule->IsVideoDecoder() )
			{
				hstream->UnRef(); // do not forget this before returning!
				return wxT("memory:vidout.lib");
			}

			hstream->UnRef();
		}
#endif

		// has the currently playing track a karaoke file?
		wxString url = g_mainFrame->GetQueueUrl(-1);
		if( !url.IsEmpty() )
		{
			SjKaraokeMaster tempMaster;
			if( tempMaster.Init(url, wxT("")/*artist not needed for testing*/, wxT("")/*album not needed for testing*/) )
			{
				return wxT("memory:karaoke.lib");
			}
		}
	}

	// the currently playing track is a "normal" music file
	return wxT("");
}
Example #24
0
void DolphinApp::InitLanguageSupport()
{
	unsigned int language = 0;

	IniFile ini;
	ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
	ini.Get("Interface", "Language", &language, wxLANGUAGE_DEFAULT);

	// Load language if possible, fall back to system default otherwise
	if(wxLocale::IsAvailable(language))
	{
		m_locale = new wxLocale(language);

#ifdef _WIN32
		m_locale->AddCatalogLookupPathPrefix(wxT("Languages"));
#endif

		m_locale->AddCatalog(wxT("dolphin-emu"));

		if(!m_locale->IsOk())
		{
			PanicAlertT("Error loading selected language. Falling back to system default.");
			delete m_locale;
			m_locale = new wxLocale(wxLANGUAGE_DEFAULT);
		}
	}
	else
	{
		PanicAlertT("The selected language is not supported by your system. Falling back to system default.");
		m_locale = new wxLocale(wxLANGUAGE_DEFAULT);
	}
}
Example #25
0
wxString wxFileData::GetHint() const
{
    wxString s = m_filePath;
    s += wxT("  ");

    if (IsDir())
        s += _("<DIR>");
    else if (IsLink())
        s += _("<LINK>");
    else if (IsDrive())
        s += _("<DRIVE>");
    else // plain file
        s += wxString::Format( _("%ld bytes"), m_size );

    s += wxT(' ');

    if ( !IsDrive() )
    {
        s << GetModificationTime()
          << wxT("  ")
          << m_permissions;
    }

    return s;
};
void cRawParser::ParseCHG(cXmlNode& node) {
    USE_PREFIX(node);
    cChangingRoom room;
    room.name = ParseString(node, wxT(RAWXML_CHG), wxT("name"), NULL, useprefix).ToAscii();
    room.attraction.name = ParseString(node, wxT(RAWXML_CHG), wxT("nametxt"), NULL, useprefix).ToAscii();
    room.attraction.description = ParseString(node, wxT(RAWXML_CHG), wxT("description"), NULL, useprefix).ToAscii();
    room.sid = ParseString(node, wxT(RAWXML_CHG), wxT("sid"), NULL, useprefix).ToAscii();
    room.spline = ParseString(node, wxT(RAWXML_CHG), wxT("roomspline"), NULL, useprefix).ToAscii();
    wxLogVerbose(wxString::Format(_("Adding chg %s to %s."), wxString(room.name.c_str(), wxConvLocal).c_str(), m_output.GetFullPath().c_str()));

    cXmlNode child(node.children());
    while (child) {
        DO_CONDITION_COMMENT(child);

        if (child(RAWXML_ATTRACTION)) {
            ParseAttraction(child, room.attraction);
        } else if (child.element()) {
            throw MakeNodeException<RCT3Exception>(wxString::Format(_("Unknown tag '%s' in chg tag"), child.wxname().c_str()),child);
        }

        child.go_next();
    }

    ovlCHGManager* c_chg = m_ovl.GetManager<ovlCHGManager>();
    c_chg->AddRoom(room);
}
Example #27
0
void wxFileCtrl::GoToParentDir()
{
    if (!IsTopMostDir(m_dirName))
    {
        size_t len = m_dirName.Len();
        if (wxEndsWithPathSeparator(m_dirName))
            m_dirName.Remove( len-1, 1 );
        wxString fname( wxFileNameFromPath(m_dirName) );
        m_dirName = wxPathOnly( m_dirName );
#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
        if (!m_dirName.empty())
        {
            if (m_dirName.Last() == wxT('.'))
                m_dirName = wxEmptyString;
        }
#elif defined(__UNIX__)
        if (m_dirName.empty())
            m_dirName = wxT("/");
#endif
        UpdateFiles();
        long id = FindItem( 0, fname );
        if (id != wxNOT_FOUND)
        {
            ignoreChanges = true;
            SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
            EnsureVisible( id );
            ignoreChanges = false;
        }
    }
}
Example #28
0
void wxOgre::cameraTrackNode(Ogre::SceneNode* target)
{
	static const wxString camCalcPosCaption(wxT("CalcCamPos:X:%08.4f, Y:%08.4f, Z:%08.4f"));
	static const wxString camRealPosCaption(wxT("CalcCamPos:X:%08.4f, Y:%08.4f, Z:%08.4f"));

	// TODO: Position camera somwehere sensible relative to object
	if (target)
	{
		Ogre::LogManager* logMgr = Ogre::LogManager::getSingletonPtr();
		Ogre::Log* log(logMgr->getDefaultLog());
		mTarget = target;
		Ogre::Vector3 size( target->getAttachedObject(0)->getBoundingBox().getSize() );
		Ogre::Vector3 camPos(target->getPosition() + size * 1.2f); 
		setZoomScale(size.length() / 30.0f);
		mCameraNode->setPosition(camPos);
		mCamera->lookAt(target->getPosition());
		mDebugPanelOverlay->show();
		wxString msg(wxString::Format(camCalcPosCaption, camPos.x, camPos.y, camPos.x));
		log->logMessage(Ogre::String(msg.mb_str(wxConvUTF8)));
		Ogre::Vector3 camRealPos(mCamera->getRealPosition());
		msg = wxString(wxString::Format(camCalcPosCaption, camRealPos.x, camRealPos.y, camRealPos.x));
		log->logMessage(Ogre::String(msg.mb_str(wxConvUTF8)));
	} else {
		mTarget = NULL;
	}

}
Example #29
0
// -------------------------------------------------------------------------------- //
void guDbRadios::SetRadioStationsLabels( const guArrayListItems &labelsets )
{
  wxString query;
  wxArrayInt Stations;
  wxArrayInt Labels;
  int StaIndex;
  int StaCount;
  int LaIndex;
  int LaCount;

  if( ( StaCount = labelsets.Count() ) )
  {
    for( StaIndex = 0; StaIndex < StaCount; StaIndex++ )
    {
        Stations.Add( labelsets[ StaIndex ].GetId() );
    }
    query = wxT( "DELETE FROM radiosetlabels " \
                 "WHERE radiosetlabel_stationid IN " ) + ArrayIntToStrList( Stations );

    ExecuteUpdate( query );

    for( StaIndex = 0; StaIndex < StaCount; StaIndex++ )
    {
      Labels = labelsets[ StaIndex ].GetData();
      LaCount = Labels.Count();
      for( LaIndex = 0; LaIndex < LaCount; LaIndex++ )
      {
        query = wxString::Format( wxT( "INSERT INTO radiosetlabels( radiosetlabel_labelid, radiosetlabel_stationid ) " \
                                       "VALUES( %u, %u );" ), Labels[ LaIndex ], Stations[ StaIndex ] );
        ExecuteUpdate( query );
      }
    }
  }
}
/**
 * return the short net name of the item i.e. the net name
 * from the "best" label without any prefix.
 * 2 different nets can have the same short name
 */
wxString NETLIST_OBJECT::GetShortNetName( bool adoptTimestamp ) const
{
    if( m_netNameCandidate == NULL )
        return wxEmptyString;

    wxString netName;

    if( m_netNameCandidate->m_Type == NET_PIN )
    {
        SCH_COMPONENT* link = m_netNameCandidate->GetComponentParent();
        if( link )  // Should be always true
        {
            netName = wxT("Net-(");
            netName << link->GetRef( &m_netNameCandidate->m_SheetPath );

            if( adoptTimestamp && netName.Last() == '?' )
                netName << link->GetTimeStamp();

            netName << wxT("-Pad")
                    << LIB_PIN::PinStringNum( m_netNameCandidate->m_PinNum )
                    << wxT(")");
        }
    }
    else
        netName = m_netNameCandidate->m_Label;

    return netName;
}