void OnButton(wxCommandEvent &event){ wxTextAttr textattr; int i = textctrl->GetInsertionPoint(); textctrl->GetStyle(i, textattr); wxFont font = textattr.GetFont(); int id = event.GetId(); long flags = 0; if(id == ID_FONT){ font = wxGetFontFromUser(this, font); flags = wxTEXT_ATTR_FONT_FACE; }else if(id == ID_SIZE){ font.SetPointSize(wxGetNumberFromUser(_T("Size:"), _T(""), _T("Set Font Size"), font.GetPointSize())); flags = wxTEXT_ATTR_FONT_SIZE; }else if(id == ID_BOLD){ font.SetWeight(font.GetWeight() != wxFONTWEIGHT_BOLD? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL); flags = wxTEXT_ATTR_FONT_WEIGHT; }else if(id == ID_ITAL){ font.SetStyle(font.GetStyle() != wxFONTSTYLE_ITALIC? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL); flags = wxTEXT_ATTR_FONT_ITALIC; }else if(id == ID_UNDR){ font.SetUnderlined(!font.GetUnderlined()); flags = wxTEXT_ATTR_FONT_UNDERLINE; }else if(id == ID_COLR){ textattr.SetTextColour(wxGetColourFromUser(this, textattr.GetTextColour())); flags = wxTEXT_ATTR_TEXT_COLOUR; }else if(id == ID_BCLR){ textattr.SetBackgroundColour(wxGetColourFromUser(this, textattr.GetBackgroundColour())); flags = wxTEXT_ATTR_BACKGROUND_COLOUR; }else if(id == ID_RTLT){ //textctrl->SetSelection(0, textctrl->GetLastPosition()); textctrl->SetRTL(!textctrl->GetRTL()); textctrl->SetFocus(); return; } long start, end; textctrl->GetSelection(&start, &end); //printf("TextAttr flags: %x\n", textattr.GetFlags()); textattr.SetFont(font); textattr.SetFlags(flags); //printf("TextAttr flags: %x\n", textattr.GetFlags()); textctrl->SetStyle(start, end, textattr); textctrl->SetFocus(); }
/* ColourBox::onMouseLeftDown * Called when the colour box is left clicked. Pops up either a * colour selection dialog, or a palette dialog if a palette has been * given to the colour box *******************************************************************/ void ColourBox::onMouseLeftDown(wxMouseEvent& e) { if (!palette) { wxColour col = wxGetColourFromUser(GetParent(), wxColour(colour.r, colour.g, colour.b)); if (col.Ok()) { colour.r = col.Red(); colour.g = col.Green(); colour.b = col.Blue(); sendChangeEvent(); Refresh(); } } else { PaletteDialog pd(palette); if (pd.ShowModal() == wxID_OK) { rgba_t col = pd.getSelectedColour(); if (col.a > 0) { colour = col; sendChangeEvent(); Refresh(); } } } }
void Window::OnColorSet(wxCommandEvent& evt) { switch (evt.GetId()) { case 10: canvas->setColor(*wxWHITE); break; case 11: canvas->setColor(wxColour(wxT("#C0C0C0"))); break; case 12: canvas->setColor(wxColour(wxT("#808080"))); break; case 13: canvas->setColor(*wxBLACK); break; case 14: canvas->setColor(*wxRED); break; case 15: canvas->setColor(wxColour(wxT("yellow"))); break; case 16: canvas->setColor(*wxGREEN); break; case 17: canvas->setColor(*wxBLUE); break; case 18: canvas->setColor(wxGetColourFromUser(this, canvas->getColor())); break; } }
bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle, wxColourData* aPredefinedColors ) { wxColour newcolor, oldcolor; oldcolor.Set( KiROUND( aColor.r * 255 ), KiROUND( aColor.g * 255 ), KiROUND( aColor.b * 255 ) ); wxColourData emptyColorSet; // Provides a empty predefined set of colors // if no color set available to avoid use of an // old color set if( aPredefinedColors == NULL ) aPredefinedColors = &emptyColorSet; newcolor = wxGetColourFromUser( this, oldcolor, aTitle, aPredefinedColors ); if( !newcolor.IsOk() ) // Cancel command return false; if( newcolor != oldcolor ) { aColor.r = (double) newcolor.Red() / 255.0; aColor.g = (double) newcolor.Green() / 255.0; aColor.b = (double) newcolor.Blue() / 255.0; } return true; }
VALUE _getUserColor(int argc,VALUE *argv,VALUE self) { VALUE parent,caption; rb_scan_args(argc, argv, "11",&parent,&caption); wxColor col = wxGetColourFromUser(wrap<wxWindow*>(parent),*wxBLACK,wrap<wxString>(caption)); return col.IsOk() ? wrap(col) : Qnil; }
void FindSequenceDialog::OnSetHighlightColor ( wxCommandEvent &ev ) { wxColour col = highlight ; col = wxGetColourFromUser ( this , col ) ; if ( !col.Ok() ) return ; highlight = col ; highlight_display->SetBackgroundColour ( highlight ) ; }
void DrawerObjectEditor::OnfillColorBtClick(wxCommandEvent& event) { wxColour color = wxGetColourFromUser(this, fillColorBt->GetBackgroundColour()); if ( color.IsOk() ) { fillColorBt->SetBackgroundColour(color); } }
void ShapePainterObjectEditor::OnoutlineColorBtClick(wxCommandEvent& event) { wxColour color = wxGetColourFromUser(this, outlineColorBt->GetBackgroundColour()); if ( color.IsOk() ) { outlineColorBt->SetBackgroundColour(color); } }
void MyFrame::OnSetBgColor(wxCommandEvent& WXUNUSED(event)) { wxColour clr = wxGetColourFromUser(this, m_animationCtrl->GetBackgroundColour(), wxT("Choose the background colour")); if (clr.IsOk()) m_animationCtrl->SetBackgroundColour(clr); }
void GridFrame::SetCellFgColour( wxCommandEvent& WXUNUSED(ev) ) { wxColour col = wxGetColourFromUser(this); if ( col.Ok() ) { grid->SetDefaultCellTextColour(col); grid->Refresh(); } }
void PCS_Preferences::on_color(wxCommandEvent &event){ wxColour col = wxGetColourFromUser(this, ((wxButton*)(event.GetEventObject()))->GetBackgroundColour(), ((wxButton*)(event.GetEventObject()))->GetLabel()); if(!col.IsOk())return; ((wxButton*)(event.GetEventObject()))->SetBackgroundColour(col), ((wxButton*)(event.GetEventObject()))->SetForegroundColour(wxColour((col.Red()+128)%255,(col.Green()+128)%255,(col.Blue()+128)%255)); }
void ChildView::ChangeBackgroundColor() { wxColour colour = wxGetColourFromUser(0); if(colour.IsOk()) { canvas1->ChangeBackGroundColour(colour); canvas2->ChangeBackGroundColour(colour); canvas3->ChangeBackGroundColour(colour); } }
void MyFrame::OnSetBackgroundColour(wxCommandEvent& WXUNUSED(event)) { wxDataViewCtrl * const dvc = m_ctrl[m_notebook->GetSelection()]; wxColour col = wxGetColourFromUser(this, dvc->GetBackgroundColour()); if ( col.IsOk() ) { dvc->SetBackgroundColour(col); Refresh(); } }
void TextObjectEditor::OncolorBtClick(wxCommandEvent& event) { wxColour color = wxGetColourFromUser(this, colorBt->GetBackgroundColour()); if ( color.IsOk() ) colorBt->SetBackgroundColour(color); AdaptFontColor(colorBt); return; }
void Config::OnChangeColor() { style* tmp = GetStylePointer(); wxColour col = wxGetColourFromUser(this, tmp->color); if (col.IsOk()) { tmp->color = col.GetAsString(wxC2S_CSS_SYNTAX); UpdateExample(); m_styleColor->SetBackgroundColour(tmp->color); } }
void TAdjuster::OnClick(wxCommandEvent& event) { if (pickers.find(event.GetId()) != pickers.end()) { TUniform* uniform = pickers[event.GetId()]; wxColour color = uniform->GetColor(); color = wxGetColourFromUser(this, color); uniform->SetColor(color); FindWindowById(event.GetId())->SetBackgroundColour(color); } event.Skip(); }
void MyFrame::OnSetSelBgCol(wxCommandEvent& WXUNUSED(event)) { wxColour col = wxGetColourFromUser(this, m_hlbox->GetSelectionBackground()); if ( col.IsOk() ) { m_hlbox->SetSelectionBackground(col); m_hlbox->Refresh(); #if wxUSE_STATUSBAR SetStatusText(wxT("Selection background colour changed.")); #endif // wxUSE_STATUSBAR } }
void GridFrame::SetCellBgColour( wxCommandEvent& WXUNUSED(ev) ) { wxColour col = wxGetColourFromUser(this); if ( col.Ok() ) { // Check the new Refresh function by passing it a rectangle // which exactly fits the grid. wxPoint pt(0, 0); wxRect r(pt, grid->GetSize()); grid->SetDefaultCellBackgroundColour(col); grid->Refresh(true, &r); } }
void SGOglTextureEnvNBPage::OnButton(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); wxColour texEnvColor; int textureSelected = textureBox->GetSelection(); texEnvColor = wxGetColourFromUser(this, ToWxIntColor(glState->GetTexture(textureSelected)->texEnvColor)); glState->GetTexture(textureSelected)->texEnvColor = ToGLFPColor(texEnvColor); FindWindowById(event.GetId())->SetBackgroundColour(texEnvColor); wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); event.Skip(); }
void FaceWindow::ColorChanged(wxCommandEvent& event) { wxColor color=wxGetColourFromUser(this); if(color.IsOk()) { red = color.Red(); green = color.Green(); blue = color.Blue(); canvas->GetFace()->setColor(red/255,green/255,blue/255,transparency->getValue()); canvas->RefreshCanvas(); } }
void PositionableWidget::ColorChanged(wxCommandEvent& event) { color=wxGetColourFromUser(this); if(color.IsOk()) { double red,green,blue; red = color.Red(); green = color.Green(); blue = color.Blue(); node->pointer.solidentity->setColor(red/255,green/255,blue/255); node->getSimu()->getChild()->UpdateWorld(); } }
void FontColorSettingsPanel::OnBackColorCustom(wxCommandEvent& event) { FontColorSettings::DisplayItem item = static_cast<FontColorSettings::DisplayItem>(m_displayItemsListBox->GetSelection()); FontColorSettings::Colors colors = m_settings.GetColors(item); colors.backColor = wxGetColourFromUser(this, colors.backColor); if (colors.backColor.IsOk()) { m_settings.SetColors(item, colors); UpdatePreview(); } }
void ProgressBarObjectEditor::OndisabledTextBtClick(wxCommandEvent& event) { wxColour color = wxGetColourFromUser(this, disabledTextBt->GetBackgroundColour()); if ( color.IsOk() ) disabledTextBt->SetBackgroundColour(color); if ( color.IsOk() ) { if(color.Red() < 128 && color.Green() < 128 && color.Blue() < 128) disabledTextBt->SetForegroundColour(wxColour(255, 255, 255)); else disabledTextBt->SetForegroundColour(wxColour(0, 0, 0)); } return; }
void ColorChoice::OnSelection(wxCommandEvent & evt) { wxString selection = GetValue(); if (selection == other_color) // Select custom color { wxColor color = wxGetColourFromUser(this, m_lastColor); if (color.IsOk()) SetColor(color); else SetColor(m_lastColor); } else { m_lastColor = wxColour(selection); } SendEvent(); }
/* called to set the background color of the 3D scene */ void EDA_3D_FRAME::Set3DBgColor() { S3D_COLOR color; wxColour newcolor, oldcolor; oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ), KiROUND( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ), KiROUND( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) ); newcolor = wxGetColourFromUser( this, oldcolor ); if( newcolor != oldcolor ) { g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0; g_Parm_3D_Visu.m_BgColor.m_Green = (double) newcolor.Green() / 255.0; g_Parm_3D_Visu.m_BgColor.m_Blue = (double) newcolor.Blue() / 255.0; NewDisplay(); } }
void MainWindow::OnColor(wxCommandEvent& WXUNUSED(event)) { wxTreeItemId itemId = tree->GetSelection(); NodeTree *itemData = itemId.IsOk() ? (NodeTree *) tree->GetItemData(itemId):NULL; if(itemData->pointer.solidentity) { double _r,_g,_b; itemData->pointer.solidentity->getColor(_r,_g,_b); wxColour c = wxColour(_r*255,_g*255,_b*255); wxColour color = wxGetColourFromUser(0); if(color.IsOk()) { double r = color.Red(); double g = color.Green(); double b = color.Blue(); itemData->pointer.solidentity->setColor(r/255,g/255,b/255); for(unsigned int i= 0; i<listWorlds.size(); i++)listWorlds[i]->getChild()->UpdateWorld(); } for(unsigned int i= 0; i<listWorlds.size(); i++)listWorlds[i]->getChild()->UpdateWorld(); } }
void MyFrame::OnSetBgColour(wxCommandEvent& WXUNUSED(event)) { wxColour col = wxGetColourFromUser(this, m_treeCtrl->GetBackgroundColour()); if ( col.Ok() ) m_treeCtrl->SetBackgroundColour(col); }
void PaletteEntryPanel::analysePalettes() { if (palettes.size() < PALETTECHECK + 1) return; #ifdef GPALCOMPANALYSIS int devR, devG, devB; int minR, minG, minB; int maxR, maxG, maxB; int wrongcount; #else unsigned int reds[256]; unsigned int greens[256]; unsigned int blues[256]; #endif string report = "\n"; #ifdef GPALCOMPANALYSIS int i = PALETTECHECK; if (i) { report += S_FMT("Deviation between palettes 0 and %i:\n\n", i); devR = devG = devB = 0; maxR = maxG = maxB = -1; minR = minG = minB = 256; wrongcount = 0; #else report += S_FMT("Changes between %u palettes compared to the first:\n\n", palettes.size()); for (size_t i = 1; i < palettes.size(); ++i) { for (int j = 0; j < 256; ++j) reds[j] = blues[j] = greens[j] = 999; #endif report += S_FMT("\n==============\n= Palette %02u =\n==============\n", i); for (size_t c = 0; c < 256; ++c) { rgba_t ref1 = palettes[0]->colour(c); rgba_t cmp1 = palettes[i]->colour(c); hsl_t ref2 = Misc::rgbToHsl(ref1); hsl_t cmp2 = Misc::rgbToHsl(cmp1); #ifdef GPALCOMPANALYSIS int r, g, b; double h, s, l; r = cmp1.r - ref1.r; g = cmp1.g - ref1.g; b = cmp1.b - ref1.b; h = cmp2.h - ref2.h; s = cmp2.s - ref2.s; l = cmp2.l - ref2.l; devR += r; devG += g; devB += b; if (r > maxR) maxR = r; if (r < minR) minR = r; if (g > maxG) maxG = g; if (g < minG) minG = g; if (b > maxB) maxB = b; if (b < minB) minB = b; if (r | g | b) { ++wrongcount; report += S_FMT("Index %003u: [%003i %003i %003i | %1.3f %1.3f %1.3f]->[%003i %003i %003i | %1.3f %1.3f %1.3f]\t\tR %+003i\tG %+003i\tB %+003i\t\t\tH %+1.3f\tS %+1.3f\tL %+1.3f\n", c, ref1.r, ref1.g, ref1.b, ref2.h, ref2.s, ref2.l, cmp1.r, cmp1.g, cmp1.b, cmp2.h, cmp2.s, cmp2.l, r, g, b, h, s, l); } #else if (reds[ref1.r] != cmp1.r && reds[ref1.r] != 999) DPrintf("Discrepency for red channel at index %i, value %i: %d vs. %d set before", c, ref1.r, cmp1.r, reds[ref1.r]); if (greens[ref1.g] != cmp1.g && greens[ref1.g] != 999) DPrintf("Discrepency for green channel at index %i, value %i: %d vs. %d set before", c, ref1.g, cmp1.g, greens[ref1.g]); if (blues[ref1.b] != cmp1.b && blues[ref1.b] != 999) DPrintf("Discrepency for blue channel at index %i, value %i: %d vs. %d set before", c, ref1.b, cmp1.b, blues[ref1.b]); reds[ref1.r] = cmp1.r; greens[ref1.g] = cmp1.g; blues[ref1.b] = cmp1.b; #endif } #ifdef GPALCOMPANALYSIS report += S_FMT("Deviation sigma: R %+003i G %+003i B %+003i\t%s\n", devR, devG, devB, entry->getName(true)); report += S_FMT("Min R %+003i Min G %+003i Min B %+003i Max R %+003i Max G %+003i Max B %+003i \nError count: %i\n", minR, minG, minB, maxR, maxG, maxB, wrongcount); #else report += "Shift table for existing channel values:\n| I | R | G | B |\n"; for (size_t i = 0; i < 256; ++i) { if (reds[i] < 999 || greens[i] < 999 || blues[i] < 999) report += S_FMT("| %003d | %003d | %003d | %003d |\n", i, reds[i], greens[i], blues[i]); } report.Replace("999", " "); #endif } wxLogMessage(report); } /******************************************************************* * PALETTEENTRYPANEL CLASS EVENTS *******************************************************************/ /* PaletteEntryPanel::onPalCanvasMouseEvent * Called when a mouse event happens within the palette canvas (eg. * button clicked, pointer moved, etc) *******************************************************************/ void PaletteEntryPanel::onPalCanvasMouseEvent(wxMouseEvent& e) { // Update colour info label with selected colour (if any) if (e.LeftDown()) { // Send to palette canvas pal_canvas->onMouseLeftDown(e); // Update status bar updateStatus(); } else if (e.RightDown()) { // Would this be better if the colour picking was handled by // the canvas' onMouseRightDown() function? The problem here // being that the canvas processes its events after the panel. // So for the left click we can afford to call it from there // first and let it harmlessly process it again, but for the // right click it would result in the colour box being shown // twice to the user, the second time being ignored. So it is // preferrable to handle all this on this side rather than try // to make the canvas do the work. // Pretend there was a left click to get the selected colour. pal_canvas->onMouseLeftDown(e); int sel = pal_canvas->getSelectionStart(); // There actually was a colour selected if (sel > -1) { rgba_t col = pal_canvas->getSelectedColour(); // Open a colour dialog wxColour cd = wxGetColourFromUser(GetParent(), WXCOL(col)); if (cd.Ok()) { col.r = cd.Red(); col.g = cd.Green(); col.b = cd.Blue(); palettes[cur_palette]->setColour(sel, col); setModified(); showPalette(cur_palette); } } } }
void MyFrame::OnSetBgColour(wxCommandEvent& WXUNUSED(event)) { m_listCtrl->SetBackgroundColour(wxGetColourFromUser(this)); m_listCtrl->Refresh(); }
void hdFillAttribute::callDefaultChangeDialog(wxWindow *owner) { //create brush dialog wxColour color = wxGetColourFromUser(owner, fillAttributes.GetColour(), wxT("Select a color for fill color...")); fillAttributes = wxBrush(color); }