Пример #1
0
CPropertyList::CPropertyList(wxWindow * parent, wxWindowID id, const wxPoint & pt,
                                 const wxSize & sz, long style):wxListCtrl(parent, id, pt, sz, style)
{
    m_pti = NULL;

    AddColumns();
}
Пример #2
0
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

}
wxWindow* uwTreeListFactory::Create()
{
    if( Tree != NULL )
        return Tree;

    Tree = new uwTreeList(Parent);

    AddColumns();
    AddData();

    Tree->SetVerticalAlign( bVerticalAlign );
    Tree->SetDataTree( *DataTree );
    Tree->ExpandRoot();
    return Tree;
}
Пример #4
0
void ProcessPage_OnViewSelectColumns(void)
{
    int  i;

    if (DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_COLUMNS_DIALOG), hMainWnd, ColumnsDialogWndProc) == IDOK)
    {
        for (i=Header_GetItemCount(hProcessPageHeaderCtrl)-1; i>=0; i--)
        {
            (void)ListView_DeleteColumn(hProcessPageListCtrl, i);
        }

        for (i=0; i<COLUMN_NMAX; i++) {
            TaskManagerSettings.ColumnOrderArray[i] = i;
            TaskManagerSettings.ColumnSizeArray[i] = ColumnPresets[i].size;
        }

        AddColumns();
    }
}
Пример #5
0
/////////////////////////////////////////////////////////////////////////////////////
// Build full alignment -> qa->s[k][h] and ta->s[k][h]
/////////////////////////////////////////////////////////////////////////////////////
void FullAlignment::Build(HMM* q, Hit& hit, const int nseqdis, const float S[20][20]) {
  int step;
  char prev_state = MM, state = MM;
  int n;
  int hh;
  int k;
  identities = 0; // number of identical residues in query and template sequence
  score_sim = 0.0f; // substitution matrix similarity score between query and template

  ClearSymbols();
  
  // Set up half-alignments 
  // n is the sequence index up to which sequences are prepared for display
  n = imin(q->n_display,
      nseqdis + (q->nss_dssp >= 0) + (q->nsa_dssp >= 0) + (q->nss_pred >= 0)
          + (q->nss_conf >= 0) + (q->ncons >= 0));
  qa->Set(q->name, q->seq, q->sname, n, q->L, q->nss_dssp, q->nss_pred,
      q->nss_conf, q->nsa_dssp, q->ncons);
  n = imax(hit.nfirst + 1, imin(hit.n_display,
      nseqdis + (hit.nss_dssp >= 0) + (hit.nsa_dssp >= 0)
          + (hit.nss_pred >= 0) + (hit.nss_conf >= 0) + (hit.ncons >= 0)));
  ta->Set(hit.name, hit.seq, hit.sname, n, hit.L, hit.nss_dssp, hit.nss_pred,
      hit.nss_conf, hit.nsa_dssp, hit.ncons);

//   printf("HMM: %s\nstep nst   i   j state hq  ht\n",hit.name);

  for (step = hit.nsteps; step >= 1; step--) {
    prev_state = state;
    state = hit.states[step];
    
    // Add column to alignment and compute identities and sequence-sequence similarity score
    if (hit.P_posterior)
      AddColumns(hit.i[step], hit.j[step], prev_state, state, hit.S[step],
          hit.P_posterior[step]);
    else
      AddColumns(hit.i[step], hit.j[step], prev_state, state, hit.S[step], 0.0);
    if (state == MM) {
      char qc = qa->seq[q->nfirst][qa->m[q->nfirst][hit.i[step]]];
      char tc = ta->seq[hit.nfirst][ta->m[hit.nfirst][hit.j[step]]];
      if (qc == tc && qc != '-')
        identities++;  // count identical amino acids
      score_sim += S[(int) aa2i(qc)][(int) aa2i(tc)];
      //fprintf(stderr,"%3i %3i  %3i %3i  %3i %1c %1c %6.2f %6.2f %6.2f %6.2f  \n",step,hit.nsteps,hit.i[step],hit.j[step],int(state),qc,tc,S[(int)aa2i(qc)][(int)aa2i(tc)],score_sim,hit.P_posterior[step],hit.sum_of_probs); //DEBUG (P_posterior not defined for Viterbi!)
    }
  }
  
  AddGaps(); //fill up gaps until query and template parts have same length
  qa->AddChar('\0');
  ta->AddChar('\0');

  // Change gap symbol '.' (gap aligned to insert) to '~' if one HMM has gap with respect to other HMM
  for (hh = 1; hh < qa->pos; hh++) {
    if (symbol[hh] == 'Q') {
      // Gap in query (IM or GD state)
      symbol[hh] = ' ';
      for (k = 0; k < qa->n; k++)
        if (qa->s[k][hh] == '.')
          qa->s[k][hh] = '-';
    }
    else if (symbol[hh] == 'T') {
      // Gap in template (MI or DG state)
      symbol[hh] = ' ';
      for (k = 0; k < ta->n; k++)
        if (ta->s[k][hh] == '.')
          ta->s[k][hh] = '-';
    }
  }

  // record in FullAlignment if posteriors were calculated
  //if (!hit.P_posterior) posterior[0]='\0'; else posterior[0]=' '; 
  if (!hit.P_posterior)
    posterior[0] = '\0';
}
Пример #6
0
INT_PTR CALLBACK
ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    RECT    rc;
    int     nXDifference;
    int     nYDifference;
    int     cx, cy;

    switch (message) {
    case WM_INITDIALOG:
        /*
         * Save the width and height
         */
        GetClientRect(hDlg, &rc);
        nProcessPageWidth = rc.right;
        nProcessPageHeight = rc.bottom;

        /* Update window position */
        SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);

        /*
         * Get handles to the controls
         */
        hProcessPageListCtrl = GetDlgItem(hDlg, IDC_PROCESSLIST);
        hProcessPageHeaderCtrl = ListView_GetHeader(hProcessPageListCtrl);
        hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS);
        hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES);

        /*
         * Set the title, and extended window styles for the list control
         */
        SetWindowTextW(hProcessPageListCtrl, L"Processes");
        (void)ListView_SetExtendedListViewStyle(hProcessPageListCtrl, ListView_GetExtendedListViewStyle(hProcessPageListCtrl) | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);

        AddColumns();

        /*
         * Subclass the process list control so we can intercept WM_ERASEBKGND
         */
        OldProcessListWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);

#ifdef RUN_PROC_PAGE
        /* Start our refresh thread */
        hProcessThread = CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, &dwProcessThread);
#endif
        return TRUE;

    case WM_DESTROY:
        /* Close the event handle, this will make the */
        /* refresh thread exit when the wait fails */
#ifdef RUN_PROC_PAGE
        EndLocalThread(&hProcessThread, dwProcessThread);
#endif
        SaveColumnSettings();
        break;

    case WM_COMMAND:
        /* Handle the button clicks */
        switch (LOWORD(wParam))
        {
        case IDC_ENDPROCESS:
            ProcessPage_OnEndProcess();
        }
        break;

    case WM_SIZE:
        if (wParam == SIZE_MINIMIZED)
            return 0;

        cx = LOWORD(lParam);
        cy = HIWORD(lParam);
        nXDifference = cx - nProcessPageWidth;
        nYDifference = cy - nProcessPageHeight;
        nProcessPageWidth = cx;
        nProcessPageHeight = cy;

        /* Reposition the application page's controls */
        GetWindowRect(hProcessPageListCtrl, &rc);
        cx = (rc.right - rc.left) + nXDifference;
        cy = (rc.bottom - rc.top) + nYDifference;
        SetWindowPos(hProcessPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
        InvalidateRect(hProcessPageListCtrl, NULL, TRUE);

        GetClientRect(hProcessPageEndProcessButton, &rc);
        MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(PRECT)(&rc), sizeof(RECT)/sizeof(POINT));
        cx = rc.left + nXDifference;
        cy = rc.top + nYDifference;
        SetWindowPos(hProcessPageEndProcessButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
        InvalidateRect(hProcessPageEndProcessButton, NULL, TRUE);

        GetClientRect(hProcessPageShowAllProcessesButton, &rc);
        MapWindowPoints(hProcessPageShowAllProcessesButton, hDlg, (LPPOINT)(PRECT)(&rc), sizeof(RECT)/sizeof(POINT));
        cx = rc.left;
        cy = rc.top + nYDifference;
        SetWindowPos(hProcessPageShowAllProcessesButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
        InvalidateRect(hProcessPageShowAllProcessesButton, NULL, TRUE);
        break;

    case WM_NOTIFY:
        ProcessPageOnNotify(wParam, lParam);
        break;

    case WM_KEYDOWN:
        if (wParam == VK_DELETE)
            ProcessPage_OnEndProcess();
        break;
    }

    return 0;
}
Пример #7
0
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:
                SetItem(ecValue, ecUtils::IntToStr(m_pti->Value(), wxGetApp().GetSettings().m_bHex));
                SetItem(ecDefaultValue, ecUtils::IntToStr(m_pti->DefaultValue(), wxGetApp().GetSettings().m_bHex));
                break;
            case ecDouble:
                SetItem(ecValue, ecUtils::DoubleToStr(m_pti->DoubleValue()));
                SetItem(ecDefaultValue, ecUtils::DoubleToStr(m_pti->DoubleDefaultValue()));
                break;
            case ecEnumerated:
                SetItem(ecValue,m_pti->StringValue());
                SetItem(ecDefaultValue,m_pti->StringDefaultValue());
                break;
            default:
                wxASSERT( FALSE );
                break;
            }
            // TODO: set image
            // SetItem(ecType, ecConfigItem::TreeItemTypeImage[type]);
        }

        // List all the properties applicable to me
        const std::string name = ecUtils::UnicodeToStdStr (m_pti->GetMacro ());
        if (name.size () > 0)
        {
            const CdlConfiguration config = wxGetApp().GetConfigToolDoc ()->GetCdlConfig ();
            const CdlNode node = config->find_node (name, true);
            wxASSERT (node);
            const std::vector<CdlProperty> & properties = node->get_properties ();
            std::vector<CdlProperty>::const_iterator property_i;
            // CMapStringToPtr map; // count of each property name
            wxHashTable map(wxKEY_STRING);  // count of each property name

            for (property_i = properties.begin (); property_i != properties.end (); property_i++) {// for each property
                // get the property name
                const CdlProperty &prop=*property_i;
                const wxString strName(prop->get_property_name ().c_str());
                enum {VISIBLE_PROPERTIES_COUNT=sizeof visible_properties/sizeof visible_properties[0]};
                if (std::find (visible_properties, visible_properties + VISIBLE_PROPERTIES_COUNT, ecUtils::UnicodeToStdStr(strName)) != visible_properties + VISIBLE_PROPERTIES_COUNT) {// if the property should be displayed
                    // set the property arguments
                    wxString strPropertyArgs;
                    const std::vector<std::string> & argv = prop->get_argv ();
                    void *p;
                    p = (void*) map.Delete(strName);
                    
                    p=(void *)((int)p+1);
                    map.Put(strName, (wxObject*) p);
                    
                    std::vector<std::string>::const_iterator argv_i;
                    for (argv_i = argv.begin (); argv_i != argv.end (); argv_i++){ // for each property argument...
                        if (argv_i != argv.begin ()){                              // ...except the first (the property name)
                            wxString strArg(ecUtils::StripExtraWhitespace (wxString(argv_i->c_str())));
                            if (strPropertyArgs.Len() + strArg.Len() + 1 > 256) {// if the string is too long for the list control
                                break; // no need to add any further arguments
                            }
                            strPropertyArgs += strArg; // add the argument to the string
                            strPropertyArgs += wxT (" "); // separate arguments by a space character
                        }
                    }
                    // the list control appears to display a maximum of 256 characters
                    int nIndex=SetItem(strName, strPropertyArgs, GetItemCount(), (int)p);
                    SetItemData(nIndex, (long) prop);
                    
                    // display the exclamation icon if the property is in a conflicts list
                    bool bConflictItem =
                        //					PropertyInConflictsList (* property_i, config->get_structural_conflicts ()) || ignore for now
                        PropertyInConflictsList (prop, config->get_all_conflicts ());

                    // TODO: set the image for a conflict item
                    // CListCtrl::SetItem (nIndex, 0, LVIF_IMAGE, NULL, bConflictItem ? 1 : 0, 0, 0, 0 );
                }
            }
        }

        for(i=GetItemCount()-1;i>=0;--i){
            if(0==GetItemData(i)){
                DeleteItem(i);
                if(i<m_nFirstProperty){
                    m_nFirstProperty--;
                }
            }
        }
        // TODO
#if 0
        CRect rect;
        GetClientRect(rect);
        int nAvailWidth=rect.Width()-GetColumnWidth(0);
        int w=max(m_nMaxValueWidth,nAvailWidth);
        m_f[1]=double(w)/double(rect.Width());
        SetColumnWidth(1,w); 
#endif
    }

    Refresh();
}
Пример #8
0
INT_PTR CALLBACK
ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    RECT    rc;
    int        nXDifference;
    int        nYDifference;
    int        cx, cy;

    switch (message) {
    case WM_INITDIALOG:
        /*
         * Save the width and height
         */
        GetClientRect(hDlg, &rc);
        nProcessPageWidth = rc.right;
        nProcessPageHeight = rc.bottom;

        /* Update window position */
        SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);

        /*
         * Get handles to the controls
         */
        hProcessPageListCtrl = GetDlgItem(hDlg, IDC_PROCESSLIST);
        hProcessPageHeaderCtrl = (HWND)SendMessageW(hProcessPageListCtrl, LVM_GETHEADER, 0, 0);
        hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS);
        hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES);

        /* Enable manual column reordering, set full select */
        SendMessageW(hProcessPageListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP,
            LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP);

        AddColumns();

        /*
         * Subclass the process list control so we can intercept WM_ERASEBKGND
         */
        OldProcessListWndProc = (WNDPROC)SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);

        /* Start our refresh thread */
        CloseHandle( CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL));

        return TRUE;

    case WM_DESTROY:
        /* Close the event handle, this will make the */
        /* refresh thread exit when the wait fails */
        CloseHandle(hProcessPageEvent);

        SaveColumnSettings();

        break;

    case WM_COMMAND:
        /* Handle the button clicks */
        switch (LOWORD(wParam))
        {
                case IDC_ENDPROCESS:
                        ProcessPage_OnEndProcess();
        }
        break;

    case WM_SIZE:
        if (wParam == SIZE_MINIMIZED)
            return 0;

        cx = LOWORD(lParam);
        cy = HIWORD(lParam);
        nXDifference = cx - nProcessPageWidth;
        nYDifference = cy - nProcessPageHeight;
        nProcessPageWidth = cx;
        nProcessPageHeight = cy;

        /* Reposition the application page's controls */
        GetWindowRect(hProcessPageListCtrl, &rc);
        cx = (rc.right - rc.left) + nXDifference;
        cy = (rc.bottom - rc.top) + nYDifference;
        SetWindowPos(hProcessPageListCtrl, NULL, 0, 0, cx, cy, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOMOVE|SWP_NOZORDER);
        InvalidateRect(hProcessPageListCtrl, NULL, TRUE);
        
        GetClientRect(hProcessPageEndProcessButton, &rc);
        MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
           cx = rc.left + nXDifference;
        cy = rc.top + nYDifference;
        SetWindowPos(hProcessPageEndProcessButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
        InvalidateRect(hProcessPageEndProcessButton, NULL, TRUE);
        
        GetClientRect(hProcessPageShowAllProcessesButton, &rc);
        MapWindowPoints(hProcessPageShowAllProcessesButton, hDlg, (LPPOINT)(&rc), (sizeof(RECT)/sizeof(POINT)) );
           cx = rc.left;
        cy = rc.top + nYDifference;
        SetWindowPos(hProcessPageShowAllProcessesButton, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
        InvalidateRect(hProcessPageShowAllProcessesButton, NULL, TRUE);

        break;

    case WM_NOTIFY:
        ProcessPageOnNotify(lParam);
        break;
    }

    return 0;
}
Пример #9
0
/*!
 * \brief Fill property list.
 *
 * Retrieves the properties of the currently selected item and updates
 * the list in the property window.
 *
 * \param pti Pointer to the currently selected item.
 */
void CPropertyList::Fill(CConfigItem * pti)
{
    /*
     * Clear the list.
     */
    ClearAll();
    AddColumns();
    m_pti = pti;

    /*
     * Display this item's properties.
     */
    if (m_pti) {
        int i;

        /*
         * Remove previously set item data.
         */
        for (i = GetItemCount() - 1; i >= 0; --i) {
            SetItemData(i, 0);
        }

        /*
         * Set the file name property. Typically a relative path to a
         * source code header file.
         */
        wxString value = m_pti->GetFilename();
        if (!value.IsEmpty()) {
            SetItem(nutFile, value);
        }

        /*
         * Set the macro property.
         */
        value = m_pti->GetMacro();
        if (!value.IsEmpty()) {
            SetItem(nutMacro, value);

            /*
             * The macro's value is optional.
             */
            switch (m_pti->GetOptionType()) {
            case nutOptionTypeNone:
                break;
            case nutEnumerated:
            case nutString:
                if(!m_pti->StringValue().IsEmpty()) {
                    SetItem(nutValue, m_pti->StringValue());
                }
                break;
            case nutInteger:
                break;
            default:
                wxASSERT(false);
                break;
            }

            /*
             * Boolean options must be active to be included.
             */
            if (m_pti->HasBool()) {
                SetItem(nutActive, m_pti->IsActive()? wxT("True") : wxT("False"));
            }
        }

        /*
         * An item may be disabled, if it requires a property which
         * is not provided by any active component.
         */
        SetItem(nutEnabled, m_pti->IsEnabled()? wxT("Yes") : wxT("No"));

        /*
         * Remove all items from the property list without previously
         * set data.
         */
        for (i = GetItemCount() - 1; i >= 0; --i) {
            if (GetItemData(i) == 0) {
                DeleteItem(i);
            }
        }

        value = m_pti->GetRequirementList();
        if (!value.IsEmpty()) {
            SetItem(nutRequires, value);
        }
        value = m_pti->GetProvisionList();
        if (!value.IsEmpty()) {
            SetItem(nutProvides, value);
        }
        value = m_pti->GetExclusivityList();
        if (!value.IsEmpty()) {
            SetItem(nutExclusivity, value);
        }
    }
    Refresh();
}