void CamArtProvider::Draw(wxDC& dc, const wxRect & rect, ResourceID Resource, CamArtFlags Flags, const wxString &text) { dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); dc.SetPen(*wxTRANSPARENT_PEN); // dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); // dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); dc.SetBrush(*wxTRANSPARENT_BRUSH); // Needed in case we need to paint 3D furniture, but not the button top (ALWAYS3D) wxRect brect = rect; UINT32 bitmapoffsetX=0; UINT32 bitmapoffsetY=0; if ((Flags & CAF_PUSHBUTTON) && !rect.IsEmpty()) { // 3Dness brect.width-=1; brect.height-=1; if (Flags & CAF_SELECTED) { // It's pushed in brect.x++; brect.y++; } UINT32 InternalBorderX = (Flags & CAF_NOINTERNALBORDER)?0:2; UINT32 InternalBorderY = (Flags & CAF_NOINTERNALBORDER)?0:1; bitmapoffsetX=1+((InternalBorderX+1)>>1); // this is a completely independent offset to the brect stuff, which gives the bitmap a border bitmapoffsetY=1+((InternalBorderY+1)>>1); // this is a completely independent offset to the brect stuff, which gives the bitmap a border // BOOL FaceSelected = ( (Flags & CAF_SELECTED) || (Flags & CAF_BUTTONHOVER) ); // BOOL Border3D = ( (Flags & CAF_SELECTED) || (Flags & CAF_ALWAYS3D)); BOOL FaceSelected = ( (Flags & CAF_SELECTED) || ((Flags & CAF_ALWAYS3D) && (Flags & CAF_BUTTONHOVER)) ); // highlight face on hover if always3D BOOL Border3D = ( (Flags & CAF_SELECTED) || (Flags & CAF_ALWAYS3D) || (Flags & CAF_BUTTONHOVER)); // Change the brush if the face is selected if (FaceSelected) { if (Flags & CAF_TOOLBACKGROUND) dc.SetBrush(wxColour(255,255,192)); // A light yellow - we should load this from somewhere else else { if (Flags & CAF_BUTTONHOVER) dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT)); else dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); } } if (Border3D) { // draw the light highlights dc.SetPen(wxSystemSettings::GetColour((Flags & CAF_SELECTED)?wxSYS_COLOUR_3DHIGHLIGHT:wxSYS_COLOUR_3DDKSHADOW)); // draw the background behind the button undisplaced dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); // now draw the left & top bits dc.SetPen(wxSystemSettings::GetColour((Flags & CAF_SELECTED)?wxSYS_COLOUR_3DDKSHADOW:wxSYS_COLOUR_3DHIGHLIGHT)); dc.DrawLine(rect.x, rect.y, rect.x+rect.width-1, rect.y); dc.DrawLine(rect.x, rect.y, rect.x, rect.y+rect.height-1); } else if (FaceSelected) // if not FaceSelected, we've already drawn it { // draw the background behind the button displaced dc.DrawRectangle(brect.x, brect.y, brect.width, brect.height); } }
//-------------------------------------------------------------------------- // void wxPLDevDC::SetColor1( PLStream *pls ) // // Set color from colormap 1. //-------------------------------------------------------------------------- void wxPLDevDC::SetColor1( PLStream *pls ) { m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a * 255 ), pls->width > 0 ? pls->width : 1, wxSOLID ) ) ); m_dc->SetBrush( wxBrush( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a * 255 ) ) ); }
wxsImageTreeEditorDlg::wxsImageTreeEditorDlg(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size) { //(*Initialize(wxsImageTreeEditorDlg) wxGridSizer* GridSizer1; wxBoxSizer* BoxSizer3; wxBoxSizer* BoxSizer10; wxBoxSizer* BoxSizer7; wxBoxSizer* BoxSizer11; wxBoxSizer* BoxSizer13; wxBoxSizer* BoxSizer2; wxBoxSizer* BoxSizer9; wxBoxSizer* BoxSizer4; wxBoxSizer* BoxSizer8; wxBoxSizer* BoxSizer1; wxBoxSizer* BoxSizer12; wxBoxSizer* BoxSizer6; wxBoxSizer* BoxSizer5; Create(parent, wxID_ANY, _("Tree Item Editor"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY")); wxFont thisFont(8,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Arial"),wxFONTENCODING_DEFAULT); SetFont(thisFont); BoxSizer1 = new wxBoxSizer(wxVERTICAL); BoxSizer2 = new wxBoxSizer(wxHORIZONTAL); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Edit Tree Items"), wxPoint(0,0), wxSize(400,20), wxST_NO_AUTORESIZE|wxALIGN_CENTRE, _T("ID_STATICTEXT1")); wxFont StaticText1Font(10,wxSWISS,wxFONTSTYLE_NORMAL,wxBOLD,false,_T("Arial"),wxFONTENCODING_DEFAULT); StaticText1->SetFont(StaticText1Font); BoxSizer2->Add(StaticText1, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); BoxSizer1->Add(BoxSizer2, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); BoxSizer3 = new wxBoxSizer(wxHORIZONTAL); BoxSizer5 = new wxBoxSizer(wxHORIZONTAL); StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("tree-name")); Tree1 = new wxTreeCtrl(this, ID_TREECTRL1, wxPoint(2,36), wxSize(246,359), wxTR_EDIT_LABELS|wxTR_DEFAULT_STYLE, wxDefaultValidator, _T("ID_TREECTRL1")); StaticBoxSizer1->Add(Tree1, 0, wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer5->Add(StaticBoxSizer1, 0, wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer3->Add(BoxSizer5, 0, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 0); BoxSizer6 = new wxBoxSizer(wxHORIZONTAL); StaticBoxSizer2 = new wxStaticBoxSizer(wxVERTICAL, this, _("Attributes")); BoxSizer7 = new wxBoxSizer(wxHORIZONTAL); bAddItem = new wxBitmapButton(this, ID_IMAGEBUTTON1, wxNullBitmap, wxPoint(256,36), wxSize(24,23), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_IMAGEBUTTON1")); bAddItem->SetToolTip(_("Add A New Item")); BoxSizer7->Add(bAddItem, 0, wxALIGN_LEFT|wxALIGN_BOTTOM, 5); StaticText2 = new wxStaticText(this, wxID_ANY, _("Add Item"), wxPoint(290,40), wxDefaultSize, 0, _T("wxID_ANY")); BoxSizer7->Add(StaticText2, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer2->Add(BoxSizer7, 0, wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP, 0); BoxSizer8 = new wxBoxSizer(wxHORIZONTAL); bAddSubItem = new wxBitmapButton(this, ID_IMAGEBUTTON2, wxNullBitmap, wxPoint(256,66), wxSize(24,23), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_IMAGEBUTTON2")); bAddSubItem->SetToolTip(_("Add A New Child")); BoxSizer8->Add(bAddSubItem, 0, wxALIGN_LEFT|wxALIGN_BOTTOM, 5); StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("Add Sub-Item"), wxPoint(290,70), wxDefaultSize, 0, _T("ID_STATICTEXT3")); BoxSizer8->Add(StaticText3, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer2->Add(BoxSizer8, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer9 = new wxBoxSizer(wxHORIZONTAL); bDelItem = new wxBitmapButton(this, ID_IMAGEBUTTON3, wxNullBitmap, wxPoint(256,96), wxSize(24,23), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_IMAGEBUTTON3")); bDelItem->SetToolTip(_("Delete Current Item")); BoxSizer9->Add(bDelItem, 0, wxALIGN_LEFT|wxALIGN_BOTTOM, 5); StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("Delete Current Item"), wxPoint(290,100), wxDefaultSize, 0, _T("ID_STATICTEXT4")); BoxSizer9->Add(StaticText4, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer2->Add(BoxSizer9, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer10 = new wxBoxSizer(wxHORIZONTAL); bDelAllItems = new wxBitmapButton(this, ID_IMAGEBUTTON4, wxNullBitmap, wxPoint(256,126), wxSize(24,23), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_IMAGEBUTTON4")); bDelAllItems->SetToolTip(_("Delete All Items")); BoxSizer10->Add(bDelAllItems, 0, wxALIGN_LEFT|wxALIGN_BOTTOM, 5); StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("Delete All Items"), wxPoint(290,130), wxDefaultSize, 0, _T("ID_STATICTEXT5")); BoxSizer10->Add(StaticText5, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer2->Add(BoxSizer10, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer11 = new wxBoxSizer(wxHORIZONTAL); bItemColor = new wxButton(this, ID_BUTTON3, _("C"), wxPoint(256,156), wxSize(24,24), 0, wxDefaultValidator, _T("ID_BUTTON3")); wxFont bItemColorFont(10,wxSWISS,wxFONTSTYLE_NORMAL,wxBOLD,false,_T("Arial Black"),wxFONTENCODING_DEFAULT); bItemColor->SetFont(bItemColorFont); bItemColor->SetToolTip(_("Set Item Text Color")); BoxSizer11->Add(bItemColor, 0, wxALIGN_LEFT|wxALIGN_BOTTOM, 5); StaticText6 = new wxStaticText(this, ID_STATICTEXT6, _("Set Item Text Color"), wxPoint(290,160), wxDefaultSize, 0, _T("ID_STATICTEXT6")); BoxSizer11->Add(StaticText6, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer2->Add(BoxSizer11, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer12 = new wxBoxSizer(wxHORIZONTAL); cxItemBold = new wxCheckBox(this, ID_CHECKBOX1, _(" Set Item Text Bold"), wxPoint(262,192), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1")); cxItemBold->SetValue(false); cxItemBold->SetToolTip(_("Set Item Text Bold")); BoxSizer12->Add(cxItemBold, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer2->Add(BoxSizer12, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer13 = new wxBoxSizer(wxHORIZONTAL); bEditItem = new wxBitmapButton(this, ID_IMAGEBUTTON5, wxNullBitmap, wxPoint(256,216), wxSize(24,23), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_IMAGEBUTTON5")); bEditItem->SetToolTip(_("Start Editor On Current Item")); BoxSizer13->Add(bEditItem, 0, wxALIGN_LEFT|wxALIGN_BOTTOM, 5); StaticText11 = new wxStaticText(this, ID_STATICTEXT11, _("Edit Current Item"), wxPoint(290,220), wxDefaultSize, 0, _T("ID_STATICTEXT11")); BoxSizer13->Add(StaticText11, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer2->Add(BoxSizer13, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); GridSizer1 = new wxGridSizer(5, 2, 0, 0); StaticText12 = new wxStaticText(this, ID_STATICTEXT12, _("Image-List"), wxPoint(256,272), wxDefaultSize, 0, _T("ID_STATICTEXT12")); GridSizer1->Add(StaticText12, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); StaticText13 = new wxStaticText(this, ID_STATICTEXT13, _("Label"), wxPoint(310,272), wxSize(82,14), wxST_NO_AUTORESIZE, _T("ID_STATICTEXT13")); StaticText13->SetForegroundColour(wxColour(0,0,255)); GridSizer1->Add(StaticText13, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); cbNormal = new wxBitmapComboBox(this, ID_COMBOBOX1, wxEmptyString, wxPoint(256,296), wxSize(48,22), 0, NULL, wxCB_READONLY, wxDefaultValidator, _T("ID_COMBOBOX1")); GridSizer1->Add(cbNormal, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 3); StaticText7 = new wxStaticText(this, ID_STATICTEXT7, _("Normal Image"), wxPoint(310,300), wxDefaultSize, 0, _T("ID_STATICTEXT7")); GridSizer1->Add(StaticText7, 0, wxTOP|wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 3); cbSelected = new wxBitmapComboBox(this, ID_COMBOBOX2, wxEmptyString, wxPoint(256,326), wxSize(48,22), 0, NULL, wxCB_READONLY, wxDefaultValidator, _T("ID_COMBOBOX2")); GridSizer1->Add(cbSelected, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 3); StaticText8 = new wxStaticText(this, ID_STATICTEXT8, _("Selected Image"), wxPoint(310,330), wxDefaultSize, 0, _T("ID_STATICTEXT8")); GridSizer1->Add(StaticText8, 0, wxTOP|wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 3); cbExpanded = new wxBitmapComboBox(this, ID_COMBOBOX3, wxEmptyString, wxPoint(256,356), wxSize(48,22), 0, NULL, wxCB_READONLY, wxDefaultValidator, _T("ID_COMBOBOX3")); GridSizer1->Add(cbExpanded, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 3); StaticText9 = new wxStaticText(this, ID_STATICTEXT9, _("Expanded Image"), wxPoint(310,360), wxDefaultSize, 0, _T("ID_STATICTEXT9")); GridSizer1->Add(StaticText9, 0, wxTOP|wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 3); cbSelExpanded = new wxBitmapComboBox(this, ID_COMBOBOX4, wxEmptyString, wxPoint(256,386), wxSize(48,22), 0, NULL, wxCB_READONLY, wxDefaultValidator, _T("ID_COMBOBOX4")); GridSizer1->Add(cbSelExpanded, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 3); StaticText10 = new wxStaticText(this, ID_STATICTEXT10, _("Sel+Exp Image"), wxPoint(310,390), wxDefaultSize, 0, _T("ID_STATICTEXT10")); GridSizer1->Add(StaticText10, 0, wxTOP|wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 3); StaticBoxSizer2->Add(GridSizer1, 0, wxTOP|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer6->Add(StaticBoxSizer2, 0, wxLEFT|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer3->Add(BoxSizer6, 0, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 0); BoxSizer1->Add(BoxSizer3, 0, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 0); BoxSizer4 = new wxBoxSizer(wxHORIZONTAL); bOK = new wxButton(this, ID_BUTTON1, _("OK"), wxPoint(48,440), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); bOK->SetDefault(); BoxSizer4->Add(bOK, 0, wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer4->Add(-1,-1,1, wxLEFT|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); bCancel = new wxButton(this, ID_BUTTON2, _("Cancel"), wxPoint(280,440), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); BoxSizer4->Add(bCancel, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); BoxSizer1->Add(BoxSizer4, 0, wxTOP|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 0); SetSizer(BoxSizer1); static const char *ImageList1_0_XPM[] = { "16 16 3 1", ". c Black", "X c #00C000", "_ c None", "________......._", "________.XXXXX._", "___..___.XXXXX._", "___..___.XXXXX._", "_......_.XXXXX._", "_......_.XXXXX._", "___..___.XXXXX._", "___..___.XXXXX._", "________.XXXXX._", "________.XXXXX._", "________.XXXXX._", "________.XXXXX._", "________.XX.XX._", "________.X._.X._", "________..___.._", "................" }; static const char *ImageList1_1_XPM[] = { "16 16 4 1", "o c Black", ". c #000080", "X c #0000FF", "_ c None", "________......._", "________.XXXXX._", "___oo___.XXXXX._", "___oo___.XXXXX._", "_oooooo_.XXXXX._", "_oooooo_.XXXXX._", "___oo___.XXXXX._", "___oo___.XXXXX._", "________.XXXXX._", "________.XXXXX._", "________.XXXXX._", "________.XXXXX._", "________.XX.XX._", "________.X._.X._", "________..___.._", "oooooooooooooooo" }; static const char *ImageList1_2_XPM[] = { "16 16 3 1", ". c Black", "_ c None", "X c #FF4040", "________......._", "________.XXXXX._", "__.___._.XXXXX._", "__.._.._.XXXXX._", "___...__.XXXXX._", "____.___.XXXXX._", "___...__.XXXXX._", "__.._.._.XXXXX._", "__.___._.XXXXX._", "________.XXXXX._", "________.XXXXX._", "________.XXXXX._", "________.XX.XX._", "________.X._.X._", "________..___.._", "................" }; static const char *ImageList1_3_XPM[] = { "16 16 22 1", "4 c Black", "3 c #A5AEBD", "= c #5478B4", "1 c #95A3BB", "O c #9AA7BC", ": c #758EB7", "$ c #6986B6", "# c #4971B2", "* c #8A9CBA", "X c #8598B9", "o c #ABB2BE", "; c #7F95B9", "- c #4E74B3", "2 c #A0ABBC", "+ c #6F8AB7", "_ c None", ". c #B5B9BF", "@ c #3E69B1", "< c #90A0BA", "> c #6483B5", ", c #5A7BB4", "& c #5F7FB5", "________________", "____.Xo______OO_", "____+@#.____$@&_", "____*@@X__.=@=o_", "_____-@-_.=@=.__", "_____;@@X=@=.___", "_____.#@@@$.____", "______:@@>______", "_____:@@@+______", "___.,@#&@@._____", "__o=@=oO@@<_____", "_1#@=._.@@-_____", "*@@$____>@@2____", ":#*_____3#,.____", "________________", "4444444444444444" }; static const char *ImageList1_4_XPM[] = { "16 16 2 1", ". c Black", "_ c None", "________________", "______..________", "______..._______", "_____...._______", "_____._...______", "____.._...______", "____.___..______", "___..___..._____", "___._____.._____", "___.........____", "__.._____...____", "__._______...___", "_.._______...___", "_....___......._", "________________", "................" }; ImageList1 = new wxImageList(16, 16, 6); ImageList1->Add(wxBitmap(ImageList1_0_XPM)); ImageList1->Add(wxBitmap(ImageList1_1_XPM)); ImageList1->Add(wxBitmap(ImageList1_2_XPM)); ImageList1->Add(wxBitmap(ImageList1_3_XPM)); ImageList1->Add(wxBitmap(ImageList1_4_XPM)); ColourDialog1 = new wxColourDialog(this); BoxSizer1->Fit(this); BoxSizer1->SetSizeHints(this); Connect(ID_TREECTRL1,wxEVT_COMMAND_TREE_SEL_CHANGED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OnTreeCtrl1SelectionChanged); // Set the bitmaps for bAddItem. bAddItem->SetBitmapLabel(ImageList1->GetBitmap(0)); Connect(ID_IMAGEBUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OnbAddItemClick); // Set the bitmaps for bAddSubItem. bAddSubItem->SetBitmapLabel(ImageList1->GetBitmap(1)); Connect(ID_IMAGEBUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OnbAddSubItemClick); // Set the bitmaps for bDelItem. bDelItem->SetBitmapLabel(ImageList1->GetBitmap(2)); Connect(ID_IMAGEBUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OnbDelItemClick); // Set the bitmaps for bDelAllItems. bDelAllItems->SetBitmapLabel(ImageList1->GetBitmap(3)); Connect(ID_IMAGEBUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OnbDelAllItemsClick); Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OnbItemColorClick); Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OncxItemBoldClick); // Set the bitmaps for bEditItem. bEditItem->SetBitmapLabel(ImageList1->GetBitmap(4)); Connect(ID_IMAGEBUTTON5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OnbEditItemClick); Connect(ID_COMBOBOX1,wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OncbNormalSelect); Connect(ID_COMBOBOX2,wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OncbSelectedSelect); Connect(ID_COMBOBOX3,wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OncbExpandedSelect); Connect(ID_COMBOBOX4,wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OncbSelExpandedSelect); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OnbOKClick); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsImageTreeEditorDlg::OnbCancelClick); //*) }
Theme& Theme::loadWalls(unsigned long colour){ _walls = wxColour(colour); return *this; }
Theme& Theme::loadBackground(unsigned long colour){ _background = wxColour(colour); return *this; }
#include "nwx/nwxBatch.h" #include "nwx/nwxGrid.h" #include "Platform.h" #if USE_WINGDINGS wxFont CGridAnalysis::g_fontStatus(8,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("wingdings")); #else // X11 if ever implemented wxFont CGridAnalysis::g_fontStatus; #endif const wxString CGridAnalysis::g_sSampleLevelNeedsAttention(_T("*")); const wxString CGridAnalysis::g_sStatusNeedsAttention(_T(CHAR_ATTN)); const wxString CGridAnalysis::g_sStatusOK(_T(CHAR_OK)); wxPen CGridAnalysis::g_LIGHT_GREY(wxColour(216,216,216),1,wxSOLID); IMPLEMENT_ABSTRACT_CLASS(CGridAnalysis,wxGrid) CGridAnalysis::~CGridAnalysis() {;} CGridAnalysis::CGridAnalysis(wxWindow *pParent) : wxGrid(pParent,IDgrid), m_bgBold(255,255,160), m_bgNormal(255,255,255), m_bgRowHasAlert(255,255,218), m_fgBold(192,0,0), m_fgNormal(0,0,0), m_pDC(NULL), m_nLabelSize(0),
// Code below taken from the internet after nasty troubles with the cursor // initialization in GTK //http://cvs.sourceforge.net/viewcvs.py/audacity/audacity-src/src/TrackPanel.cpp?rev=1.218 wxCursor* tui::MakeCursor( const char * pXpm[36], int HotX, int HotY ) { wxCursor * pCursor; const int HotAdjust =0; wxImage Image = wxImage(wxBitmap(pXpm).ConvertToImage()); Image.SetMaskColour(255,0,0); Image.SetMask();// Enable mask. #ifdef __WXGTK__ // // Kludge: the wxCursor Image constructor is broken in wxGTK. // This code, based loosely on the broken code from the wxGTK source, // works around the problem by constructing a 1-bit bitmap and // calling the other custom cursor constructor. // // -DMM // unsigned char *rgbBits = Image.GetData(); int w = Image.GetWidth() ; int h = Image.GetHeight(); int imagebitcount = (w*h)/8; unsigned char *bits = DEBUG_NEW unsigned char [imagebitcount]; unsigned char *maskBits = DEBUG_NEW unsigned char [imagebitcount]; int i, j, i8; unsigned char cMask; for (i=0; i<imagebitcount; i++) { bits[i] = 0; i8 = i * 8; cMask = 1; for (j=0; j<8; j++) { if (rgbBits[(i8+j)*3+2] < 127) bits[i] = bits[i] | cMask; cMask = cMask * 2; } } for (i=0; i<imagebitcount; i++) { maskBits[i] = 0x0; i8 = i * 8; cMask = 1; for (j=0; j<8; j++) { if (rgbBits[(i8+j)*3] < 127 || rgbBits[(i8+j)*3+1] > 127) maskBits[i] = maskBits[i] | cMask; cMask = cMask * 2; } } wxColour* col_black = DEBUG_NEW wxColour( 0, 0, 0); wxColour* col_white = DEBUG_NEW wxColour(255, 255, 255); pCursor = DEBUG_NEW wxCursor((const char *)bits, w, h, HotX-HotAdjust, HotY-HotAdjust, (const char *)maskBits, col_black, col_white); delete [] bits; delete [] maskBits; delete col_black; delete col_white; #else Image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, HotX-HotAdjust ); Image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, HotY-HotAdjust ); pCursor = DEBUG_NEW wxCursor( Image ); #endif return pCursor; }
void about::Update() { wxColor bg = GetBackgroundColour(); wxColor fg = wxColour(0,0,0); //FontMgr::Get().GetFontColor( _("Dialog") ); wxString aboutText; aboutText.Printf( _T("<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>"), bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() ); wxFont *dFont = FontMgr::Get().GetFont( _("Dialog") ); wxString face = dFont->GetFaceName(); #ifdef __WXOSX__ int points = dFont->GetPointSize(); #else int points = dFont->GetPointSize() + 1; #endif int sizes[7]; for ( int i=-2; i<5; i++ ) { sizes[i+2] = points + i + (i>0?i:0); } pAboutHTMLCtl->SetFonts(face, face, sizes); if(wxFONTSTYLE_ITALIC == dFont->GetStyle()) aboutText += _T("<i>"); wxString *pAboutString = new wxString( AboutText, wxConvUTF8 ); pAboutString->Append( OpenCPNVersion ); pAboutString->Append( wxString( OpenCPNInfo, wxConvUTF8 ) ); // Show the user where the log file is going to be wxString log = _T(" Logfile location: "); log.Append( g_Platform->GetLogFileName() ); pAboutString->Append(log); // Show the user where the config file is going to be wxString conf = _T("<br><br> Config file location: "); conf.Append( g_Platform->GetConfigFileName() ); pAboutString->Append(conf); aboutText << *pAboutString; delete pAboutString; aboutText << _T("</font>"); if(wxFONTSTYLE_ITALIC == dFont->GetStyle()) aboutText << _T("</i>"); aboutText << _T("</body></html>"); pAboutHTMLCtl->SetPage( aboutText ); pAuthorTextCtl->Clear(); wxString *pAuthorsString = new wxString( AuthorText, wxConvUTF8 ); pAuthorTextCtl->WriteText( *pAuthorsString ); pAuthorTextCtl->SetInsertionPoint( 0 ); delete pAuthorsString; pLicenseTextCtl->Clear(); wxString license_loc(m_DataLocn ); license_loc.Append( _T("license.txt") ); wxTextFile license_file( license_loc ); if( license_file.Open() ) { wxString str; str = license_file.GetFirstLine(); pLicenseTextCtl->WriteText( str ); while( !license_file.Eof() ) { str = license_file.GetNextLine(); str.Append( _T("\n") ); pLicenseTextCtl->AppendText( str ); } license_file.Close(); } else { wxString msg( _T("Could not open License file: ") ); msg.Append( license_loc ); wxLogMessage( msg ); } pLicenseTextCtl->SetInsertionPoint( 0 ); SetColorScheme(); }
APalette::APalette(wxWindow * parent, wxWindowID id, const wxPoint & pos, const wxSize & size):wxWindow(parent, id, pos, size) { #if defined(__WXMAC__) // && defined(TARGET_CARBON) int off = 1; #else int off = 0; #endif mTool[0] = new AButton(this, ID_IBEAM, wxPoint(off, off), wxSize(27, 27), (char **) IBeamUp, (char **) IBeamOver, (char **) IBeamDown, (char **) IBeamUp); mTool[1] = new AButton(this, ID_SELECT, wxPoint(28, off), wxSize(27, 27), (char **) SelectUp, (char **) SelectOver, (char **) SelectDown, (char **) SelectUp); mTool[2] = new AButton(this, ID_MOVE, wxPoint(off, 28), wxSize(27, 27), (char **) MoveUp, (char **) MoveOver, (char **) MoveDown, (char **) MoveUp); mTool[3] = new AButton(this, ID_ZOOM, wxPoint(28, 28), wxSize(27, 27), (char **) ZoomUp, (char **) ZoomOver, (char **) ZoomDown, (char **) ZoomUp); mPlay = new AButton(this, ID_PLAY_BUTTON, wxPoint(64, 4), wxSize(48, 48), (char **) PlayUp, (char **) PlayOver, (char **) PlayDown, (char **) PlayDisabled); mStop = new AButton(this, ID_STOP_BUTTON, wxPoint(114, 4), wxSize(48, 48), (char **) StopUp, (char **) StopOver, (char **) StopDown, (char **) StopDisabled); mRecord = new AButton(this, ID_RECORD_BUTTON, wxPoint(164, 4), wxSize(48, 48), (char **) RecordUp, (char **) RecordOver, (char **) RecordDown, (char **) RecordDisabled); #if defined(__WXMAC__) // && defined(TARGET_CARBON) int sliderX = 262; #else int sliderX = 222; #endif mVolume = new ASlider(this, 0, wxPoint(sliderX, 14), wxSize(100, 28), (char **) Slider, (char **) SliderThumb, 100); mVolume->Set(80); mCurrentTool = 0; mTool[0]->PushDown(); mBackgroundBrush.SetColour(wxColour(204, 204, 204)); mBackgroundPen.SetColour(wxColour(204, 204, 204)); mBackgroundBitmap = NULL; mBackgroundHeight = 0; mBackgroundWidth = 0; #if defined(__WXMAC__) // && defined(TARGET_CARBON) mDivBitmap = new wxBitmap((const char **) Div); mMuteBitmap = new wxBitmap((const char **) Mute); mLoudBitmap = new wxBitmap((const char **) Loud); #endif }
void CViewResources::OnListRender( wxTimerEvent& WXUNUSED(event) ) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxString diskspace; static double project_total=0.0; unsigned int i; wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); //get data for BOINC projects disk usage pDoc->CachedDiskUsageUpdate(); pDoc->CachedStateUpdate(); bool refreshBOINC=false; if (pDoc->disk_usage.projects.size()>0) { m_BOINCwasEmpty=false; //check for changes worth a refresh if(pDoc->disk_usage.projects.size() != m_pieCtrlBOINC->m_Series.size()) { refreshBOINC=true; } else { for (i=0; i<pDoc->disk_usage.projects.size(); i++) { wxString oldValue; wxString newValue; FormatDiskSpace(pDoc->DiskUsageProject(i)->disk_usage, newValue); FormatDiskSpace(m_pieCtrlBOINC->m_Series.Item(i).GetValue(), oldValue); if(newValue.Cmp(oldValue)!=0) { refreshBOINC=true; break; } } } //only refresh when worthy changes if(refreshBOINC) { m_pieCtrlBOINC->m_Series.Clear(); project_total = 0; for (i=0; i<pDoc->disk_usage.projects.size(); i++) { //update data for boinc projects pie chart PROJECT* project = pDoc->DiskUsageProject(i); wxString projectname; FormatProjectName(project, projectname); FormatDiskSpace(project->disk_usage, diskspace); double usage = project->disk_usage; project_total += usage; wxPiePart part; part.SetLabel(projectname + wxT(": ") + diskspace); part.SetValue(usage); unsigned char r=128+(rand()&127); unsigned char g=128+(rand()&127); unsigned char b=128+(rand()&127); part.SetColour(wxColour(r, g, b)); m_pieCtrlBOINC->m_Series.Add(part); } m_pieCtrlBOINC->Refresh(); } } else { if(!m_BOINCwasEmpty) { //paint an empty black pie m_pieCtrlBOINC->m_Series.Clear(); wxPiePart part; part.SetLabel(_("no projects: 0 bytes used")); part.SetValue(1); part.SetColour(wxColour(0,0,0)); m_pieCtrlBOINC->m_Series.Add(part); m_pieCtrlBOINC->Refresh(); m_BOINCwasEmpty=true; refreshBOINC=true; } } //pDoc->disk_usage.d_allowed = 0; //data for pie chart 2 (total disk usage) // // good source of color palettes: // http://www.siteprocentral.com/cgi-bin/feed/feed.cgi // bool refreshTotal=false; double free = pDoc->disk_usage.d_free; double total = pDoc->disk_usage.d_total; if(m_pieCtrlTotal->m_Series.size()>0) { wxString oldFree; wxString newFree; FormatDiskSpace(free, newFree); FormatDiskSpace(m_pieCtrlTotal->m_Series.Item(0).GetValue(), oldFree); if(oldFree.Cmp(newFree)!=0) { refreshTotal=true; } } else { refreshTotal=true; } if(refreshBOINC || refreshTotal) { m_pieCtrlTotal->m_Series.Clear(); wxPiePart part; // used by BOINC double boinc_total = project_total + pDoc->disk_usage.d_boinc; FormatDiskSpace(boinc_total, diskspace); part.SetLabel(_("used by BOINC: ") + diskspace); part.SetValue(boinc_total); part.SetColour(wxColour(0,0,0)); m_pieCtrlTotal->m_Series.Add(part); if (pDoc->disk_usage.d_allowed > 0) { double avail = pDoc->disk_usage.d_allowed - boinc_total; if (avail > 0) { if (avail > free) avail = free; FormatDiskSpace(avail, diskspace); part.SetLabel(_("free, available to BOINC: ") + diskspace); part.SetValue(avail); part.SetColour(wxColour(128, 128, 128)); m_pieCtrlTotal->m_Series.Add(part); } else { avail = 0; } double not_avail = free - avail; if (not_avail > 0) { FormatDiskSpace(not_avail, diskspace); part.SetLabel(_("free, not available to BOINC: ") + diskspace); part.SetValue(not_avail); part.SetColour(wxColour(238,238,238)); m_pieCtrlTotal->m_Series.Add(part); } } else { // if d_allowed is zero, we must be talking to a pre-6.3 client. // Just show free space // FormatDiskSpace(free, diskspace); part.SetLabel(_("free: ") + diskspace); part.SetValue(free); part.SetColour(wxColour(238,238,238)); m_pieCtrlTotal->m_Series.Add(part); } // used by others double used_by_others = total-boinc_total-free; FormatDiskSpace(used_by_others, diskspace); part.SetLabel(_("used by other programs: ") + diskspace); part.SetValue(used_by_others); part.SetColour(wxColour(192,192,192)); m_pieCtrlTotal->m_Series.Add(part); m_pieCtrlTotal->Refresh(); } }
CViewResources::CViewResources(wxNotebook* pNotebook) : CBOINCBaseView(pNotebook) { m_BOINCwasEmpty=false; wxPanel* pPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0); wxASSERT(pPanel); wxGridSizer* itemGridSizer = new wxGridSizer(2, 0, 3); wxASSERT(itemGridSizer); // create pie chart ctrl for total disk usage m_pieCtrlTotal = new wxPieCtrl(pPanel, ID_PIECTRL_RESOURCEUTILIZATIONVIEWTOTAL, wxDefaultPosition, wxDefaultSize); wxASSERT(m_pieCtrlTotal); // setup the legend m_pieCtrlTotal->SetTransparent(true); m_pieCtrlTotal->SetHorLegendBorder(10); m_pieCtrlTotal->SetLabelFont(*wxSWISS_FONT); m_pieCtrlTotal->SetLabelColour(wxColour(0,0,0)); m_pieCtrlTotal->SetLabel(_("Total disk usage")); // initialize pie control m_pieCtrlTotal->m_Series.Clear(); wxPiePart CtrlTotalPart; CtrlTotalPart.SetLabel(wxEmptyString); CtrlTotalPart.SetValue(1); CtrlTotalPart.SetColour(wxColour(255,255,255)); m_pieCtrlTotal->m_Series.Add(CtrlTotalPart); m_pieCtrlTotal->Refresh(); // create pie chart ctrl for BOINC disk usage m_pieCtrlBOINC = new wxPieCtrl(pPanel, ID_PIECTRL_RESOURCEUTILIZATIONVIEW, wxDefaultPosition, wxDefaultSize); wxASSERT(m_pieCtrlBOINC); //setup the legend m_pieCtrlBOINC->SetTransparent(true); m_pieCtrlBOINC->SetHorLegendBorder(10); m_pieCtrlBOINC->SetLabelFont(*wxSWISS_FONT); m_pieCtrlBOINC->SetLabelColour(wxColour(0,0,0)); m_pieCtrlBOINC->SetLabel(_("Disk usage by BOINC projects")); // initialize pie control m_pieCtrlBOINC->m_Series.Clear(); wxPiePart CtrlBOINCPart; CtrlBOINCPart.SetLabel(wxEmptyString); CtrlBOINCPart.SetValue(1); CtrlBOINCPart.SetColour(wxColour(255,255,255)); m_pieCtrlBOINC->m_Series.Add(CtrlBOINCPart); m_pieCtrlBOINC->Refresh(); //init the flexGrid itemGridSizer->Add(m_pieCtrlTotal, 1, wxGROW|wxALL,1); itemGridSizer->Add(m_pieCtrlBOINC, 1, wxGROW|wxALL,1); pPanel->SetSizer(itemGridSizer); pPanel->Layout(); Initialize(pPanel); UpdateSelection(); }
ApplicationFiles::ApplicationFiles(wxWizard* parent, wxWizardPageSimple* prev) { //(*Initialize(ApplicationFiles) wxBoxSizer* BoxSizer4; wxBoxSizer* BoxSizer6; wxBoxSizer* BoxSizer19; wxBoxSizer* BoxSizer5; wxBoxSizer* BoxSizer10; wxBoxSizer* BoxSizer7; wxBoxSizer* BoxSizer8; wxStaticText* StaticText2; wxStaticBitmap* StaticBitmap1; wxStaticText* StaticText8; wxStaticText* StaticText1; wxBoxSizer* BoxSizer2; wxBoxSizer* BoxSizer11; wxBoxSizer* BoxSizer12; wxStaticText* StaticText7; wxBoxSizer* BoxSizer1; wxBoxSizer* BoxSizer9; wxBoxSizer* BoxSizer3; wxStaticText* StaticText4; Create(parent, prev); BoxSizer1 = new wxBoxSizer(wxVERTICAL); Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1")); Panel1->SetBackgroundColour( wxColour( 255, 255, 255)); BoxSizer4 = new wxBoxSizer(wxHORIZONTAL); BoxSizer5 = new wxBoxSizer(wxVERTICAL); BoxSizer6 = new wxBoxSizer(wxHORIZONTAL); BoxSizer6->Add(35,20,0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, _("Application Files"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2")); wxFont StaticText2Font(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,wxEmptyString,wxFONTENCODING_DEFAULT); StaticText2->SetFont(StaticText2Font); BoxSizer6->Add(StaticText2, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer5->Add(BoxSizer6, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer7 = new wxBoxSizer(wxHORIZONTAL); BoxSizer7->Add(35,20,0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, _(" Please specify the files that are part of your application."), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); BoxSizer7->Add(StaticText1, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer5->Add(BoxSizer7, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer4->Add(BoxSizer5, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer4->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticBitmap1 = new wxStaticBitmap(Panel1, wxID_ANY, wxBitmap(LinksOben_xpm), wxDefaultPosition, wxDefaultSize, 0, _T("wxID_ANY")); BoxSizer4->Add(StaticBitmap1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); Panel1->SetSizer(BoxSizer4); BoxSizer4->Fit(Panel1); BoxSizer4->SetSizeHints(Panel1); BoxSizer1->Add(Panel1, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE1")); BoxSizer1->Add(StaticLine1, 0, wxBOTTOM|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer2 = new wxBoxSizer(wxHORIZONTAL); BoxSizer2->Add(75,20,0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); text1 = new wxStaticText(this, ID_STATICTEXT3, _("Application main executable file:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3")); wxFont text1Font(8,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,wxEmptyString,wxFONTENCODING_DEFAULT); text1->SetFont(text1Font); BoxSizer2->Add(text1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer2->Add(-1,-1,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer2, 0, wxLEFT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer3 = new wxBoxSizer(wxHORIZONTAL); BoxSizer3->Add(75,20,0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); txtMainExe = new wxTextCtrl(this, ID_TEXTCTRL1, _("C:\\Program Files (x86)\\Inno setup 5\\Examples\\MyProg.exe"), wxDefaultPosition, wxSize(308,21), 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); BoxSizer3->Add(txtMainExe, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); btnMainExe = new wxButton(this, ID_BUTTON1, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); BoxSizer3->Add(btnMainExe, 0, wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer3->Add(-1,-1,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer3, 0, wxTOP|wxLEFT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer8 = new wxBoxSizer(wxHORIZONTAL); BoxSizer8->Add(75,20,0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); cbAllowStartAfterInstall = new wxCheckBox(this, ID_CHECKBOX1, _("Allow user to start the application after Setup has finished"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1")); cbAllowStartAfterInstall->SetValue(true); BoxSizer8->Add(cbAllowStartAfterInstall, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer8->Add(-1,-1,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer8, 0, wxTOP|wxLEFT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer9 = new wxBoxSizer(wxHORIZONTAL); BoxSizer9->Add(75,20,0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); cbDoesntHaveMain = new wxCheckBox(this, ID_CHECKBOX2, _("The application doesn\'t have a main executable file"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX2")); cbDoesntHaveMain->SetValue(false); BoxSizer9->Add(cbDoesntHaveMain, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer9->Add(-1,-1,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer9, 0, wxTOP|wxLEFT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer10 = new wxBoxSizer(wxHORIZONTAL); BoxSizer10->Add(75,20,0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("Other application files:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4")); BoxSizer10->Add(StaticText4, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer10->Add(-1,-1,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer10, 0, wxTOP|wxLEFT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer11 = new wxBoxSizer(wxHORIZONTAL); BoxSizer11->Add(75,20,0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); lbFiles = new wxListBox(this, ID_LISTBOX1, wxDefaultPosition, wxSize(309,124), 0, 0, wxLB_HSCROLL, wxDefaultValidator, _T("ID_LISTBOX1")); BoxSizer11->Add(lbFiles, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer12 = new wxBoxSizer(wxVERTICAL); btnFiles = new wxButton(this, ID_BUTTON2, _("Add file(s) ..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); BoxSizer12->Add(btnFiles, 0, wxBOTTOM|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); btnFolder = new wxButton(this, ID_BUTTON3, _("Add folder ..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); BoxSizer12->Add(btnFolder, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); btnEdit = new wxButton(this, ID_BUTTON4, _("Edit"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4")); btnEdit->Disable(); BoxSizer12->Add(btnEdit, 0, wxTOP|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); btnRemove = new wxButton(this, ID_BUTTON5, _("Remove"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON5")); btnRemove->Disable(); BoxSizer12->Add(btnRemove, 1, wxTOP|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer11->Add(BoxSizer12, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer11->Add(-1,-1,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer11, 0, wxTOP|wxLEFT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer19 = new wxBoxSizer(wxHORIZONTAL); BoxSizer19->Add(75,20,0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText7 = new wxStaticText(this, ID_STATICTEXT7, _("bold"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT7")); StaticText7->Disable(); wxFont StaticText7Font(8,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Arial"),wxFONTENCODING_DEFAULT); StaticText7->SetFont(StaticText7Font); BoxSizer19->Add(StaticText7, 0, wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticText8 = new wxStaticText(this, ID_STATICTEXT8, _("= required"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT8")); StaticText8->Disable(); BoxSizer19->Add(StaticText8, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer19, 0, wxLEFT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); SetSizer(BoxSizer1); DirDialog1 = new wxDirDialog(this, _("Select directory"), wxEmptyString, wxDD_DEFAULT_STYLE, wxDefaultPosition, wxDefaultSize, _T("wxDirDialog")); FileDialog1 = new wxFileDialog(this, wxEmptyString, wxEmptyString, wxEmptyString, _("Application files (*.exe)|*.exe"), wxFD_DEFAULT_STYLE|wxFD_OPEN|wxFD_FILE_MUST_EXIST, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog")); FileDialog2 = new wxFileDialog(this, wxEmptyString, wxEmptyString, wxEmptyString, _("All Files|*.*"), wxFD_DEFAULT_STYLE|wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog")); SetSizer(BoxSizer1); Layout(); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ApplicationFiles::OnbtnMainExeClick); Connect(ID_CHECKBOX2,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&ApplicationFiles::OncbDoesntHaveMainClick); Connect(ID_LISTBOX1,wxEVT_COMMAND_LISTBOX_SELECTED,(wxObjectEventFunction)&ApplicationFiles::OnlbFilesSelect); Connect(ID_LISTBOX1,wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,(wxObjectEventFunction)&ApplicationFiles::OnbtnEditClick); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ApplicationFiles::OnbtnFilesClick); Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ApplicationFiles::OnbtnFolderClick); Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ApplicationFiles::OnbtnEditClick); Connect(ID_BUTTON5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ApplicationFiles::OnbtnRemoveClick); //*) SetSize( wxSize(480,320)); txtMainExe->SetValue(Manager::Get()->GetProjectManager()->GetActiveProject()->GetOutputFilename()); }
void PreviewWindow::DrawPath(wxDC& dc) { wxColour cw = cCWColour; wxColour ccw = cCCWColour; for_each(toDraw.begin(), toDraw.end(), [&](PathPartSimple p) { switch(p.type) { case LINE_NORMAL: { dc.SetPen(wxPen(normalColour, lineWidth, wxSOLID)); p.start = TransformPoint(p.start); p.end = TransformPoint(p.end); dc.DrawLine(p.start.x, p.start.y, p.end.x, p.end.y); } break; case LINE_RAPID: { dc.SetPen(wxPen(rapidColour, lineWidth, wxLONG_DASH)); p.start = TransformPoint(p.start); p.end = TransformPoint(p.end); dc.DrawLine(p.start.x, p.start.y, p.end.x, p.end.y); } break; case CIRCLE_CW: { cw.Set(255-cw.Red(), cw.Green(), cw.Blue());//Differes two circles dc.SetPen(wxPen(cw, lineWidth, wxSOLID)); p.start = TransformPoint(p.start); p.end = TransformPoint(p.end); p.center = TransformPoint(p.center); dc.SetBrush(wxBrush(wxColour(), wxTRANSPARENT)); Vector2D distance(p.start, p.end); if(distance.Length() < 2) break; distance = Vector2D(p.center, p.start); if(distance.Length() < 2) break; dc.DrawArc(p.start.x, p.start.y, p.end.x, p.end.y, p.center.x, p.center.y); } break; case CIRCLE_CCW: { ccw.Set(255-ccw.Red(), ccw.Green(), ccw.Blue());//Differes two circles dc.SetPen(wxPen(ccw, lineWidth, wxSOLID)); p.start = TransformPoint(p.start); p.end = TransformPoint(p.end); p.center = TransformPoint(p.center); dc.SetBrush(wxBrush(wxColour(), wxTRANSPARENT)); Vector2D distance(p.start, p.end); if(distance.Length() < 2) break; distance = Vector2D(p.center, p.start); if(distance.Length() < 2) break; dc.DrawArc(p.end.x, p.end.y, p.start.x, p.start.y, p.center.x, p.center.y); } break; } }); for_each(offsetToDraw.begin(), offsetToDraw.end(), [&](PathPartSimple p) { dc.SetPen(wxPen(wxColor(255, 255, 255), lineWidth, wxSOLID)); switch(p.type) { case LINE_NORMAL: { p.start = TransformPoint(p.start); p.end = TransformPoint(p.end); dc.DrawLine(p.start.x, p.start.y, p.end.x, p.end.y); } break; case LINE_RAPID: { dc.SetPen(wxPen(wxColor(255, 255, 255), lineWidth, wxDOT_DASH)); p.start = TransformPoint(p.start); p.end = TransformPoint(p.end); dc.DrawLine(p.start.x, p.start.y, p.end.x, p.end.y); } break; case CIRCLE_CW: case OFFSET_CIRCLE_CW: { static wxColour c = cCWColour; c.Set(255-c.Red(), c.Green(), c.Blue()); p.start = TransformPoint(p.start); p.end = TransformPoint(p.end); p.center = TransformPoint(p.center); dc.SetBrush(wxBrush(wxColour(), wxTRANSPARENT)); Vector2D distance(p.start, p.end); if(distance.Length() < 2) break; distance = Vector2D(p.center, p.start); if(distance.Length() < 2) break; dc.DrawArc(p.start.x, p.start.y, p.end.x, p.end.y, p.center.x, p.center.y); } break; case CIRCLE_CCW: case OFFSET_CIRCLE_CCW: { static wxColour c = cCCWColour; c.Set(255-c.Red(), c.Green(), c.Blue()); p.start = TransformPoint(p.start); p.end = TransformPoint(p.end); p.center = TransformPoint(p.center); dc.SetBrush(wxBrush(wxColour(), wxTRANSPARENT)); Vector2D distance(p.start, p.end); if(distance.Length() < 2) break; distance = Vector2D(p.center, p.start); if(distance.Length() < 2) break; dc.DrawArc(p.end.x, p.end.y, p.start.x, p.start.y, p.center.x, p.center.y); } break; } }); }
// static wxVisualAttributes wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, bool WXUNUSED_IN_GTK3(useBase), int state) { wxVisualAttributes attr; #ifdef __WXGTK3__ GtkStateFlags stateFlag = GTK_STATE_FLAG_NORMAL; if (state) { wxASSERT(state == GTK_STATE_ACTIVE); stateFlag = GTK_STATE_FLAG_ACTIVE; } GtkStyleContext* sc = gtk_widget_get_style_context(widget); GdkRGBA c; gtk_style_context_get_color(sc, stateFlag, &c); attr.colFg = wxColour(c); gtk_style_context_get_background_color(sc, stateFlag, &c); attr.colBg = wxColour(c); wxNativeFontInfo info; info.description = const_cast<PangoFontDescription*>(gtk_style_context_get_font(sc, stateFlag)); attr.font = wxFont(info); info.description = NULL; #else GtkStyle* style; style = gtk_rc_get_style(widget); if (!style) style = gtk_widget_get_default_style(); if (!style) { return wxWindow::GetClassDefaultAttributes(wxWINDOW_VARIANT_NORMAL); } // get the style's colours attr.colFg = wxColour(style->fg[state]); if (useBase) attr.colBg = wxColour(style->base[state]); else attr.colBg = wxColour(style->bg[state]); // get the style's font if ( !style->font_desc ) style = gtk_widget_get_default_style(); if ( style && style->font_desc ) { wxNativeFontInfo info; info.description = style->font_desc; attr.font = wxFont(info); info.description = NULL; } #endif if (!attr.font.IsOk()) { GtkSettings *settings = gtk_settings_get_default(); gchar *font_name = NULL; g_object_get ( settings, "gtk-font-name", &font_name, NULL); if (!font_name) attr.font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); else attr.font = wxFont(wxString::FromAscii(font_name)); g_free (font_name); } return attr; }
bool Edit::InitializePrefs (const wxString &name) { // initialize styles StyleClearAll(); LanguageInfo const* curInfo = NULL; // determine language bool found = false; int languageNr; for (languageNr = 0; languageNr < g_LanguagePrefsSize; languageNr++) { curInfo = &g_LanguagePrefs [languageNr]; if (curInfo->name == name) { found = true; break; } } if (!found) return false; // set lexer and language SetLexer (curInfo->lexer); m_language = curInfo; // set margin for line numbers SetMarginType (m_LineNrID, wxSTC_MARGIN_NUMBER); StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (_T("DARK GREY"))); StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE); SetMarginWidth (m_LineNrID, 0); // start out not visible // default fonts for all styles! int Nr; for (Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++) { wxFont font (10, wxMODERN, wxNORMAL, wxNORMAL); StyleSetFont (Nr, font); } // set common styles StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour (_T("DARK GREY"))); StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour (_T("DARK GREY"))); // initialize settings if (g_CommonPrefs.syntaxEnable) { int keywordnr = 0; for (Nr = 0; Nr < STYLE_TYPES_COUNT; Nr++) { if (curInfo->styles[Nr].type == -1) continue; const StyleInfo &curType = g_StylePrefs [curInfo->styles[Nr].type]; wxFont font (curType.fontsize, wxMODERN, wxNORMAL, wxNORMAL, false, curType.fontname); StyleSetFont (Nr, font); if (curType.foreground) { StyleSetForeground (Nr, wxColour (curType.foreground)); } if (curType.background) { StyleSetBackground (Nr, wxColour (curType.background)); } StyleSetBold (Nr, (curType.fontstyle & mySTC_STYLE_BOLD) > 0); StyleSetItalic (Nr, (curType.fontstyle & mySTC_STYLE_ITALIC) > 0); StyleSetUnderline (Nr, (curType.fontstyle & mySTC_STYLE_UNDERL) > 0); StyleSetVisible (Nr, (curType.fontstyle & mySTC_STYLE_HIDDEN) == 0); StyleSetCase (Nr, curType.lettercase); const wxChar *pwords = curInfo->styles[Nr].words; if (pwords) { SetKeyWords (keywordnr, pwords); keywordnr += 1; } } } // set margin as unused SetMarginType (m_DividerID, wxSTC_MARGIN_SYMBOL); SetMarginWidth (m_DividerID, 0); SetMarginSensitive (m_DividerID, false); // folding SetMarginType (m_FoldingID, wxSTC_MARGIN_SYMBOL); SetMarginMask (m_FoldingID, wxSTC_MASK_FOLDERS); StyleSetBackground (m_FoldingID, *wxWHITE); SetMarginWidth (m_FoldingID, 0); SetMarginSensitive (m_FoldingID, false); if (g_CommonPrefs.foldEnable) { SetMarginWidth (m_FoldingID, curInfo->folds != 0? m_FoldingMargin: 0); SetMarginSensitive (m_FoldingID, curInfo->folds != 0); SetProperty (_T("fold"), curInfo->folds != 0? _T("1"): _T("0")); SetProperty (_T("fold.comment"), (curInfo->folds & mySTC_FOLD_COMMENT) > 0? _T("1"): _T("0")); SetProperty (_T("fold.compact"), (curInfo->folds & mySTC_FOLD_COMPACT) > 0? _T("1"): _T("0")); SetProperty (_T("fold.preprocessor"), (curInfo->folds & mySTC_FOLD_PREPROC) > 0? _T("1"): _T("0")); SetProperty (_T("fold.html"), (curInfo->folds & mySTC_FOLD_HTML) > 0? _T("1"): _T("0")); SetProperty (_T("fold.html.preprocessor"), (curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? _T("1"): _T("0")); SetProperty (_T("fold.comment.python"), (curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? _T("1"): _T("0")); SetProperty (_T("fold.quotes.python"), (curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? _T("1"): _T("0")); } SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED | wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED); // set spaces and indention SetTabWidth (4); SetUseTabs (false); SetTabIndents (true); SetBackSpaceUnIndents (true); SetIndent (g_CommonPrefs.indentEnable? 4: 0); // others SetViewEOL (g_CommonPrefs.displayEOLEnable); SetIndentationGuides (g_CommonPrefs.indentGuideEnable); SetEdgeColumn (80); SetEdgeMode (g_CommonPrefs.longLineOnEnable? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE); SetViewWhiteSpace (g_CommonPrefs.whiteSpaceEnable? wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE); SetOvertype (g_CommonPrefs.overTypeInitial); SetReadOnly (g_CommonPrefs.readOnlyInitial); SetWrapMode (g_CommonPrefs.wrapModeInitial? wxSTC_WRAP_WORD: wxSTC_WRAP_NONE); return true; }
double y = get_y_position(value, di); double ret = h - y * h + m_screen_margins.topmargin; if (ret < m_screen_margins.topmargin) ret = m_screen_margins.topmargin; if (ret > h + m_screen_margins.topmargin) ret = h + m_screen_margins.topmargin; return ret; } const wxColour GCDCGraphs::back1_col = wxColour(128, 128, 128); const wxColour GCDCGraphs::back2_col = wxColour(0, 0, 0); void GCDCGraphs::DrawBackground(wxGraphicsContext &dc) { int w, h; GetClientSize(&w, &h); PeriodType pt = m_draws_wdg->GetSelectedDraw()->GetPeriod(); size_t pc = m_draws_wdg->GetSelectedDraw()->GetValuesTable().size(); dc.SetBrush(wxBrush(back2_col, wxSOLID)); dc.DrawRectangle(0, 0, w, h); size_t i = 0; int c = 1; double x = m_screen_margins.leftmargin + 1;
WxIrrMainWindow::WxIrrMainWindow(const wxString& title, void (*draw)(WxIrrViewportManager*), void (*update)(void), bool (*irrlichtLeftMouseDown)(bool controlDown, bool shiftDown, int x, int y), bool (*irrlichtLeftMouseUp)(bool controlDown, bool shiftDown, int x, int y), bool (*irrlichtLeftMouseDoubleClick)(bool controlDown, bool shiftDown, int x, int y), bool (*irrlichtMouseMove)(bool controlDown, bool shiftDown, int x, int y, int moveX, int moveY), void (*irrlichtCameraMouseMove)(int moveX, int moveY, WxIrrViewport* selectedViewport), void (*irrlichtCameraKeyDown)(int id, WxIrrViewport* selectedViewport), void (*irrlichtCameraKeyUp)(int id), void (*irrlichtCameraKeyboardReset)(void), void (*simulationMouseMove)(wxPoint mousePos, bool isShiftDown, WxIrrViewport* mouseOverViewport), bool (*simulationMouseClick)(bool isShiftDown, bool isControlDown), bool (*simulationMouseDoubleClick)(void), void (*SimulationStartMouseChecking)(void), void (*onSimulationShowAxesFunctionPointer)(bool), void (*onSimulationShowObjectNameFunctionPointer)(bool), SColor (*onSimulationXAxisGetColorFunctionPointer)(void), SColor (*onSimulationYAxisGetColorFunctionPointer)(void), SColor (*onSimulationZAxisGetColorFunctionPointer)(void), void (*onSimulationXAxisChangeColorFunctionPointer)(wxColour& color), void (*onSimulationYAxisChangeColorFunctionPointer)(wxColour& color), void (*onSimulationZAxisChangeColorFunctionPointer)(wxColour& color), void (*onSimulationShowXYGridFunctionPointer)(bool), void (*onSimulationShowXZGridFunctionPointer)(bool), void (*onSimulationShowYZGridFunctionPointer)(bool)) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(800, 600)) { OnSimulationShowAxesFunctionPointer = onSimulationShowAxesFunctionPointer; OnSimulationShowObjectNameFunctionPointer = onSimulationShowObjectNameFunctionPointer; OnSimulationXAxisGetColorFunctionPointer = onSimulationXAxisGetColorFunctionPointer; OnSimulationYAxisGetColorFunctionPointer = onSimulationYAxisGetColorFunctionPointer; OnSimulationZAxisGetColorFunctionPointer = onSimulationZAxisGetColorFunctionPointer; OnSimulationXAxisChangeColorFunctionPointer = onSimulationXAxisChangeColorFunctionPointer; OnSimulationYAxisChangeColorFunctionPointer = onSimulationYAxisChangeColorFunctionPointer; OnSimulationZAxisChangeColorFunctionPointer = onSimulationZAxisChangeColorFunctionPointer; OnSimulationShowXYGridFunctionPointer = onSimulationShowXYGridFunctionPointer; OnSimulationShowXZGridFunctionPointer = onSimulationShowXZGridFunctionPointer; OnSimulationShowYZGridFunctionPointer = onSimulationShowYZGridFunctionPointer; leftPanel = new WxIrrViewportWindow(this, 1000); leftPanel->SetBackgroundColour(wxColour(wxT("Black"))); irr::SIrrlichtCreationParameters param; #if defined _WX_IRR_WINDOWS param.DriverType = EDT_DIRECT3D9; param.AntiAlias = false; param.WindowId = reinterpret_cast<void*>(GetLeftPanelHandle()); #elif defined _WX_IRR_LINUX param.DriverType = EDT_OPENGL; param.AntiAlias = false; GtkWidget* handle = (GtkWidget*)GetLeftPanelHandle(); gtk_widget_realize(handle); Window xHandle = GDK_WINDOW_XWINDOW(handle->window); param.WindowId = (void*)(xHandle); #elif defined _WX_IRR_MACOS //param.DriverType = EDT_OPENGL; #else //return false; Close(); #endif leftPanel->InitalizeViewportManager(); SetupDevice(param, draw, update, irrlichtLeftMouseDown, irrlichtLeftMouseUp, irrlichtLeftMouseDoubleClick, irrlichtMouseMove, irrlichtCameraMouseMove, irrlichtCameraKeyDown, irrlichtCameraKeyUp, irrlichtCameraKeyboardReset, simulationMouseMove, simulationMouseClick, simulationMouseDoubleClick, SimulationStartMouseChecking); //Main camera ICameraSceneNode* camera = GetDevice()->getSceneManager()->addCameraSceneNode(); camera->setPosition(Vector3(30,-10,30)); //camera->bindTargetAndRotation(true); //camera->setTarget(Vector3(0,0,0)); Vector3 currentCameraRot = camera->getRotation(); Vector3 rot = currentCameraRot.rotationToDirection(); Vector3 pos = camera->getPosition(); camera->setTarget(rot + pos); camera->setFarValue(100000); SetCamera(camera); rightPanel = new SimulationPanel(this, 1001, wxDefaultPosition, wxDefaultSize); rightPanel->SetBackgroundColour(wxColour(wxT("Black"))); m_mgr.SetManagedWindow(this); //Create Main Menu menuBar = new wxMenuBar(); menuBarManager = new PhysicsHelperMenuBar(menuBar); SetMenuBar( menuBar ); //Status bar CreateStatusBar(); SetStatusText( wxT("PhysicsHelper") ); statusBarText = wxT("PhysicsHelper"); toolBarsManager = new PhysicsHelperToolbars(this, m_mgr); //add the normal panes m_mgr.AddPane(leftPanel, wxAuiPaneInfo().CenterPane().Name(wxT("leftPanel"))); m_mgr.AddPane(rightPanel, wxAuiPaneInfo().CloseButton(false).Right().PinButton(true).MinimizeButton(true).Name(wxT("rightPanel"))); m_mgr.Update(); //Centre(); }
void ocpnDC::DrawText( const wxString &text, wxCoord x, wxCoord y ) { if( dc ) dc->DrawText( text, x, y ); #ifdef ocpnUSE_GL else { wxCoord w = 0; wxCoord h = 0; #ifndef __WXMAC__ m_texfont.Build( m_font ); // make sure the font is ready m_texfont.GetTextExtent(text, &w, &h); if( w && h ) { glEnable( GL_BLEND ); glEnable( GL_TEXTURE_2D ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); glPushMatrix(); glTranslatef(x, y, 0); glColor3ub( m_textforegroundcolour.Red(), m_textforegroundcolour.Green(), m_textforegroundcolour.Blue() ); m_texfont.RenderString(text); glPopMatrix(); glDisable( GL_TEXTURE_2D ); glDisable( GL_BLEND ); } #else wxScreenDC sdc; sdc.GetTextExtent(text, &w, &h, NULL, NULL, &m_font); /* create bitmap of appropriate size and select it */ wxBitmap bmp( w, h ); wxMemoryDC temp_dc; temp_dc.SelectObject( bmp ); /* fill bitmap with black */ temp_dc.SetBackground( wxBrush( wxColour( 0, 0, 0 ) ) ); temp_dc.Clear(); /* draw the text white */ temp_dc.SetFont( m_font ); temp_dc.SetTextForeground( wxColour( 255, 255, 255 ) ); temp_dc.DrawText( text, 0, 0 ); temp_dc.SelectObject( wxNullBitmap ); /* use the data in the bitmap for alpha channel, and set the color to text foreground */ wxImage image = bmp.ConvertToImage(); if( x < 0 || y < 0 ) { // Allow Drawing text which is offset to start off screen int dx = ( x < 0 ? -x : 0 ); int dy = ( y < 0 ? -y : 0 ); w = bmp.GetWidth() - dx; h = bmp.GetHeight() - dy; /* picture is out of viewport */ if( w <= 0 || h <= 0 ) return; image = image.GetSubImage( wxRect( dx, dy, w, h ) ); x += dx; y += dy; } unsigned char *data = new unsigned char[w * h]; unsigned char *im = image.GetData(); if(im){ for( int i = 0; i < w * h; i++ ) data[i] = im[3 * i]; } glColor4ub( m_textforegroundcolour.Red(), m_textforegroundcolour.Green(), m_textforegroundcolour.Blue(), 255 ); GLDrawBlendData( x, y, w, h, GL_ALPHA, data ); delete[] data; #endif } #endif }
wxAuiDefaultDockArt::wxAuiDefaultDockArt() { #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON wxColor base_colour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); #else wxColor base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); #endif // the base_colour is too pale to use as our base colour, // so darken it a bit -- if ((255-base_colour.Red()) + (255-base_colour.Green()) + (255-base_colour.Blue()) < 60) { base_colour = base_colour.ChangeLightness(92); } m_base_colour = base_colour; wxColor darker1_colour = base_colour.ChangeLightness(85); wxColor darker2_colour = base_colour.ChangeLightness(75); wxColor darker3_colour = base_colour.ChangeLightness(60); //wxColor darker4_colour = base_colour.ChangeLightness(50); wxColor darker5_colour = base_colour.ChangeLightness(40); m_active_caption_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); m_active_caption_gradient_colour = wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); m_active_caption_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); m_inactive_caption_colour = darker1_colour; m_inactive_caption_gradient_colour = base_colour.ChangeLightness(97); m_inactive_caption_text_colour = *wxBLACK; m_sash_brush = wxBrush(base_colour); m_background_brush = wxBrush(base_colour); m_gripper_brush = wxBrush(base_colour); m_border_pen = wxPen(darker2_colour); m_gripper_pen1 = wxPen(darker5_colour); m_gripper_pen2 = wxPen(darker3_colour); m_gripper_pen3 = *wxWHITE_PEN; #ifdef __WXMAC__ m_caption_font = *wxSMALL_FONT; #else m_caption_font = wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE); #endif // default metric values #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON SInt32 height; GetThemeMetric( kThemeMetricSmallPaneSplitterHeight , &height ); m_sash_size = height; #elif defined(__WXGTK__) m_sash_size = wxRendererNative::Get().GetSplitterParams(NULL).widthSash; #else m_sash_size = 4; #endif m_caption_size = 17; m_border_size = 1; m_button_size = 14; m_gripper_size = 9; m_gradient_type = wxAUI_GRADIENT_VERTICAL; InitBitmaps(); }
Launcher::Launcher(wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxPanel(parent, id, pos, size, style) { nsd_pid_=0; nsd_started_ = false; hf_pid_ = 0; hf_started_ = false; assf_pid_ = 0; assf_started_ = false; sa_pid_ = 0; sa_started_ = false; ci_pid_ = 0; ci_started_ = false; wxBoxSizer *sizerLauncher = new wxBoxSizer(wxVERTICAL); this->SetSizer(sizerLauncher); this->SetAutoLayout(TRUE); //spacer sizerLauncher->Add(5, 5, 0, wxGROW | wxALL, 5); // static text wxStaticText* domain_text = new wxStaticText( this, wxID_STATIC, _T("Launching Deamons for the whole Domain"), wxDefaultPosition, wxDefaultSize, 0 ); sizerLauncher->Add(domain_text , 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); // Name Service wxStaticBox *nsbox = new wxStaticBox(this, -1, _T("&Name Service")); wxStaticBoxSizer *h_NSD_sizer = new wxStaticBoxSizer(nsbox,wxHORIZONTAL); sizerLauncher->Add(h_NSD_sizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5); NSDStartBtn = new wxButton(this, NSD, _T("Start")); NSDStartBtn -> SetBackgroundColour(wxColour(255, 0, 0)); h_NSD_sizer-> Add(NSDStartBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); /* wxStaticText* hostname_text = new wxStaticText( this, wxID_STATIC, _T("on Hostname or IP:"), wxDefaultPosition, wxDefaultSize, 0 ); h_NSD_sizer->Add(hostname_text , 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); host_name_nsd_ = new wxTextCtrl( this, ID_HOSTNAME_NSD, _T("localhost"), wxDefaultPosition, wxDefaultSize, 0 ); h_NSD_sizer->Add(host_name_nsd_, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxStaticText* port_text = new wxStaticText( this, wxID_STATIC, _T("Port Number:"), wxDefaultPosition, wxDefaultSize, 0 ); h_NSD_sizer->Add(port_text , 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); */ port_number_ = new wxTextCtrl( this, ID_PORTNUMBER, _T("12356"), wxDefaultPosition, wxDefaultSize, 0 ); h_NSD_sizer->Add(port_number_, 0, wxALIGN_CENTER_VERTICAL|wxALL,5); // HomeFinder wxStaticBox *hfbox = new wxStaticBox(this, -1, _T("&Home Finder")); wxStaticBoxSizer *h_HF_sizer = new wxStaticBoxSizer(hfbox,wxHORIZONTAL); sizerLauncher->Add(h_HF_sizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5); HFStartBtn = new wxButton(this, HF, _T("Start")); HFStartBtn -> SetBackgroundColour(wxColour(255, 0, 0)); h_HF_sizer-> Add(HFStartBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); // AssemblyFactory wxStaticBox *assfbox = new wxStaticBox(this, -1, _T("&Assembly Factory")); wxStaticBoxSizer *h_ASSF_sizer = new wxStaticBoxSizer(assfbox,wxHORIZONTAL); sizerLauncher->Add(h_ASSF_sizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5); ASSFStartBtn = new wxButton(this, ASSF, _T("Start")); ASSFStartBtn -> SetBackgroundColour(wxColour(255, 0, 0)); h_ASSF_sizer-> Add(ASSFStartBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); // line // wxStaticLine* line = new wxStaticLine(this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL, "Node Launcher" ); // sizerLauncher->Add(line , 0, wxGROW|wxALL, 5); // spacer sizerLauncher->Add(5, 10, 0, wxGROW | wxALL, 5); // static text wxStaticText* node_text = new wxStaticText( this, wxID_STATIC, _T("Launching Deamons for this Node "), wxDefaultPosition, wxDefaultSize, 0 ); sizerLauncher->Add(node_text , 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); //Server Activator wxStaticBox *sabox = new wxStaticBox(this, -1, _T("&Server Activator")); wxStaticBoxSizer *h_SA_sizer = new wxStaticBoxSizer(sabox,wxHORIZONTAL); sizerLauncher->Add(h_SA_sizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5); SAStartBtn = new wxButton(this, SA, _T("Start")); SAStartBtn -> SetBackgroundColour(wxColour(255, 0, 0)); h_SA_sizer-> Add(SAStartBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); // Component Installation wxStaticBox *cibox = new wxStaticBox(this, -1, _T("&Component Installation")); wxStaticBoxSizer *h_CI_sizer = new wxStaticBoxSizer(cibox,wxHORIZONTAL); sizerLauncher->Add(h_CI_sizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5); CIStartBtn = new wxButton(this, CI, _T("Start")); CIStartBtn -> SetBackgroundColour(wxColour(255, 0, 0)); h_CI_sizer-> Add(CIStartBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); }
void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) { wxStyledTextCtrl::Create(parent, id , pos, size, style); // Clear all styles StyleClearAll(); // Font extern sysSettings *settings; wxFont fntSQLBox = settings->GetSQLFont(); wxColour bgColor = settings->GetSQLBoxColourBackground(); if (settings->GetSQLBoxUseSystemBackground()) { bgColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); } wxColour frColor = settings->GetSQLBoxColourForeground(); if (settings->GetSQLBoxUseSystemForeground()) { frColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); } StyleSetBackground(wxSTC_STYLE_DEFAULT, bgColor); StyleSetForeground(wxSTC_STYLE_DEFAULT, frColor); StyleSetFont(wxSTC_STYLE_DEFAULT, fntSQLBox); SetSelBackground(true, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); SetSelForeground(true, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)); SetCaretForeground(settings->GetSQLColourCaret()); SetMarginWidth(1, 0); SetTabWidth(settings->GetIndentSpaces()); SetUseTabs(!settings->GetSpacesForTabs()); // Setup the different highlight colurs for (int i = 0; i < 34; ++ i ) { if (i > 0 && i < 12) StyleSetForeground(i, settings->GetSQLBoxColour(i)); else StyleSetForeground(i, frColor); StyleSetBackground(i, bgColor); StyleSetFont(i, fntSQLBox); } // Keywords in uppercase? if (settings->GetSQLKeywordsInUppercase()) StyleSetCase(5, wxSTC_CASE_UPPER); // Margin style StyleSetBackground(wxSTC_STYLE_LINENUMBER, settings->GetSQLMarginBackgroundColour()); // Brace maching styles StyleSetBackground(34, wxColour(0x99, 0xF9, 0xFF)); StyleSetBackground(35, wxColour(0xFF, 0xCF, 0x27)); StyleSetFont(34, fntSQLBox); StyleSetFont(35, fntSQLBox); // SQL Lexer and keywords. if (sqlKeywords.IsEmpty()) FillKeywords(sqlKeywords); SetLexer(wxSTC_LEX_SQL); SetKeyWords(0, sqlKeywords + plpgsqlKeywords + ftsKeywords + pgscriptKeywords); // Enable folding SetMarginSensitive(2, true); SetMarginType(2, wxSTC_MARGIN_SYMBOL); // margin 2 for symbols SetMarginMask(2, wxSTC_MASK_FOLDERS); // set up mask for folding symbols SetMarginSensitive(2, true); // this one needs to be mouse-aware SetMarginWidth(2, 16); // set margin 2 16 px wide MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, *wxWHITE, *wxBLACK); SetProperty(wxT("fold"), wxT("1")); SetFoldFlags(16); // Setup accelerators wxAcceleratorEntry entries[2]; entries[0].Set(wxACCEL_CTRL, (int)'F', MNU_FIND); entries[1].Set(wxACCEL_CTRL, (int)' ', MNU_AUTOCOMPLETE); wxAcceleratorTable accel(2, entries); SetAcceleratorTable(accel); // Autocompletion configuration AutoCompSetSeparator('\t'); AutoCompSetChooseSingle(true); AutoCompSetIgnoreCase(true); AutoCompSetFillUps(wxT(" \t")); AutoCompSetDropRestOfWord(true); SetEOLMode(settings->GetLineEndingType()); }
void AnnotateCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc(this); PrepareDC(dc); if (!myAnnotations || !myNumLinesTotal) return; int width; int height; GetClientSize(&width, &height); float lineHeight = float(height) / float(myNumLinesTotal); unsigned int startLine = 0; unsigned int endLine = 0; wxColour blockColor(*((wxColour*)(*myAnnotations)[startLine]->Data())); for (unsigned int i = 1; i < myAnnotations->AnnotationCount(); ++i) { bool lastLine = (i == (myNumLinesTotal - 1)); // We are currently in a run of lines, and this line also matches the block color // Adjust the ending line of the block and continue processing lines. if (blockColor == *((wxColour*)(*myAnnotations)[i]->Data()) && !lastLine) endLine = i; // We had a run of lines that has now ended, we need to draw the colored rect // for this block, and then continue processing lines. else if (blockColor != *((wxColour*)(*myAnnotations)[i]->Data()) || lastLine) { if (lastLine) endLine = i; wxCoord yCoord = (wxCoord) (startLine * lineHeight); wxCoord height = (wxCoord) ((endLine + 1 - startLine) * lineHeight); bool isDefault = (blockColor == wxNullColour); wxBrush brush; wxPen pen; // Set the brush if (isDefault) brush = *wxTRANSPARENT_BRUSH; else brush = wxBrush(blockColor, wxSOLID); dc.SetBrush(brush); // Set the pen if (isDefault) pen = *wxTRANSPARENT_PEN; else if (myHighlightType == HIGHLIGHT_BY_AGE_FIXED || myHighlightType == HIGHLIGHT_BY_AGE_SCALED) pen = wxPen(blockColor, 1, wxSOLID); else pen = wxPen(wxColour(0x00, 0x00, 0x00), 1, wxSOLID); dc.SetPen(pen); dc.DrawRectangle(0, yCoord, 10, height); // Set up the next block blockColor = *((wxColour*)(*myAnnotations)[i]->Data()); startLine = endLine = i; } } // Draw a border rect for the age types if (myHighlightType == HIGHLIGHT_BY_AGE_FIXED || myHighlightType == HIGHLIGHT_BY_AGE_SCALED) { dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetPen(wxPen(wxColour(0x00,0x00,0x00), 1, wxSOLID)); dc.DrawRectangle(0, 0, width, height); } }
Theme& Theme::loadFloor(const int i, unsigned long colour){ _floors[i] = wxColour(colour); return *this; }
void wxGenericColour::Set( const wxString& colourName ) { wxCHECK_RET(Ok(), wxT("Invalid generic colour")); Set(wxColour(colourName)); }
//-------------------------------------------------------------------------- // void wxPLDevDC::SetWidth( PLStream *pls ) // // Set the width of the drawing pen. //-------------------------------------------------------------------------- void wxPLDevDC::SetWidth( PLStream *pls ) { m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ), pls->width > 0 ? pls->width : 1, wxSOLID ) ) ); }
wxColour wxTreeCtrl::GetItemTextColour(const wxTreeItemId& item) const { return wxColour(); }
//-------------------------------------------------------------------------- // void wxPLDevDC::ProcessString( PLStream* pls, EscText* args ) // // This is the main function which processes the unicode text strings. // Font size, rotation and color are set, width and height of the // text string is determined and then the string is drawn to the canvas. //-------------------------------------------------------------------------- void wxPLDevDC::ProcessString( PLStream* pls, EscText* args ) { // Check that we got unicode, warning message and return if not if ( args->unicode_array_len == 0 ) { printf( "Non unicode string passed to the wxWidgets driver, ignoring\n" ); return; } // Check that unicode string isn't longer then the max we allow if ( args->unicode_array_len >= 500 ) { printf( "Sorry, the wxWidgets drivers only handles strings of length < %d\n", 500 ); return; } // Calculate the font size (in pixels) fontSize = pls->chrht * VIRTUAL_PIXELS_PER_MM / scaley * 1.3; // Use PLplot core routine to get the corners of the clipping rectangle PLINT rcx[4], rcy[4]; difilt_clip( rcx, rcy ); wxPoint cpoints[4]; for ( int i = 0; i < 4; i++ ) { cpoints[i].x = rcx[i] / scalex; cpoints[i].y = height - rcy[i] / scaley; } wxDCClipper clip( *m_dc, wxRegion( 4, cpoints ) ); // calculate rotation of text plRotationShear( args->xform, &rotation, &shear, &stride ); rotation -= pls->diorot * M_PI / 2.0; cos_rot = cos( rotation ); sin_rot = sin( rotation ); // Set font color m_dc->SetTextForeground( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ) ); m_dc->SetTextBackground( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ) ); PLUNICODE *lineStart = args->unicode_array; int lineLen = 0; bool lineFeed = false; bool carriageReturn = false; wxCoord paraHeight = 0; // Get the curent font fontScale = 1.0; yOffset = 0.0; plgfci( &fci ); PSSetFont( fci ); while ( lineStart != args->unicode_array + args->unicode_array_len ) { while ( lineStart + lineLen != args->unicode_array + args->unicode_array_len && *( lineStart + lineLen ) != (PLUNICODE) '\n' ) { lineLen++; } //set line feed for the beginning of this line and //carriage return for the end lineFeed = carriageReturn; carriageReturn = lineStart + lineLen != args->unicode_array + args->unicode_array_len && *( lineStart + lineLen ) == (PLUNICODE) ( '\n' ); if ( lineFeed ) paraHeight += textHeight + subscriptDepth; //remember the text parameters so they can be restored double startingFontScale = fontScale; double startingYOffset = yOffset; PLUNICODE startingFci = fci; // determine extent of text posX = args->x / scalex; posY = args->y / scaley; PSDrawText( lineStart, lineLen, false ); if ( lineFeed && superscriptHeight > textHeight ) paraHeight += superscriptHeight - textHeight; // actually draw text, resetting the font first fontScale = startingFontScale; yOffset = startingYOffset; fci = startingFci; PSSetFont( fci ); posX = (PLINT) ( args->x / scalex - ( args->just * textWidth ) * cos_rot - ( 0.5 * textHeight - paraHeight * lineSpacing ) * sin_rot ); //move to set alignment posY = (PLINT) ( args->y / scaley - ( args->just * textWidth ) * sin_rot + ( 0.5 * textHeight - paraHeight * lineSpacing ) * cos_rot ); PSDrawText( lineStart, lineLen, true ); //draw text lineStart += lineLen; if ( carriageReturn ) lineStart++; lineLen = 0; } //posX = args->x; //posY = args->y; //PSDrawText( args->unicode_array, args->unicode_array_len, false ); //posX = (PLINT) ( args->x - ( ( args->just * textWidth ) * cos_rot + ( 0.5 * textHeight ) * sin_rot ) * scalex ); //posY = (PLINT) ( args->y - ( ( args->just * textWidth ) * sin_rot - ( 0.5 * textHeight ) * cos_rot ) * scaley ); //PSDrawText( args->unicode_array, args->unicode_array_len, true ); AddtoClipRegion( 0, 0, width, height ); }
wxColour wxTreeCtrl::GetItemBackgroundColour(const wxTreeItemId& item) const { return wxColour(); }
void EditorColourSet::Apply(HighlightLanguage lang, cbStyledTextCtrl* control) { if (!control) return; control->StyleClearAll(); if (lang == HL_NONE) return; // first load the default colours to all styles used by the actual lexer (ignoring some built-in styles) OptionColour* defaults = GetOptionByName(lang, _T("Default")); OptionSet& mset = m_Sets[lang]; control->SetLexer(mset.m_Lexers); control->SetStyleBits(control->GetStyleBitsNeeded()); if (defaults) { int countStyles = 1 << control->GetStyleBits(); // walk until countStyles, otherwise the background-colour is only set for characters, // not for empty background for (int i = 0; i <= countStyles; ++i) { if (i < 33 || (i > 39 && i < wxSCI_STYLE_MAX)) DoApplyStyle(control, i, defaults); } } // for some strange reason, when switching styles, the line numbering changes colour // too, though we didn't ask it to... // this makes sure it stays the correct colour control->StyleSetForeground(wxSCI_STYLE_LINENUMBER, wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT)); for (unsigned int i = 0; i < mset.m_Colours.GetCount(); ++i) { OptionColour* opt = mset.m_Colours.Item(i); if (opt->isStyle) { DoApplyStyle(control, opt->value, opt); } else { if (opt->value == cbHIGHLIGHT_LINE) { control->SetCaretLineBackground(opt->back); Manager::Get()->GetConfigManager(_T("editor"))->Write(_T("/highlight_caret_line_colour"), opt->back); } else if (opt->value == cbSELECTION) { if (opt->back != wxNullColour) { control->SetSelBackground(true, opt->back); // Manager::Get()->GetConfigManager(_T("editor"))->Write(_T("/selection_colour"), opt->back); } else control->SetSelBackground(false, wxColour(0xC0, 0xC0, 0xC0)); if (opt->fore != wxNullColour) { control->SetSelForeground(true, opt->fore); // Manager::Get()->GetConfigManager(_T("editor"))->Write(_T("/selection_fgcolour"), opt->fore); } else control->SetSelForeground(false, *wxBLACK); } // else // { // control->MarkerDefine(-opt->value, 1); // control->MarkerSetBackground(-opt->value, opt->back); // } } } for (int i = 0; i <= wxSCI_KEYWORDSET_MAX; ++i) { control->SetKeyWords(i, mset.m_Keywords[i]); } control->Colourise(0, -1); // the *most* important part! }
wxColor CamArtProvider::LightenColour(const wxColor& c, INT32 amount) { INT32 r = 255-c.Red(), g = 255-c.Green(), b = 255-c.Blue(); return wxColour(255-(r*amount)/100, 255-(g*amount)/100, 255-(b*amount)/100); }