Beispiel #1
0
bool Tags::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
{
   if (wxStrcmp(tag, wxT("tags")) != 0)
      return false;

   // loop through attrs, which is a null-terminated list of
   // attribute-value pairs
   while(*attrs) {
      const wxChar *attr = *attrs++;
      const wxChar *value = *attrs++;

      if (!value)
         break;

      if (!wxStrcmp(attr, wxT("title")))
         mTitle = value;
      else if (!wxStrcmp(attr, wxT("artist")))
         mArtist = value;
      else if (!wxStrcmp(attr, wxT("album")))
         mAlbum = value;
      else if (!wxStrcmp(attr, wxT("track")))
         mTrackNum = wxAtoi(value);
      else if (!wxStrcmp(attr, wxT("year")))
         mYear = value;
      else if (!wxStrcmp(attr, wxT("genre")))
         mGenre = wxAtoi(value);
      else if (!wxStrcmp(attr, wxT("comments")))
         mComments = value;
      else if (!wxStrcmp(attr, wxT("id3v2")))
         mID3V2 = wxAtoi(value)?true:false;         
   } // while

   
   return true;
}
Beispiel #2
0
ItemRecord::ItemRecord(wxString line)
    : type(0)
{
	id = wxAtoi(line.BeforeFirst(','));
	line = line.AfterFirst(',');
	quality = wxAtoi(line.BeforeFirst(','));
	line = line.AfterFirst(',');
	try {
		ItemDB::Record r = itemdb.getById(id);
		model = r.getInt(ItemDB::ItemDisplayInfo);
		itemclass = r.getInt(ItemDB::Itemclass);
		subclass = r.getInt(ItemDB::Subclass);
		type = r.getInt(ItemDB::InventorySlot);
		switch(r.getInt(ItemDB::Sheath)) {
			case SHEATHETYPE_MAINHAND: sheath = ATT_LEFT_BACK_SHEATH; break;
			case SHEATHETYPE_LARGEWEAPON: sheath = ATT_LEFT_BACK; break;
			case SHEATHETYPE_HIPWEAPON: sheath = ATT_LEFT_HIP_SHEATH; break;
			case SHEATHETYPE_SHIELD: sheath = ATT_MIDDLE_BACK_SHEATH; break;
			default: sheath = SHEATHETYPE_NONE;
		}
		discovery = false;
		name.Printf(wxT("%s [%d] [%d]"), line.c_str(), id, model);
	} catch (ItemDB::NotFound) {}

}
void ArtikelEdit::FillChkListHersteller(vector< vector< wxString > > data)
{
    if(data.size() > 0)
    {
        if(chklist_herstellerBox)
        {
            arr_db_list.Clear();
            chklist_herstellerBox->Clear();
            
            for(int i = 0; i < data.size(); ++i)
            {
                arr_db_list.Add(wxAtoi(data[i][0]));               
                chklist_herstellerBox->Append(data[i][1]);
                
                if(!herstellerSelectionChanged && wxAtoi(data[i][0]) == oldHerstellerId)
                {
                    chklist_herstellerBox->Select(i);
                    chklist_herstellerBox->Check(i, true);
                    lastSelectedItem = i;
                    herstellerIdArrPos = i;
                }
            }
        }
    }
    
    
}
Beispiel #4
0
bool szHelpController::InitializeContext(const wxString& filepath)
{
	if (wxFileName::FileExists(filepath))
	{   
		m_begin_id = new map_id;
		m_begin_id->next=NULL;
		map_id *tmp_id = m_begin_id;
		wxTextFile *map_file = new wxTextFile;
		wxString tmp_str;
		
		map_file->Open(filepath);
		for (tmp_str = map_file->GetFirstLine(); !map_file->Eof(); tmp_str = map_file->GetNextLine())
		{
	    		tmp_id->id = wxAtoi(tmp_str);
			tmp_id->section += tmp_str;
			tmp_id->section.Remove(0,(tmp_id->section.Find(_T(" ")))+1);
			tmp_id->next = new map_id;
			tmp_id = tmp_id->next;
			tmp_id->next=NULL;
		}
   		tmp_id->id=wxAtoi(tmp_str);
		tmp_id->section += tmp_str;
		tmp_id->section.Remove(0,(tmp_id->section.Find(_T(" ")))+1);
		map_file->Close();
		return TRUE;
	}
	return FALSE;
}
Beispiel #5
0
void PWSGridTable::RestoreSettings(void) const
{
  wxString colShown = towxstring(PWSprefs::GetInstance()->GetPref(PWSprefs::ListColumns));
  wxString colWidths = towxstring(PWSprefs::GetInstance()->GetPref(PWSprefs::ColumnWidths));

  wxArrayString colShownArray = wxStringTokenize(colShown, wxT(" \r\n\t,"), wxTOKEN_STRTOK);
  wxArrayString colWidthArray = wxStringTokenize(colWidths, wxT(" \r\n\t,"), wxTOKEN_STRTOK);
  
  if (colShownArray.Count() != colWidthArray.Count() || colShownArray.Count() == 0)
    return;

  //turn off all the columns first
  for(size_t n = 0; n < WXSIZEOF(PWSGridCellData); ++n) {
    PWSGridCellData[n].visible = false;
  }

  //now turn on the selected columns
  for( size_t idx = 0; idx < colShownArray.Count(); ++idx) {
    const int fieldType = wxAtoi(colShownArray[idx]);
    const int fieldWidth = wxAtoi(colWidthArray[idx]);
    for(size_t n = 0; n < WXSIZEOF(PWSGridCellData); ++n) {
      if (PWSGridCellData[n].ft == fieldType) {
        PWSGridCellData[n].visible = true;
        PWSGridCellData[n].width = fieldWidth;
        PWSGridCellData[n].position = idx;
        break;
      }
    }
  }
}
/// Updates the contents of the FontSetting object using a delimited string containing the font settings
/// @param string Comma delimited string containing the font settings (FaceName,PointSize,Weight,Italic(T/F),Underline(T/F),StrikeOut(T/F),Color)
/// @return success or failure
bool FontSetting::SetFontSettingFromString(const wxChar* string)
{
    //------Last Checked------//
    // - Dec 6, 2004
    wxCHECK(string != NULL, false);
    
    wxString temp;

    // Extract the face name
    wxExtractSubString(temp, string, 0, wxT(','));
    temp.Trim(false);
    temp.Trim();
    m_faceName = temp;
    if (m_faceName.IsEmpty())
        m_faceName = DEFAULT_FACENAME;

    // Extract the point size
    wxExtractSubString(temp, string, 1, wxT(','));
    temp.Trim(false);
    temp.Trim();
    m_pointSize = wxAtoi(temp);
    if (m_pointSize == 0)
        m_pointSize = DEFAULT_POINTSIZE;

    // Extract the weight
    wxExtractSubString(temp, string, 2, wxT(','));
    temp.Trim(false);
    temp.Trim();
    m_weight = wxAtoi(temp);
    if ((m_weight % 100) != 0)
        m_weight = DEFAULT_WEIGHT;
    
    // Extract the italic setting
    wxExtractSubString(temp, string, 3, wxT(','));
    temp.Trim(false);
    temp.Trim();
    m_italic = (wxByte)((::wxStricmp(temp, wxT("T")) == 0) ? true : false);
    
    // Extract the underline setting
    wxExtractSubString(temp, string, 4, wxT(','));
    temp.Trim(false);
    temp.Trim();
    m_underline = (wxByte)((::wxStricmp(temp, wxT("T")) == 0) ? true : false);

    // Extract the strikeout setting
    wxExtractSubString(temp, string, 5, wxT(','));
    temp.Trim(false);
    temp.Trim();
    m_strikeOut = (wxByte)((::wxStricmp(temp, wxT("T")) == 0) ? true : false);

    // Extract the color
    wxExtractSubString(temp, string, 6, wxT(','));
    temp.Trim(false);
    temp.Trim();
    wxUint32 color = wxAtoi(temp);
    m_color = wxColor(LOBYTE(LOWORD(color)), HIBYTE(LOWORD(color)), LOBYTE(HIWORD(color)));
    
    return (true);
}
wxGISAcceleratorTable::wxGISAcceleratorTable(wxGISApplicationBase* pApp) : bHasChanges(true)
{
	m_AccelEntryArray.reserve(20);

	wxGISAppConfig oConfig = GetConfig();
    if(!oConfig.IsOk())
		return;

	wxXmlNode* pAcceleratorsNodeCU = oConfig.GetConfigNode(enumGISHKCU, pApp->GetAppName() + wxString(wxT("/accelerators")));
	wxXmlNode* pAcceleratorsNodeLM = oConfig.GetConfigNode(enumGISHKLM, pApp->GetAppName() + wxString(wxT("/accelerators")));
	//merge two tables
	m_pApp = pApp;
	if(!pApp)
		return;

	//TODO: merge acc tables
	//TODO: if user delete key - it must be mark as deleted to avoid adding it fron LM table

	if(pAcceleratorsNodeCU)
	{
		wxXmlNode *child = pAcceleratorsNodeCU->GetChildren();
		while(child)
		{
			wxString sCmdName = child->GetAttribute(wxT("cmd_name"), NON);
			unsigned char nSubtype = wxAtoi(child->GetAttribute(wxT("subtype"), wxT("0")));
			wxGISCommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype);
			if(pCmd)
			{
				wxString sFlags = child->GetAttribute(wxT("flags"), wxT("NORMAL"));
                wxDword Flags = GetFlags(sFlags);
				wxString sKey = child->GetAttribute(wxT("keycode"), wxT("A"));
				int nKey = GetKeyCode(sKey);
				Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetId()));
			}
			child = child->GetNext();
		}
	}
	if(pAcceleratorsNodeLM)
	{
		wxXmlNode *child = pAcceleratorsNodeLM->GetChildren();
		while(child)
		{
			wxString sCmdName = child->GetAttribute(wxT("cmd_name"), NON);
			unsigned char nSubtype = wxAtoi(child->GetAttribute(wxT("subtype"), wxT("0")));
			wxGISCommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype);
			if(pCmd)
			{
				wxString sFlags = child->GetAttribute(wxT("flags"), wxT("NORMAL"));
                wxDword Flags = GetFlags(sFlags);
				wxString sKey = child->GetAttribute(wxT("keycode"), wxT("A"));
				int nKey = GetKeyCode(sKey);
				Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetId()));
			}
			child = child->GetNext();
		}
	}
}
Beispiel #8
0
int wxSystemOptions::GetOptionInt(const wxString& name)
{
#ifdef _PACC_VER
    // work around the PalmOS pacc compiler bug
    return wxAtoi (GetOption(name).data());
#else
    return wxAtoi (GetOption(name));
#endif
}
void ViewerWindow::onStatsTimer(wxTimerEvent& event)
{
  if(canvas && canvas->conn)
    {
      VNCConn* c = canvas->conn;

      text_ctrl_updrawbytes->Clear();
      text_ctrl_updcount->Clear();
      text_ctrl_latency->Clear();
      text_ctrl_lossratio->Clear();

      if(!c->isMulticast())
	{
	  label_lossratio->Show(false);
	  text_ctrl_lossratio->Show(false);
	  label_recvbuf->Show(false);
	  gauge_recvbuf->Show(false);
	}
      else
	{
	  label_lossratio->Show(true);
	  text_ctrl_lossratio->Show(true);
	  label_recvbuf->Show(true);
	  gauge_recvbuf->Show(true);
	}
      stats_container->Layout();

      if( ! c->getStats().IsEmpty() )
	{
	  // it is imperative here to obey the format of the sample string!
	  wxStringTokenizer tokenizer(c->getStats().Last(),  wxT(","));
	  tokenizer.GetNextToken(); // skip UTC time
	  tokenizer.GetNextToken(); // skip conn time
	  tokenizer.GetNextToken(); // skip rcvd bytes
	  *text_ctrl_updrawbytes << wxAtoi(tokenizer.GetNextToken())/1024; // inflated bytes
	  *text_ctrl_updcount << tokenizer.GetNextToken();
	  int latency =  wxAtoi(tokenizer.GetNextToken());
	  if(latency >= 0)
	    *text_ctrl_latency << latency;
	 
	  double lossratio = c->getMCLossRatio();
	  if(lossratio >= 0) // can be -1 if nothing to measure
	    *text_ctrl_lossratio << lossratio;
	}

      gauge_recvbuf->SetRange(c->getMCBufSize());
      gauge_recvbuf->SetValue(c->getMCBufFill());

      // flash red when buffer full
      if(gauge_recvbuf->GetRange() == gauge_recvbuf->GetValue())
	label_recvbuf->SetForegroundColour(*wxRED);
      else
	label_recvbuf->SetForegroundColour(dflt_fg);
    }
}
Beispiel #10
0
// return true if version string is older than compare string
bool RenderableEffect::IsVersionOlder(const std::string& compare, const std::string& version)
{
    wxArrayString compare_parts = wxSplit(compare, '.');
    wxArrayString version_parts = wxSplit(version, '.');
    if( wxAtoi(version_parts[0]) < wxAtoi(compare_parts[0]) ) return true;
    if( wxAtoi(version_parts[0]) > wxAtoi(compare_parts[0]) ) return false;
    if( wxAtoi(version_parts[1]) < wxAtoi(compare_parts[1]) ) return true;
    if( wxAtoi(version_parts[1]) > wxAtoi(compare_parts[1]) ) return false;
    if( wxAtoi(version_parts[2]) < wxAtoi(compare_parts[2]) ) return true;
    return false;
}
Beispiel #11
0
void PianoEffect::Render(Effect *effect, const SettingsMap &SettingsMap, RenderBuffer &buffer) {
    RenderPiano(buffer,
                SettingsMap["CHOICE_Piano_Style"],
                wxAtoi(SettingsMap["SLIDER_Piano_NumKeys"]),
                wxAtoi(SettingsMap["SLIDER_Piano_NumRows"]),
                SettingsMap["CHOICE_Piano_Placement"],
                SettingsMap["CHECKBOX_Piano_Clipping"] == "1",
                SettingsMap["TEXTCTRL_Piano_CueFilename"],
                SettingsMap["TEXTCTRL_Piano_MapFilename"],
                SettingsMap["TEXTCTRL_Piano_ShapeFilename"]);
}
Beispiel #12
0
wxGISAcceleratorTable::wxGISAcceleratorTable(IApplication* pApp, IGISConfig* pConf) : bHasChanges(true)
{
	m_AccelEntryArray.reserve(20);
	m_pConf = pConf;

	wxXmlNode* pAcceleratorsNodeCU = m_pConf->GetConfigNode(enumGISHKCU, wxString(wxT("accelerators")));
	wxXmlNode* pAcceleratorsNodeLM = m_pConf->GetConfigNode(enumGISHKLM, wxString(wxT("accelerators")));
	//merge two tables
	m_pApp = pApp;
	if(!pApp)
		return;

	//merge acc tables
	//if user delete key - it must be mark as deleted to avoid adding it fron LM table

	if(pAcceleratorsNodeCU)
	{
		wxXmlNode *child = pAcceleratorsNodeCU->GetChildren();
		while(child)
		{
			wxString sCmdName = child->GetPropVal(wxT("cmd_name"), NON);
			unsigned char nSubtype = wxAtoi(child->GetPropVal(wxT("subtype"), wxT("0")));
			ICommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype);
			if(pCmd)
			{
				wxString sFlags = child->GetPropVal(wxT("flags"), wxT("NORMAL"));
				WXDWORD Flags = GetFlags(sFlags);
				wxString sKey = child->GetPropVal(wxT("keycode"), wxT("A"));
				int nKey = GetKeyCode(sKey);
				Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetID()));
			}
			child = child->GetNext();
		}
	}
	if(pAcceleratorsNodeLM)
	{
		wxXmlNode *child = pAcceleratorsNodeLM->GetChildren();
		while(child)
		{
			wxString sCmdName = child->GetPropVal(wxT("cmd_name"), NON);
			unsigned char nSubtype = wxAtoi(child->GetPropVal(wxT("subtype"), wxT("0")));
			ICommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype);
			if(pCmd)
			{
				wxString sFlags = child->GetPropVal(wxT("flags"), wxT("NORMAL"));
				WXDWORD Flags = GetFlags(sFlags);
				wxString sKey = child->GetPropVal(wxT("keycode"), wxT("A"));
				int nKey = GetKeyCode(sKey);
				Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetID()));
			}
			child = child->GetNext();
		}
	}
}
Beispiel #13
0
bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
{
   if (!wxStrcmp(tag, wxT("waveblock"))) {
      SeqBlock *wb = new SeqBlock();
      wb->f = 0;
      wb->start = 0;

      // loop through attrs, which is a null-terminated list of
      // attribute-value pairs
      while(*attrs) {
         const wxChar *attr = *attrs++;
         const wxChar *value = *attrs++;
         
         if (!value)
            break;
         
         if (!wxStrcmp(attr, wxT("start")))
            wb->start = wxAtoi(value);

         // Handle length tag from legacy project file
         if (!wxStrcmp(attr, wxT("len")))
            mDirManager->SetLoadingBlockLength(wxAtoi(value));
 
      } // while

      mBlock->Add(wb);
      mDirManager->SetLoadingTarget(&wb->f);

      return true;
   }
   
   if (!wxStrcmp(tag, wxT("sequence"))) {
      while(*attrs) {
         const wxChar *attr = *attrs++;
         const wxChar *value = *attrs++;
         
         if (!value)
            break;
         
         if (!wxStrcmp(attr, wxT("maxsamples")))
            mMaxSamples = wxAtoi(value);
         else if (!wxStrcmp(attr, wxT("sampleformat")))
            mSampleFormat = (sampleFormat)wxAtoi(value);
         else if (!wxStrcmp(attr, wxT("numsamples")))
            mNumSamples = wxAtoi(value);         
      } // while

      return true;
   }
   
   return false;
}
Beispiel #14
0
wxHtmlImageMapAreaCell::wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::celltype t, wxString &incoords, double pixel_scale )
{
    int i;
    wxString x = incoords, y;

    type = t;
    while ((i = x.Find( ',' )) != wxNOT_FOUND)
    {
        coords.Add( (int)(pixel_scale * (double)wxAtoi( x.Left( i ).c_str())) );
        x = x.Mid( i + 1 );
    }
    coords.Add( (int)(pixel_scale * (double)wxAtoi( x.c_str())) );
}
Beispiel #15
0
bool mHTTP::ParseHeaders()
{
    wxString line;
    char buf[8192];
    bool firstline = TRUE;
    unsigned int lastcount = 0,count = 0;
    unsigned int i;
    wxHTTP::Read(buf,8192);
    lastcount = wxHTTP::LastCount();
    do
    {
        line.Clear();
        while ((buf[count] != '\n') && (count <8192))
        {
            if ((buf[count] != '\n') && (buf[count] != '\r'))
                line.Append(buf[count],1);
            count++;
        }
        if (count < 8192)
        {
            count++;
            if (buf[count] == '\r')
                count++;
        }
        else
        {
            m_messagereceived += wxT("\nImcomplete message\n");
            return false;
        }
        m_messagereceived += line + wxT("\n");
        if (!firstline)
        {
            wxString left_str = line.BeforeFirst(':');
            m_headers[left_str] = line.AfterFirst(':').Strip(wxString::both);
        }
        else
        {
            m_http_response = wxAtoi(line.Mid(9,1));
            m_http_complete_response = wxAtoi(line.Mid(9,3));
            firstline = FALSE;
        }
    }while (line != wxEmptyString);

    {//PUT IN THE QUEUE THE DATA THAT ISN'T PART OF THE MESSAGE
        char unreadbuf[8192];
        for (i = 0 ; i < (lastcount-count);i++)
            unreadbuf[i] = buf[i+count];
        wxHTTP::Unread(unreadbuf,i);
    }
    return true;
}
Beispiel #16
0
void ModelDimmingCurveDialog::OnRGBGammaText(wxCommandEvent& event)
{
    float f = wxAtof(validate(RGBRedGammaTextCtrl->GetValue(), "1.0"));
    int i = wxAtoi(validate(RGBRedTextCtrl->GetValue(), "0"));
    redDCPanel->SetDimmingCurve(DimmingCurve::createBrightnessGamma(i, f), 0);
    
    f = wxAtof(validate(RGBGreenGammaTextCtrl->GetValue(), "1.0"));
    i = wxAtoi(validate(RGBGreenTextCtrl->GetValue(), "0"));
    greenDCPanel->SetDimmingCurve(DimmingCurve::createBrightnessGamma(i, f), 0);

    f = wxAtof(validate(RGBBlueGammaTextCtrl->GetValue(), "1.0"));
    i = wxAtoi(validate(RGBBlueTextCtrl->GetValue(), "0"));
    blueDCPanel->SetDimmingCurve(DimmingCurve::createBrightnessGamma(i, f), 0);
}
Beispiel #17
0
NPCRecord::NPCRecord(wxString line)
    : id(0), model(0), type(0)
{
	if (line.Len() <= 3)
	    return;
	id = wxAtoi(line.BeforeFirst(','));
	line = line.AfterFirst(',');
	model = wxAtoi(line.BeforeFirst(','));
	line = line.AfterFirst(',');
	type = wxAtoi(line.BeforeFirst(','));
	line = line.AfterFirst(',');
	discovery = false;
	name.Printf(wxT("%s [%d] [%d]"), line.c_str(), id, model);
}
Beispiel #18
0
void mmReportBudget::GetFinancialYearValues(int& day, int& month)
{
    day = wxAtoi(mmOptions::instance().financialYearStartDayString_);
    month = wxAtoi(mmOptions::instance().financialYearStartMonthString_) - 1;
    if ( (day > 28) && (month == wxDateTime::Feb) )
        day = 28;
    else if ( ((day > 30) && (month == wxDateTime::Sep)) ||
              ((day > 30) && (month == wxDateTime::Apr)) ||
              ((day > 30) && (month == wxDateTime::Jun)) ||
              ((day > 30) && (month == wxDateTime::Nov)) )
    {
        day = 30;
    }
}
Beispiel #19
0
void CFontPropertyPage::OnChangeFont(wxCommandEvent &event)
{
    if( !m_dirty )
        m_dirty = true;
    if( event.GetEventObject() == itemChoice7 )
    {
        m_faceName = itemChoice7->GetValue();
        FillSizeList();
    }
    if( event.GetEventObject() == itemChoice10 )
    {
        wxString style = itemChoice10->GetValue();
        if( style == "Bold" || style == "Bold Italic" )
        {
            m_weight = wxFONTWEIGHT_BOLD;
            m_font.MakeBold();
        }
        if( style == "Italic" || style == "Bold Italic" )
        {
            m_style = wxFONTSTYLE_ITALIC;
            m_font.MakeItalic();
        }
        if( style == "Regular" )
        {
            m_weight = wxFONTWEIGHT_NORMAL;
            m_style = wxFONTSTYLE_NORMAL;
            m_font.SetStyle( wxFONTSTYLE_NORMAL );
            m_font.SetWeight( wxFONTWEIGHT_NORMAL );
        }
    }
    if( event.GetEventObject() == itemChoice19 )
    {
        m_ptSize = wxAtoi( itemChoice19->GetValue() );
        m_font.SetPointSize( wxAtoi( itemChoice19->GetValue() ) );
    }
    if( event.GetEventObject() == itemCheckBox1 )
    {
        m_striken = itemCheckBox1->GetValue();
        m_font.SetUnderlined( itemCheckBox1->GetValue() );
    }
    if( event.GetEventObject() == itemCheckBox2 )
    {
        m_underline = itemCheckBox2->GetValue();
        m_font.SetStrikethrough( itemCheckBox2->GetValue() );
    }
    itemWindow24->SetFont( m_font );
    itemWindow24->Refresh();
    GetParent()->FindWindowById( wxID_APPLY )->Enable();
}
Beispiel #20
0
void rc2wxr::ReadRect(int & x, int & y, int & width, int & height)

{

x=wxAtoi(GetToken());

y=wxAtoi(GetToken());

width=wxAtoi(GetToken());

height=wxAtoi(GetToken());



}
Beispiel #21
0
bool wxGISGPParameter::SetFromString(wxString &sParam)
{
	sParam.Replace(wxT("\\\""), wxT("\""));

    switch(m_DataType)
    {
    case enumGISGPParamDTBool:
        m_Value = wxVariant((bool)wxAtoi(sParam));
        break;        
	case enumGISGPParamDTInteger:
		m_Value = wxVariant(wxAtoi(sParam));
        break;        
	case enumGISGPParamDTDouble:
		m_Value = wxVariant(wxAtof(sParam));
        break;        
	case enumGISGPParamDTText:
	case enumGISGPParamDTSpatRef:
	case enumGISGPParamDTPath:
	case enumGISGPParamDTPathArray:
    case enumGISGPParamDTStringChoice:
        m_Value = wxVariant(sParam);
        break;        
	case enumGISGPParamDTIntegerChoice:
        m_Value = wxVariant(wxAtoi(sParam));
        break; 
	case enumGISGPParamDTDoubleChoice:  
        m_Value = wxVariant(wxAtof(sParam));
        break; 
    case enumGISGPParamDTStringList:
	case enumGISGPParamDTIntegerList:
	case enumGISGPParamDTDoubleList:
		m_Value = wxStringTokenize(sParam, wxT(";"), wxTOKEN_RET_EMPTY);
        break;        
    case enumGISGPParamDTUnknown:
    default:
        m_Value = wxVariant(sParam);
        break;        
    }

	if(m_pDomain)
	{
		int nPos = m_pDomain->GetPosByValue(m_Value);
		if(nPos != wxNOT_FOUND)
			SetSelDomainValue(nPos);
	}

    return true;
}
int WrappedType::ReadAsInt()
{
   switch( eWrappedType )
   {
   case eWrappedString:
      return wxAtoi( *mpStr );
      break;
   case eWrappedInt:
      return *mpInt;
      break;
   case eWrappedDouble:
      return (int)*mpDouble;
      break;
   case eWrappedBool:
      return (* mpBool) ? 1 : 0;
      break;
   case eWrappedEnum:
      wxASSERT( false );
      break;
   default:
      wxASSERT( false );
      break;
   }
   return -1;//Compiler pacifier
}
Beispiel #23
0
void ArchesModel::InitModel() {
    int NumArches=parm1;
    int SegmentsPerArch=parm2;
    arc = wxAtoi(ModelXml->GetAttribute("arc", "180"));

    
    SetBufferSize(NumArches,SegmentsPerArch);
    if (SingleNode) {
        SetNodeCount(NumArches * SegmentsPerArch, parm3,rgbOrder);
    } else {
        SetNodeCount(NumArches, SegmentsPerArch, rgbOrder);
        if (parm3 > 1) {
            for (int x = 0; x < Nodes.size(); x++) {
                Nodes[x]->Coords.resize(parm3);
            }
        }
    }
    screenLocation.SetRenderSize(SegmentsPerArch, NumArches);
    
    for (int y=0; y < NumArches; y++) {
        for(int x=0; x<SegmentsPerArch; x++) {
            int idx = y * SegmentsPerArch + x;
            Nodes[idx]->ActChan = stringStartChan[y] + x*GetNodeChannelCount(StringType);
            Nodes[idx]->StringNum=y;
            for(size_t c=0; c < GetCoordCount(idx); c++) {
                Nodes[idx]->Coords[c].bufX=IsLtoR ? x : SegmentsPerArch-x-1;
                Nodes[idx]->Coords[c].bufY=isBotToTop ? y : NumArches-y-1;
            }
        }
    }
    SetArchCoord();
}
int Model_Setting::GetIntSetting(const wxString& key, int default_value)
{
    wxString value = this->GetStringSetting(key, "");
    if (!value.IsEmpty() && value.IsNumber()) return wxAtoi(value);

    return default_value;
}
Beispiel #25
0
bool ViewChControl::UpdateControls( )
{
	if( this->m_is_virtual)
		this->m_main_sizer_text->SetLabel( wxString::Format( _T("VIRT %d"), this->m_ch_count));
	else
		this->m_main_sizer_text->SetLabel( wxString::Format( _T("%d"), this->m_ch_count));
	this->m_color_control->SetBackgroundColour( this->m_p_board_channel->m_line_color[ this->m_scope_index]);
	this->m_line_width_control->SetValue( this->m_p_board_channel->m_line_width[ this->m_scope_index]);

	this->m_ch_offset_control->SetValue( (int)(double)(this->m_p_board_channel->m_offset_y[ this->m_scope_index]* 10.0));
	if( this->m_p_board_channel->m_volt_2_div[ this->m_scope_index]== 0)
		this->m_p_board_channel->m_volt_2_div[ this->m_scope_index]= 0.01;
	wxString voltPerDiv= wxString::Format( _T("%d"), (int)(double)(1000.0/ this->m_p_board_channel->m_volt_2_div[ this->m_scope_index]) );
	// For previous version compatibility
	int idx= this->m_ch_volt_per_div_comboBox->FindString( voltPerDiv);
	if( idx>= 0) 
	{
		this->m_ch_volt_per_div_comboBox->Select( idx);
	}
	else
	{
		this->m_ch_volt_per_div_comboBox->Select(0);
		int value= wxAtoi( this->m_ch_volt_per_div_comboBox->GetLabelText( ) );
		this->UpdateVoltPerDiv( value);
	}
	this->UpdateLinePen();

	this->m_view_enable_control->SetValue( this->m_p_board_channel->m_scope_view_enabled[ this->m_scope_index]);
	this->m_view_enable_control->SetLabel( this->m_view_enable_control->GetValue( )? _("Disable"): _("Enable"));

	return true;
}
Beispiel #26
0
bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const
{
    wxString strIcon = wxAssocQueryString(wxASSOCSTR_DEFAULTICON, m_ext);

    if ( !strIcon.empty() )
    {
        wxString strFullPath = strIcon.BeforeLast(wxT(',')),
        strIndex = strIcon.AfterLast(wxT(','));

        // index may be omitted, in which case BeforeLast(',') is empty and
        // AfterLast(',') is the whole string
        if ( strFullPath.empty() ) {
            strFullPath = strIndex;
            strIndex = wxT("0");
        }

        // if the path contains spaces, it can be enclosed in quotes but we
        // must not pass a filename in that format to any file system function,
        // so remove them here.
        if ( strFullPath.StartsWith('"') && strFullPath.EndsWith('"') )
            strFullPath = strFullPath.substr(1, strFullPath.length() - 2);

        if ( iconLoc )
        {
            iconLoc->SetFileName(wxExpandEnvVars(strFullPath));

            iconLoc->SetIndex(wxAtoi(strIndex));
        }

      return true;
    }

    // no such file type or no value or incorrect icon entry
    return false;
}
void NetBuilderProperties_frame::OnCellClick( wxGridEvent& event )
{
  MainFrame *myparent=(MainFrame *) GetParent();
  int error=0;
  wxChar *endptr;
  char rest[100];
  if (event.GetRow()==3){
	pop_selected=event.GetCol();
	int total_fdomains_value= (int) wxStrtol(Properties_grid->GetCellValue(2,pop_selected),&endptr,10);
	strcpy(rest,wxString(endptr).mb_str());
	rest[100-1]='\0';
	if (total_fdomains_value > 0 && strcmp(rest,"")==0){
	  if (total_fdomains_value!=population[pop_selected].total_fdomains)
	    Initialize_Fdomains(pop_selected,total_fdomains_value);
	}
	else{
	  myparent->text_status->SetForegroundColour( wxColour( 247, 22, 10 ) );
	  wxLogMessage(wxT(">> WARNING: fdomains of population ") + int2wxStr(pop_selected) + wxT(" must be an integer greater than 0."));
	  myparent->text_status->SetForegroundColour( wxColour( 0, 0, 0 ) );
	  error=-1;
	}
	if (error==0) {
	  population[pop_selected].total_fdomains=wxAtoi(Properties_grid->GetCellValue(2,pop_selected));
	  this->Enable(false);
	  NetBuilderDynamics_frame *Dynamics_frame=new NetBuilderDynamics_frame(this);
	  Dynamics_frame->Show();
	}
  }
  event.Skip();
}
Beispiel #28
0
//generic routines that can replace the above and be completely implemented in the codeblocks
//gui based on the ID names of the two controls.  No need for "member" variables
void EffectPanelUtils::UpdateLinkedSlider(wxCommandEvent& event)
{
    wxTextCtrl * txt = (wxTextCtrl*)event.GetEventObject();
    wxSlider *slider = (wxSlider*)LINKED_CONTROLS[txt];
    if (slider == nullptr) {
        wxString name = txt->GetName();
        if (name.Contains("IDD_")) {
            name.Replace("IDD_TEXTCTRL_", "ID_SLIDER_");
        } else {
            name.Replace("ID_TEXTCTRL_", "IDD_SLIDER_");
        }
        slider = (wxSlider*)txt->GetParent()->FindWindowByName(name);
        if (slider == nullptr) {
            return;
        }
        LINKED_CONTROLS[txt] = slider;
    }
    int value = wxAtoi(txt->GetValue());

    if (value < slider->GetMin()) {
        value = slider->GetMin();
        wxString val_str;
        val_str << value;
        txt->ChangeValue(val_str);
    }
    else if (value > slider->GetMax()) {
        value = slider->GetMax();
        wxString val_str;
        val_str << value;
        txt->ChangeValue(val_str);
    }
    slider->SetValue(value);
}
Beispiel #29
0
bool wxHelpControllerHelpProvider::ShowHelp(wxWindowBase *window)
{
    wxString text = GetHelp(window);
    if ( !text.empty() )
    {
        if (m_helpController)
        {
            if (text.IsNumber())
                return m_helpController->DisplayContextPopup(wxAtoi(text));

            // If the help controller is capable of popping up the text...
            else if (m_helpController->DisplayTextPopup(text, wxGetMousePosition()))
            {
                return true;
            }
            else
            // ...else use the default method.
                return wxSimpleHelpProvider::ShowHelp(window);
        }
        else
            return wxSimpleHelpProvider::ShowHelp(window);

    }

    return false;
}
Beispiel #30
0
void CRichTextFrame::OnTabStops(wxCommandEvent& WXUNUSED(event))
{
  wxString tabsStr = wxGetTextFromUser
                       (
                          _("Please enter the tab stop positions in tenths of a millimetre, separated by spaces.\nLeave empty to reset tab stops."),
                          _("Tab Stops"),
                          wxEmptyString,
                          this
                       );

  wxArrayInt tabs;

  wxStringTokenizer tokens(tabsStr, _T(" "));
  while (tokens.HasMoreTokens())
  {
      wxString token = tokens.GetNextToken();
      tabs.Add(wxAtoi(token));
  }

  wxTextAttr attr;
  attr.SetTabs(tabs);

  long start, end;
  m_textCtrl->GetSelection(& start, & end);
  m_textCtrl->SetStyle(start, end, attr);

  m_currentPosition = -1;
}