Ejemplo n.º 1
0
/*!
 *
 */
void CNutConfDoc::AddChildItems(NUTCOMPONENT * compo, wxTreeItemId parent)
{
    CConfigTree *treeCtrl = wxGetApp().GetMainFrame()->GetTreeCtrl();

    if(compo) {
        compo = compo->nc_child;
        while (compo) {
            CConfigItem *item = new CConfigItem(NULL, compo);

            wxTreeItemId childId = treeCtrl->AppendItem(parent, wxT(""), -1, -1, new CTreeItemData(item));
            item->SetTreeItem(childId);
            item->UpdateTreeItem(*treeCtrl);
            m_items.Append(item);


            NUTCOMPONENTOPTION *opts = compo->nc_opts;
            while (opts) {
                item = new CConfigItem(item, opts);
                wxTreeItemId optId = treeCtrl->AppendItem(childId, wxT(""), -1, -1, new CTreeItemData(item));
                item->SetTreeItem(optId);
                item->UpdateTreeItem(*treeCtrl);
                m_items.Append(item);
                opts = opts->nco_nxt;
            }

            AddChildItems(compo, childId);
            compo = compo->nc_nxt;
        }
    }
}
Ejemplo n.º 2
0
wxTreeItemId CConfigTree::FindNextItemId(wxTreeItemId treeItemId, const wxString& text,
    bool checkFirst, bool matchCase, bool matchWord)
{
    wxString ctext(text);
    if (!matchCase) {
        ctext.MakeLower();
    }

    wxTreeItemId found;
    wxTreeItemId id;
    wxTreeItemId currentId = treeItemId;
    CConfigItem *item = NULL;
    wxTreeItemIdValue dummy;

    while (currentId.IsOk()) {
        if (checkFirst) {
            CTreeItemData *data = (CTreeItemData *)GetItemData(currentId);
            if (data) {
                if ((item = data->GetConfigItem()) != NULL) {
                    wxString name = item->GetName();
                    wxString brief = item->GetBriefDescription();
                    wxString desc = item->GetDescription();

                    if (!matchCase) {
                        name.MakeLower();
                        brief.MakeLower();
                        desc.MakeLower();
                    }
                    if (CUtils::FindString(name, ctext, matchWord) ||
                        CUtils::FindString(brief, ctext, matchWord) ||
                        CUtils::FindString(desc, ctext, matchWord)) {
                        found = currentId;
                        break;
                    }
                }
            }
        }
        checkFirst = true;

        id = GetFirstChild(currentId, dummy);
        if (!id.IsOk()) {
            id = GetNextSibling(currentId);
            if (!id.IsOk()) {
                wxTreeItemId parentId = currentId;
                do {
                    parentId = GetItemParent(parentId);
                    if (!parentId.IsOk()) {
                        break;
                    }
                    id = GetNextSibling(parentId);
                } while (!id.IsOk());
            }
        }
        currentId = id;
    }
    return found;
}
Ejemplo n.º 3
0
void ecPropertyListCtrl::OnDoubleClick(wxMouseEvent& event)
{
    // Double-clicked the item

    int flags;
    long item = HitTest(event.GetPosition(), flags);
    if (item > -1)
    {
        const wxString strText = wxListCtrlGetItemTextColumn(*this, item,0);
        if(strText == wxT("File")){
            m_pti->ViewHeader();
        } else if (strText == wxT("URL")) {
            m_pti->ViewURL();
        }
    }

    // TODO
#if 0    
    int pos=GetMessagePos();
    CPoint pt(GET_X_LPARAM(pos),GET_Y_LPARAM(pos));
    ScreenToClient(&pt);
    int nItem=HitTest(pt,NULL);
    
    if(GetItemData(nItem)>1){
        // This is a property row
        const CdlGoalExpression goal = dynamic_cast<CdlGoalExpression> ((CdlProperty) GetItemData (nItem));
        if (goal){
            // This is a rule row
            const CdlExpression expression = goal->get_expression ();
            if (1 == expression->references.size ()) // if the property contains a single reference
            {
                // assume that the reference is to another user visible node and try to find it
                std::string macro_name = expression->references [0].get_destination_name ();
                CConfigItem * pItem = CConfigTool::GetConfigToolDoc ()->Find (CString (macro_name.c_str ()));
                if (pItem) // the referenced node was found so select it
                {
                    CConfigTool::GetControlView()->GetTreeCtrl().SelectItem(pItem->HItem());
                }
            }
        }
    } else {
        const CString strText(GetItemText(nItem,0));
        if(strText==FieldTypeImage[File]){
            m_pti->ViewHeader();
        } else if (strText==FieldTypeImage[URL]) {
            m_pti->ViewURL();
        }
    }
#endif
    event.Skip();
}
Ejemplo n.º 4
0
void CPropertiesList::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) 
{

  // Double-clicked the item	
  
  // We do not use the parameters on the OnDblClk handlers in order to preserve compatibility
  // between pre- and post-4.71 comctrl32.dll versions.
  
  int pos=GetMessagePos();
  CPoint pt(GET_X_LPARAM(pos),GET_Y_LPARAM(pos));
  ScreenToClient(&pt);
  int nItem=HitTest(pt,NULL);
  
  if(GetItemData(nItem)>1){
    // This is a property row
    const CdlGoalExpression goal = dynamic_cast<CdlGoalExpression> ((CdlProperty) GetItemData (nItem));
    if (goal){
      // This is a rule row
      const CdlExpression expression = goal->get_expression ();
      if (1 == expression->references.size ()) // if the property contains a single reference
      {
        // assume that the reference is to another user visible node and try to find it
        std::string macro_name = expression->references [0].get_destination_name ();
        CConfigItem * pItem = CConfigTool::GetConfigToolDoc ()->Find (CString (macro_name.c_str ()));
        if (pItem) // the referenced node was found so select it
        {
          CConfigTool::GetControlView()->GetTreeCtrl().SelectItem(pItem->HItem());
        }
      }
    }
  } else {
    const CString strText(GetItemText(nItem,0));
    if(strText==FieldTypeImage[File]){
      m_pti->ViewHeader();
    } else if (strText==FieldTypeImage[URL]) {
      m_pti->ViewURL();
    }
  }

	UNUSED_ALWAYS(pResult);
	UNUSED_ALWAYS(pNMHDR);
}
Ejemplo n.º 5
0
/*!
 * \brief Create all configuration items.
 */
void CNutConfDoc::AddAllItems()
{
    CConfigTree *treeCtrl = wxGetApp().GetMainFrame()->GetTreeCtrl();

    wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(NULL);

    treeCtrl->DeleteAllItems();

    CConfigItem *item = new CConfigItem();
    wxTreeItemId rootId = treeCtrl->AddRoot(wxT(""), -1, -1, new CTreeItemData(item));

    item->SetTreeItem(rootId);
    item->UpdateTreeItem(*treeCtrl);
    m_items.Append(item);

    AddChildItems(m_root, rootId);

    UpdateAllViews();

    if (GetItems().GetCount() > 0) {
        wxGetApp().GetMainFrame()->GetTreeCtrl()->Expand(rootId);
    }
    wxGetApp().GetMainFrame()->GetTreeCtrl()->SetFocus();
}
Ejemplo n.º 6
0
/*!
 * \brief Set value of a boolean item.
 */
bool CNutConfDoc::SetActive(CConfigItem & item, bool bEnabled)
{
    item.SetActive(bEnabled);

    /* Store settings in the Lua registry. */
    CSettings *cfg = wxGetApp().GetSettings();
    RegisterSourcePath(m_repository, cfg->m_source_dir.mb_str());
    RegisterBuildPath(m_repository, cfg->m_buildpath.mb_str());
    RegisterLibPath(m_repository, cfg->m_lib_dir.mb_str());
    RegisterSamplePath(m_repository, cfg->m_app_dir.mb_str());
    RegisterCompilerPlatform(m_repository, cfg->m_platform.mb_str());

    RefreshComponents(m_repository, m_root);
    Modify(true);
    CNutConfHint hint(&item, nutExternallyChanged);
    UpdateAllViews(NULL, &hint);

    return true;
}