📄 propertywin.cpp
字号:
//####COPYRIGHTBEGIN####//// ----------------------------------------------------------------------------// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.//// This program is part of the eCos host tools.//// This program is free software; you can redistribute it and/or modify it// under the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 of the License, or (at your option)// any later version.//// This program is distributed in the hope that it will be useful, but WITHOUT// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for// more details.//// You should have received a copy of the GNU General Public License along with// this program; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.//// ----------------------------------------------------------------------------////####COPYRIGHTEND####// propertywin.cpp :////===========================================================================//#####DESCRIPTIONBEGIN####//// Author(s): julians// Contact(s): julians// Date: 2000/09/04// Version: $Id: propertywin.cpp,v 1.7 2001/04/24 14:39:13 julians Exp $// Purpose:// Description: Implementation file for ecPropertyListCtrl// Requires:// Provides:// See also:// Known bugs:// Usage:////####DESCRIPTIONEND####////===========================================================================// ============================================================================// declarations// ============================================================================// ----------------------------------------------------------------------------// headers// ----------------------------------------------------------------------------#ifdef __GNUG__ #pragma implementation "propertywin.h"#endif// Includes other headers for precompiled compilation#include "ecpch.h"#ifdef __BORLANDC__ #pragma hdrstop#endif#include "propertywin.h"#include "configtool.h"#include "configitem.h"#include "configtooldoc.h"#include "ecutils.h"// specify the CDL properties which are to be visible in the properties viewconst std::string ecPropertyListCtrl::visible_properties [] ={ CdlPropertyId_ActiveIf, CdlPropertyId_BuildProc, CdlPropertyId_Calculated, CdlPropertyId_CancelProc, CdlPropertyId_CheckProc, CdlPropertyId_Compile, CdlPropertyId_ConfirmProc, CdlPropertyId_DecorationProc, CdlPropertyId_DefaultValue, CdlPropertyId_Define, CdlPropertyId_DefineHeader, CdlPropertyId_DefineProc,// CdlPropertyId_Description, CdlPropertyId_Dialog,// CdlPropertyId_Display, CdlPropertyId_DisplayProc, CdlPropertyId_Doc, CdlPropertyId_EntryProc, CdlPropertyId_Flavor, CdlPropertyId_DefineFormat, CdlPropertyId_Group, CdlPropertyId_Hardware, CdlPropertyId_IfDefine, CdlPropertyId_Implements, CdlPropertyId_IncludeDir, CdlPropertyId_IncludeFiles, CdlPropertyId_InitProc, CdlPropertyId_InstallProc, CdlPropertyId_LegalValues, CdlPropertyId_Library, CdlPropertyId_LicenseProc, CdlPropertyId_Make, CdlPropertyId_Makefile, CdlPropertyId_MakeObject, CdlPropertyId_NoDefine, CdlPropertyId_Object, CdlPropertyId_Parent, CdlPropertyId_Requires, CdlPropertyId_Screen, CdlPropertyId_Script, CdlPropertyId_UpdateProc, CdlPropertyId_Wizard};const wxChar* ecPropertyListCtrl::sm_fieldTypeImage[ecMAXFIELDTYPE]= {wxT("Type"), wxT("Value"), wxT("Default"), wxT("Macro"), wxT("File"), wxT("URL"), wxT("Enabled")};/* * ecPropertyListCtrl */IMPLEMENT_CLASS(ecPropertyListCtrl, wxListCtrl)BEGIN_EVENT_TABLE(ecPropertyListCtrl, wxListCtrl) EVT_RIGHT_DOWN(ecPropertyListCtrl::OnRightClick) EVT_LEFT_DCLICK(ecPropertyListCtrl::OnDoubleClick)END_EVENT_TABLE()ecPropertyListCtrl::ecPropertyListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt, const wxSize& sz, long style): wxListCtrl(parent, id, pt, sz, style){ if (!wxGetApp().GetSettings().GetWindowSettings().GetUseDefaults() && wxGetApp().GetSettings().GetWindowSettings().GetFont(wxT("Properties")).Ok()) { SetFont(wxGetApp().GetSettings().GetWindowSettings().GetFont(wxT("Properties"))); } m_f[0]=0.25; m_f[1]=0.75; m_pti = NULL; m_nFirstProperty = 0; m_nOnSizeRecursionCount = 0; AddColumns();#if 0 int j; int i = 0; for (j = 0; j < 4; j++) { // Insert some dummy items wxListItem info; info.m_text = _("URL"); info.m_mask = wxLIST_MASK_TEXT ; // | wxLIST_MASK_IMAGE | wxLIST_MASK_DATA; info.m_itemId = i; info.m_image = -1; //info.m_data = (long) doc; long item = InsertItem(info); SetItem(i, 1, _("redirects/interrupts.html")); i ++; info.m_text = _("Enabled"); info.m_mask = wxLIST_MASK_TEXT ; // | wxLIST_MASK_IMAGE | wxLIST_MASK_DATA; info.m_itemId = i; info.m_image = -1; //info.m_data = (long) doc; item = InsertItem(info); SetItem(i, 1, _("True")); i ++; }#endif}void ecPropertyListCtrl::OnRightClick(wxMouseEvent& event){ PopupMenu(wxGetApp().GetWhatsThisMenu(), event.GetX(), event.GetY());}void ecPropertyListCtrl::AddColumns(){ InsertColumn(0, "Property", wxLIST_FORMAT_LEFT, 100); InsertColumn(1, "Value", wxLIST_FORMAT_LEFT, 300);}void ecPropertyListCtrl::Fill(ecConfigItem *pti){ if(NULL==pti){ ClearAll(); AddColumns(); m_nFirstProperty=0; m_pti=NULL; } else /* if(pti!=m_pti) */ { m_pti=pti; m_nMaxValueWidth=0; ecOptionType type=m_pti->GetOptionType(); int i; // Initially flag all items as unnecessary - calls of SetItem or SetProperty will change this for(i=GetItemCount()-1;i>=0;--i){ SetItemData(i,0); } if (m_pti->HasBool () || (ecOptionTypeNone!=type)){ SetItem(ecMacro, m_pti->GetMacro ()); } if (m_pti->HasBool ()){ SetItem(ecEnabled, m_pti->IsEnabled() ? wxT("True") : wxT("False")); } if(!m_pti->GetFilename().IsEmpty()){ SetItem(ecFile, m_pti->GetFilename()); } SetItem(ecURL, m_pti->GetURL()); if (ecOptionTypeNone!=type){ switch(type){ case ecString: SetItem(ecValue, m_pti->StringValue()); SetItem(ecDefaultValue, m_pti->StringDefaultValue()); break; case ecLong:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -