Exemple #1
0
// Initialize custom grid with saved values
// Must be called AFTER Choice_DisplayAs & SpinCtrl_parm1 & SpinCtrl_parm2 have been set
void ModelDialog::SetCustomGridData(const wxString& customChannelData)
{
    wxString value;
    wxArrayString cols;

    if (!IsCustom()) return;

    HasCustomData = true;
    if (customChannelData.IsEmpty())
    {
        ResizeCustomGrid();
        return;
    }

    wxArrayString rows=wxSplit(customChannelData,';');
    for(size_t row=0; row < rows.size(); row++)
    {
        if (row >= GridCustom->GetNumberRows()) GridCustom->AppendRows();
        cols=wxSplit(rows[row],',');
        for(size_t col=0; col < cols.size(); col++)
        {
            if (col >= GridCustom->GetNumberCols()) GridCustom->AppendCols();
            value=cols[col];
            if (!value.IsEmpty() && value != "0")
            {
                GridCustom->SetCellValue(row,col,value);
            }
        }
    }
    SpinCtrl_parm1->SetValue(GridCustom->GetNumberCols());
    SpinCtrl_parm2->SetValue(GridCustom->GetNumberRows());
}
// 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;
}
Exemple #3
0
void ArraysTestCase::wxStringArraySplitTest()
{
    // test wxSplit:

    {
        wxString str = wxT(",,,,first,second,third,,");
        const wxChar *expected[] =
            { wxT(""), wxT(""), wxT(""), wxT(""), wxT("first"),
              wxT("second"), wxT("third"), wxT(""), wxT("") };

        wxArrayString exparr(WXSIZEOF(expected), expected);
        wxArrayString realarr(wxSplit(str, wxT(',')));
        CPPUNIT_ASSERT( exparr == realarr );
    }

    {
        wxString str = wxT(",\\,first,second,third,");
        const wxChar *expected[] =
            { wxT(""), wxT(",first"), wxT("second"), wxT("third"), wxT("") };
        const wxChar *expected2[] =
            { wxT(""), wxT("\\"), wxT("first"), wxT("second"), wxT("third"), wxT("") };

        // escaping on:
        wxArrayString exparr(WXSIZEOF(expected), expected);
        wxArrayString realarr(wxSplit(str, wxT(','), wxT('\\')));
        CPPUNIT_ASSERT( exparr == realarr );

        // escaping turned off:
        wxArrayString exparr2(WXSIZEOF(expected2), expected2);
        wxArrayString realarr2(wxSplit(str, wxT(','), wxT('\0')));
        CPPUNIT_ASSERT( exparr2 == realarr2 );
    }

    {
        // test is escape characters placed before non-separator character are
        // just ignored as they should:
        wxString str = wxT(",\\,,fir\\st,se\\cond\\,,\\third");
        const wxChar *expected[] =
            { wxT(""), wxT(","), wxT("fir\\st"), wxT("se\\cond,"), wxT("\\third") };
        const wxChar *expected2[] =
            { wxT(""), wxT("\\"), wxT(""), wxT("fir\\st"), wxT("se\\cond\\"),
              wxT(""), wxT("\\third") };

        // escaping on:
        wxArrayString exparr(WXSIZEOF(expected), expected);
        wxArrayString realarr(wxSplit(str, wxT(','), wxT('\\')));
        CPPUNIT_ASSERT( exparr == realarr );

        // escaping turned off:
        wxArrayString exparr2(WXSIZEOF(expected2), expected2);
        wxArrayString realarr2(wxSplit(str, wxT(','), wxT('\0')));
        CPPUNIT_ASSERT( exparr2 == realarr2 );
    }
}
Exemple #4
0
void ArraysTestCase::wxStringArraySplitJoinTest()
{
    wxChar separators[] = { wxT('a'), wxT(','), wxT('_'), wxT(' '), wxT('\\'),
                            wxT('&'), wxT('{'), wxT('A'), wxT('<'), wxT('>'),
                            wxT('\''), wxT('\n'), wxT('!'), wxT('-') };

    // test with a string: split it and then rejoin it:

    wxString str = wxT("This is a long, long test; if wxSplit and wxJoin do work ")
                   wxT("correctly, then splitting and joining this 'text' _multiple_ ")
                   wxT("times shouldn't cause any loss of content.\n")
                   wxT("This is some latex code: ")
                   wxT("\\func{wxString}{wxJoin}{")
                   wxT("\\param{const wxArray String\\&}{ arr}, ")
                   wxT("\\param{const wxChar}{ sep}, ")
                   wxT("\\param{const wxChar}{ escape = '\\'}}.\n")
                   wxT("This is some HTML code: ")
                   wxT("<html><head><meta http-equiv=\"content-type\">")
                   wxT("<title>Initial page of Mozilla Firefox</title>")
                   wxT("</meta></head></html>");

    size_t i;
    for (i = 0; i < WXSIZEOF(separators); i++)
    {
        wxArrayString arr = wxSplit(str, separators[i]);
        CPPUNIT_ASSERT( str == wxJoin(arr, separators[i]) );
    }


    // test with an array: join it and then resplit it:

    const wxChar *arr[] =
        {
            wxT("first, second!"), wxT("this is the third!!"),
            wxT("\nThat's the fourth token\n\n"), wxT(" - fifth\ndummy\ntoken - "),
            wxT("_sixth__token__with_underscores"), wxT("The! Last! One!")
        };
    wxArrayString theArr(WXSIZEOF(arr), arr);

    for (i = 0; i < WXSIZEOF(separators); i++)
    {
        wxString string = wxJoin(theArr, separators[i]);
        CPPUNIT_ASSERT( theArr == wxSplit(string, separators[i]) );
    }

    wxArrayString emptyArray;
    wxString string = wxJoin(emptyArray, wxT(';'));
    CPPUNIT_ASSERT( string.empty() );

    CPPUNIT_ASSERT( wxSplit(string, wxT(';')).empty() );

    CPPUNIT_ASSERT_EQUAL( 2, wxSplit(wxT(";"), wxT(';')).size() );
}
Exemple #5
0
wxString xlGridCanvasPictures::GetImageFilename()
{
    wxString settings = mEffect->GetSettingsAsString();
    wxArrayString all_settings = wxSplit(settings, ',');
    for( int s = 0; s < all_settings.size(); s++ )
    {
        wxArrayString parts = wxSplit(all_settings[s], '=');
        if( parts[0] == "E_FILEPICKER_Pictures_Filename" ) {
            return parts[1];
        }

    }
    return wxEmptyString;
}
Exemple #6
0
void SequenceElements::DeleteTimingFromView(const std::string &name, int view)
{
    std::string viewName = GetViewName(view);
    Element* elem = GetElement(name);
    if( elem != nullptr && elem->GetType() == "timing" )
    {
        std::string views = elem->GetViews();
        wxArrayString all_views = wxSplit(views,',');
        int found = -1;
        for( int j = 0; j < all_views.size(); j++ )
        {
            if( all_views[j] == viewName )
            {
                found = j;
                break;
            }
        }
        if( found != -1 )
        {
            all_views.erase(all_views.begin() + found);
            views = wxJoin(all_views, ',');
            elem->SetViews(views);
        }
    }
}
Exemple #7
0
//read config options if heartbeat config file is present:
static void get_cfg()
{
    cfg.logpath.clear();
    cfg.maxents=0;
    cfg.interval=50;
    wxFileName cfgFile = wxFileName::FileName(wxStandardPaths::Get().GetExecutablePath());
    cfgFile.SetFullName("heartbeat.cfg");
    if (!wxFile::Exists(cfgFile.GetFullPath())) {
        return;
    }
    wxFile f(cfgFile.GetFullPath());
    if (!f.IsOpened()) {
        return;
    }
    wxString AllLines;
    f.ReadAll(&AllLines);
    f.Close();
    wxArrayString arrLines=wxSplit(AllLines,'\n');
    for (int i=0; i<arrLines.Count(); i++)
    {
        if (arrLines[i].StartsWith("Path=")) cfg.logpath = arrLines[i].Mid(5).Trim();
        if (arrLines[i].StartsWith("Maxents=")) arrLines[i].Mid(8).ToLong(&cfg.maxents);
        if (arrLines[i].StartsWith("Interval=")) arrLines[i].Mid(9).ToLong(&cfg.interval);
    }

    state.numents = 0;
    state.fifo.empty();
    state.latest=wxDateTime::Today();
}
Exemple #8
0
void ProjectSettings::GetSettings(cxProjectInfo& project) const {
	project.ClearFilters();

	if (!m_inheritCheck->GetValue()) {
		const wxArrayString ind = wxSplit(m_includeDirs->GetValue(), wxT('\n'), wxT('\0'));
		const wxArrayString exd = wxSplit(m_excludeDirs->GetValue(), wxT('\n'), wxT('\0'));
		const wxArrayString inf = wxSplit(m_includeFiles->GetValue(), wxT('\n'), wxT('\0'));
		const wxArrayString exf = wxSplit(m_excludeFiles->GetValue(), wxT('\n'), wxT('\0'));
		project.SetFilters(ind, exd, inf, exf);
	}

	if (m_projectInfo.IsRoot()) {
		project.env.clear();
		m_envPage->GetVars(project.env);
	}
}
Exemple #9
0
void SequenceElements::SetTimingVisibility(const std::string& name)
{
    for(int i=0;i<mAllViews[MASTER_VIEW].size();i++)
    {
        Element* elem = mAllViews[MASTER_VIEW][i];
        if( elem->GetType() == "model" )
        {
            break;
        }
        if( name == "Master View" )
        {
            elem->SetVisible(true);
        }
        else
        {
            elem->SetVisible(false);
            wxArrayString views = wxSplit(elem->GetViews(),',');
            for(int v=0;v<views.size();v++)
            {
                std::string viewName = views[v].ToStdString();
                if( name == viewName )
                {
                    elem->SetVisible(true);
                    break;
                }
            }
        }
    }
}
Exemple #10
0
/* MapTextureBrowser::determineTexturePath
 * Builds and returns the tree item path for [info]
 *******************************************************************/
string MapTextureBrowser::determineTexturePath(Archive* archive, uint8_t category, string type, string path)
{
	wxArrayString tree_spec = wxSplit(map_tex_treespec, ',');
	string ret;
	for (unsigned b = 0; b < tree_spec.size(); b++)
	{
		if (tree_spec[b] == "archive")
			ret += archive->getFilename(false);
		else if (tree_spec[b] == "type")
			ret += type;
		else if (tree_spec[b] == "category")
		{
			switch (category)
			{
			case MapTextureManager::TC_TEXTUREX:
				ret += "TEXTUREx"; break;
			case MapTextureManager::TC_TEXTURES:
				ret += "TEXTURES"; break;
			case MapTextureManager::TC_HIRES:
				ret += "HIRESTEX"; break;
			case MapTextureManager::TC_TX:
				ret += "Single (TX)"; break;
			default:
				continue;
			}
		}

		ret += "/";
	}

	return ret + path;
}
static Optional<Size> deserialize_size(const utf8_string& str){
  wxString wxStr(to_wx(str));
  wxArrayString strs = wxSplit(to_wx(str), ',', '\0');
  if (strs.GetCount() != 2){
    return {};
  }

  long width;
  if (!strs[0].ToLong(&width)){
    return {};
  }
  if (width <= 0){
    return {};
  }

  long height;
  if (!strs[1].ToLong(&height)){
    return {};
  }
  if (height <= 0){
    return {};
  }

  return {Size(static_cast<coord>(width), static_cast<coord>(height))};
}
Exemple #12
0
wxArrayString
wxGridCellAutoWrapStringRenderer::GetTextLines(wxGrid& grid,
                                               wxDC& dc,
                                               const wxGridCellAttr& attr,
                                               const wxRect& rect,
                                               int row, int col)
{
    dc.SetFont(attr.GetFont());
    const wxCoord maxWidth = rect.GetWidth();

    // Transform logical lines into physical ones, wrapping the longer ones.
    const wxArrayString
        logicalLines = wxSplit(grid.GetCellValue(row, col), '\n', '\0');

    wxArrayString physicalLines;
    for ( wxArrayString::const_iterator it = logicalLines.begin();
          it != logicalLines.end();
          ++it )
    {
        const wxString& line = *it;

        if ( dc.GetTextExtent(line).x > maxWidth )
        {
            // Line does not fit, break it up.
            BreakLine(dc, line, maxWidth, physicalLines);
        }
        else // The entire line fits as is
        {
            physicalLines.push_back(line);
        }
    }

    return physicalLines;
}
/* AudioPrefsPanel::onBtnBrowseSoundfont
 * Called when the browse for soundfont button is clicked
 *******************************************************************/
void AudioPrefsPanel::onBtnBrowseSoundfont(wxCommandEvent& e)
{
#ifdef WIN32
	char separator = ';';
#else
	char separator = ':';
#endif

	string dir = dir_last_soundfont;
	if (dir_last_soundfont.value.empty() && fs_soundfont_path.value.size())
	{
		wxArrayString paths = wxSplit(fs_soundfont_path, separator);
		dir = wxFileName(paths[0]).GetPath();
	}

	// Open file dialog
	wxFileDialog fd(this, "Browse for MIDI Soundfont", dir, "", "Soundfont files (*.sf2)|*.sf2", wxFD_MULTIPLE);
	if (fd.ShowModal() == wxID_OK)
	{
		wxArrayString paths;
		string fullpath = "";
		fd.GetPaths(paths);
		for (size_t a = 0; a < paths.size(); ++a)
			fullpath += paths[a] + separator;
		if (paths.size())
			fullpath.RemoveLast(1);
		text_soundfont_path->SetValue(fullpath);
		dir_last_soundfont = fd.GetDirectory();
	}
}
Exemple #14
0
wxXmlNode* xLightsFrame::CreateModelNodeFromGroup(const std::string &name) {
    wxXmlNode* element;
    std::vector<Model*> models;
    std::string modelString;
    for(wxXmlNode* e=ModelGroupsNode->GetChildren(); e!=NULL; e=e->GetNext() ) {
        if (e->GetName() == "modelGroup") {
            if (name == e->GetAttribute("name")) {
                element = e;
                modelString = e->GetAttribute("models");
                wxArrayString modelNames = wxSplit(modelString, ',');
                for (int x = 0; x < modelNames.size(); x++) {
                    Model *c = GetModel(modelNames[x].ToStdString());
                    if (c != nullptr) {
                        models.push_back(c);
                    }
                }
            }
        }
    }
    if (models.size() == 0) {
        return NULL;
    }
    wxXmlNode * ret = BuildWholeHouseModel(name, element, models);
    ret->AddAttribute("models", modelString);
    return ret;
}
Exemple #15
0
void PreviewModels::UpdateSelectedModel()
{
    wxString groupModels;
    wxXmlNode* e;
    e=(wxXmlNode*)(ListBoxModelGroups->GetClientData(ListBoxModelGroups->GetSelection()));
    groupModels = e->GetAttribute("models");
    ListBoxModelsInGroup->Clear();
    wxArrayString ModelsInGroup=wxSplit(groupModels,',');
    for(int i=0;i<ModelsInGroup.size();i++)
    {
        ListBoxModelsInGroup->Append(ModelsInGroup[i]);
    }
    TextModelGroupName->SetValue(ListBoxModelGroups->GetString(ListBoxModelGroups->GetSelection()));
    PopulateUnusedModels(ModelsInGroup);

    wxString v = e->GetAttribute("layout", "grid");
    if (v == "grid") {
        ChoiceModelLayoutType->SetSelection(0);
    }else if (v == "minimalGrid") {
        ChoiceModelLayoutType->SetSelection(1);
    } else if (v == "horizontal") {
        ChoiceModelLayoutType->SetSelection(2);
    } else if (v == "vertical") {
        ChoiceModelLayoutType->SetSelection(3);
    }

    wxCommandEvent evt;
    OnChoiceModelLayoutTypeSelect(evt);

    SizeSpinCtrl->SetValue(wxAtoi(e->GetAttribute("GridSize", "400")));
}
Exemple #16
0
/* TextEditor::onJumpToCalculateComplete
 * Called when the 'Jump To' calculation thread completes
 *******************************************************************/
void TextEditor::onJumpToCalculateComplete(wxThreadEvent& e)
{
	if (!choice_jump_to)
	{
		jump_to_calculator = nullptr;
		return;
	}

	choice_jump_to->Clear();
	jump_to_lines.clear();

	string jump_points = e.GetString();
	wxArrayString split = wxSplit(jump_points, ',');

	wxArrayString items;
	for (unsigned a = 0; a < split.size(); a += 2)
	{
		if (a == split.size() - 1)
			break;

		long line;
		if (!split[a].ToLong(&line))
			line = 0;
		string name = split[a + 1];

		items.push_back(name);
		jump_to_lines.push_back(line);
	}

	choice_jump_to->Append(items);
	choice_jump_to->Enable(true);

	jump_to_calculator = nullptr;
}
Exemple #17
0
bool 
Project::AddFolderByName(wxString folder_name, FolderType type) {
	wxArrayString folders = wxSplit(folder_name, wxFILE_SEP_PATH);
	std::vector<Folder>* folder_vec = this->folders.GetFolders();
	wxString folder_path = wxT("");
	Folder folder(QGF_FOLDER_TYPE_SCRIPT, wxT(""), wxT(""));
	if (folders.Count() == 1) {
		folder_vec->push_back(Folder(type, folders.Last(), folders.Last()));
		return true;
	}
	for (wxArrayString::iterator it = folders.begin() ; it != folders.end(); ++it) {
		wxString new_full_path = (folder_path == wxT("")) ? *it : folder_path + wxFILE_SEP_PATH + *it;
		folder = Folder(QGF_FOLDER_TYPE_OTHER, *it, new_full_path);
		std::vector<Folder>::iterator pos = std::find(folder_vec->begin(), folder_vec->end(), folder);
		if (pos == folder_vec->end()) return false;
		wxString full_path = pos->GetFullPath() + wxFILE_SEP_PATH + folders.Last();
		if (full_path == folder_name) {
			pos->GetSubFolders()->push_back(Folder(type, folders.Last(), full_path));
			return true;
		}

		folder_vec = pos->GetSubFolders();
		folder_path = new_full_path;
	}
	return false;
}
Exemple #18
0
void OptionsConfig::SetBookmarkLabel(const wxString& label, size_t index)
{
    wxArrayString arr = wxSplit(m_bookmarkLabels, ';');
    if(index < arr.GetCount()) {
        arr.Item(index) = label;
        m_bookmarkLabels = wxJoin(arr, ';');
    }
}
Exemple #19
0
void ModelClass::InitCustomMatrix(const wxString& customModel)
{
    wxString value;
    wxArrayString cols;
    long idx;
    int width=1;
    std::vector<int> nodemap;

    wxArrayString rows=wxSplit(customModel,';');
    int height=rows.size();
    int cpn = ChannelsPerNode();
    for(size_t row=0; row < rows.size(); row++)
    {
        cols=wxSplit(rows[row],',');
        if (cols.size() > width) width=cols.size();
        for(size_t col=0; col < cols.size(); col++)
        {
            value=cols[col];
            if (!value.IsEmpty() && value != "0")
            {
                value.ToLong(&idx);

                // increase nodemap size if necessary
                if (idx > nodemap.size()) {
                    nodemap.resize(idx, -1);
                }
                idx--;  // adjust to 0-based

                // is node already defined in map?
                if (nodemap[idx] < 0) {
                    // unmapped - so add a node
                    nodemap[idx]=Nodes.size();
                    SetNodeCount(1,0);  // this creates a node of the correct class
                    Nodes.back()->StringNum= SingleNode ? idx : 0;
                    Nodes.back()->ActChan=stringStartChan[0] + idx * cpn;
                    Nodes.back()->AddBufCoord(col,height - row - 1);
                } else {
                    // mapped - so add a coord to existing node
                    Nodes[nodemap[idx]]->AddBufCoord(col,height - row - 1);
                }

            }
        }
    }
    SetBufferSize(height,width);
}
Exemple #20
0
void OptionsConfig::SetBookmarkBgColour(wxColour c, size_t index)
{
    wxArrayString arr = wxSplit(m_bookmarkBgColours, ';');
    if(index < arr.GetCount()) {
        arr.Item(index) = c.GetAsString(wxC2S_HTML_SYNTAX);
        m_bookmarkBgColours = wxJoin(arr, ';');
    }
}
Exemple #21
0
// -----------------------------------------------------------------------------
// Initialises panel controls
// -----------------------------------------------------------------------------
void ACSPrefsPanel::init()
{
	flp_acc_path_->setLocation(wxString(path_acc));
	cb_always_show_output_->SetValue(acc_always_show_output);

	// Populate include paths list
	list_inc_paths_->Set(wxSplit(path_acc_libs, ';'));
}
Exemple #22
0
void wxBannerWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    if ( m_bitmap.IsOk() && m_title.empty() && m_message.empty() )
    {
        // No need for buffering in this case.
        wxPaintDC dc(this);

        DrawBitmapBackground(dc);
    }
    else // We need to compose our contents ourselves.
    {
        wxAutoBufferedPaintDC dc(this);

        // Deal with the background first.
        if ( m_bitmap.IsOk() )
        {
            DrawBitmapBackground(dc);
        }
        else // Draw gradient background.
        {
            wxDirection gradientDir;
            if ( m_direction == wxLEFT )
            {
                gradientDir = wxTOP;
            }
            else if ( m_direction == wxRIGHT )
            {
                gradientDir = wxBOTTOM;
            }
            else // For both wxTOP and wxBOTTOM.
            {
                gradientDir = wxRIGHT;
            }

            dc.GradientFillLinear(GetClientRect(), m_colStart, m_colEnd,
                                  gradientDir);
        }

        // Now draw the text on top of it.
        dc.SetFont(GetTitleFont());

        wxPoint pos(MARGIN_X, MARGIN_Y);
        DrawBannerTextLine(dc, m_title, pos);
        pos.y += dc.GetTextExtent(m_title).y;

        dc.SetFont(GetFont());

        wxArrayString lines = wxSplit(m_message, '\n', '\0');
        const unsigned numLines = lines.size();
        for ( unsigned n = 0; n < numLines; n++ )
        {
            const wxString& line = lines[n];

            DrawBannerTextLine(dc, line, pos);
            pos.y += dc.GetTextExtent(line).y;
        }
    }
}
Exemple #23
0
void wxGCDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
                               double angle)
{
    wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") );

    if ( text.empty() )
        return;
    if ( !m_logicalFunctionSupported )
        return;

    // we test that we have some font because otherwise we should still use the
    // "else" part below to avoid that DrawRotatedText(angle = 180) and
    // DrawRotatedText(angle = 0) use different fonts (we can't use the default
    // font for drawing rotated fonts unfortunately)
    if ( (angle == 0.0) && m_font.IsOk() )
    {
        DoDrawText(text, x, y);
        
        // Bounding box already updated by DoDrawText(), no need to do it again.
        return;
    }
            
    // Get extent of whole text.
    wxCoord w, h, heightLine;
    GetOwner()->GetMultiLineTextExtent(text, &w, &h, &heightLine);
    
    // Compute the shift for the origin of the next line.
    const double rad = wxDegToRad(angle);
    const double dx = heightLine * sin(rad);
    const double dy = heightLine * cos(rad);
    
    // Draw all text line by line
    const wxArrayString lines = wxSplit(text, '\n', '\0');
    for ( size_t lineNum = 0; lineNum < lines.size(); lineNum++ )
    {
        // Calculate origin for each line to avoid accumulation of
        // rounding errors.
        if ( m_backgroundMode == wxTRANSPARENT )
            m_graphicContext->DrawText( lines[lineNum], x + wxRound(lineNum*dx), y + wxRound(lineNum*dy), wxDegToRad(angle ));
        else
            m_graphicContext->DrawText( lines[lineNum], x + wxRound(lineNum*dx), y + wxRound(lineNum*dy), wxDegToRad(angle ), m_graphicContext->CreateBrush(m_textBackgroundColour) );
   }
            
    // call the bounding box by adding all four vertices of the rectangle
    // containing the text to it (simpler and probably not slower than
    // determining which of them is really topmost/leftmost/...)
    
    // "upper left" and "upper right"
    CalcBoundingBox(x, y);
    CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad)));
    
    // "bottom left" and "bottom right"
    x += (wxCoord)(h*sin(rad));
    y += (wxCoord)(h*cos(rad));
    CalcBoundingBox(x, y);
    CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad)));
}
Exemple #24
0
wxString OptionsConfig::GetBookmarkLabel(size_t index) const
{
    wxArrayString arr = wxSplit(m_bookmarkLabels, ';');
    if(index < arr.GetCount()) {
        return arr.Item(index);
    }

    return "";
}
/* PaletteEntryPanel::PaletteEntryPanel
 * PaletteEntryPanel class constructor
 *******************************************************************/
PaletteEntryPanel::PaletteEntryPanel(wxWindow* parent)
	: EntryPanel(parent, "palette")
{
	// Add palette canvas
	pal_canvas = new PaletteCanvas(this, -1);
	pal_canvas->allowSelection(1);
	sizer_main->Add(pal_canvas->toPanel(this), 1, wxEXPAND, 0);

	// Setup custom menu
	menu_custom = new wxMenu();
	fillCustomMenu(menu_custom);
	custom_menu_name = "Palette";

	// --- Setup custom toolbar groups ---

	// Palette
	SToolBarGroup* group_palette = new SToolBarGroup(toolbar, "Palette", true);
	group_palette->addActionButton("pal_prev", "Previous Palette", "left", "");
	text_curpal = new wxStaticText(group_palette, -1, "XX/XX");
	group_palette->addCustomControl(text_curpal);
	group_palette->addActionButton("pal_next", "Next Palette", "right", "");
	toolbar->addGroup(group_palette);

	// Current Palette
	string actions = "ppal_moveup;ppal_movedown;ppal_duplicate;ppal_remove;ppal_removeothers";
	toolbar->addActionGroup("Palette Organisation", wxSplit(actions, ';'));

	// Colour Operations
	actions = "ppal_colourise;ppal_tint;ppal_invert;ppal_tweak";
	toolbar->addActionGroup("Colours", wxSplit(actions, ';'));

	// Palette Operations
	actions = "ppal_addcustom;ppal_exportas;ppal_importfrom;ppal_test;ppal_generate";
	toolbar->addActionGroup("Palette Operations", wxSplit(actions, ';'));

	// Bind events
	pal_canvas->Bind(wxEVT_LEFT_DOWN, &PaletteEntryPanel::onPalCanvasMouseEvent, this);
	pal_canvas->Bind(wxEVT_RIGHT_DOWN, &PaletteEntryPanel::onPalCanvasMouseEvent, this);

	// Init variables
	cur_palette = 0;

	Layout();
}
Exemple #26
0
void GraphicsContextDrawingTestCase::RunPluginsDrawingCase (
    const DrawingTestCase & testCase)
{
    if (!m_drawingPluginsLoaded)
    {
        m_drawingPluginsLoaded = true;

        wxString pluginsListStr;
        if (!wxGetEnv ("WX_TEST_SUITE_GC_DRAWING_PLUGINS", &pluginsListStr))
            return; // no plugins

        wxArrayString pluginsNameArray = wxSplit (pluginsListStr, ',', '\0');
        m_drawingPlugins.resize (pluginsNameArray.size());

        for (size_t idx=0; idx<pluginsNameArray.size(); ++idx)
        {
            PluginInfo &pluginBeingLoaded = m_drawingPlugins[idx];
            pluginBeingLoaded.library = new wxDynamicLibrary;
            if (!pluginBeingLoaded.library->Load (pluginsNameArray[idx]))
            {
                wxLogFatalError("could not load drawing plugin %s",
                    pluginsNameArray[idx]);
                return;
            }

            wxDYNLIB_FUNCTION(CreateDrawingTestLifeCycleFunction,
                CreateDrawingTestLifeCycle, *pluginBeingLoaded.library);
            wxDYNLIB_FUNCTION(DestroyDrawingTestLifeCycleFunction,
                DestroyDrawingTestLifeCycle, *pluginBeingLoaded.library);

            if (!pfnCreateDrawingTestLifeCycle ||
                !pfnDestroyDrawingTestLifeCycle)
            {
                wxLogFatalError("could not find function"
                    " CreateDrawingTestLifeCycle or "
                    "DestroyDrawingTestLifeCycle in %s", pluginsNameArray[idx]);
                return;
            }

            pluginBeingLoaded.destroy = pfnDestroyDrawingTestLifeCycle;
            pluginBeingLoaded.gcFactory = (*pfnCreateDrawingTestLifeCycle)();
            if (!pluginBeingLoaded.gcFactory)
            {
                wxLogFatalError("failed to create life-cycle object in %s",
                    pluginsNameArray[idx]);
                return;
            }
        }
    }

    // now execute the test case for each plugin
    for (size_t idxp=0; idxp<m_drawingPlugins.size(); ++idxp)
    {
        RunIndividualDrawingCase (*m_drawingPlugins[idxp].gcFactory, testCase);
    }
}
Exemple #27
0
void xlGridCanvasPictures::UpdateRenderedImage()
{
    wxString settings = mEffect->GetSettingsAsString();
    wxArrayString all_settings = wxSplit(settings, ',');
    for( int s = 0; s < all_settings.size(); s++ )
    {
        wxArrayString parts = wxSplit(all_settings[s], '=');
        if( parts[0] == "E_FILEPICKER_Pictures_Filename" ) {
            parts[1] = PictureName;
        }
        all_settings[s] = wxJoin(parts, '=');
    }
    settings = wxJoin(all_settings, ',');
    mEffect->SetSettings(settings.ToStdString(), false);

    wxCommandEvent eventEffectChanged(EVT_EFFECT_CHANGED);
    eventEffectChanged.SetClientData(mEffect);
    wxPostEvent(mMessageParent, eventEffectChanged);
}
Exemple #28
0
wxColour OptionsConfig::GetBookmarkBgColour(size_t index) const
{
    wxColour col;
    wxArrayString arr = wxSplit(m_bookmarkBgColours, ';');
    if(index < arr.GetCount()) {
        return wxColour(arr.Item(index));
    }

    return col;
}
Exemple #29
0
/* EntryPanel::addCustonToolBar
 * Adds this EntryPanel's custom toolbar group to the main window
 * toolbar
 *******************************************************************/
void EntryPanel::addCustomToolBar() {
	// Check any custom actions exist
	if (custom_toolbar_actions.IsEmpty())
		return;

	// Split list of toolbar actions
	wxArrayString actions = wxSplit(custom_toolbar_actions, ';');

	// Add to main window
	theMainWindow->addCustomToolBar("Current Entry", actions);
}
Exemple #30
0
bool SequenceElements::TimingIsPartOfView(Element* timing, int view)
{
    std::string view_name = GetViewName(view);
    wxArrayString views = wxSplit(timing->GetViews(),',');
    for(int v=0;v<views.size();v++)
    {
        if( views[v] == view_name )
        {
            return true;
        }
    }
    return false;
}