示例#1
0
void CBookmarksView::OnDeleteLines()
{
    if (MessageBox(DELETE_BOOKMARKS_MSG, _T("Warning"), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) != IDYES)
    {
        return;
    }
    SetMarks(false);

    POSITION pos = m_list.GetFirstSelectedItemPosition();
    while (pos)
    {
        int sel = m_list.GetNextSelectedItem(pos);
        m_list.SetMark(sel, true);
    }
    DeleteMarkedBookmarks(true);
}
示例#2
0
void
MapWindow::OnDestroy()
{
  SetMarks(NULL);
  airspace_renderer.Clear();
  SetWaypoints(NULL);
  SetTopography(NULL);
  SetTerrain(NULL);
  SetWeather(NULL);

#ifndef ENABLE_OPENGL
  buffer_canvas.reset();

  if (!IsAncientHardware())
    stencil_canvas.reset();
#endif

  DoubleBufferWindow::OnDestroy();
}
示例#3
0
void
MapWindow::OnDestroy()
{
#ifdef HAVE_NOAA
  SetNOAAStore(NULL);
#endif
  SetMarks(NULL);
  airspace_renderer.Clear();
  SetWaypoints(NULL);
  SetTopography(NULL);
  SetTerrain(NULL);
  SetWeather(NULL);

#ifndef ENABLE_OPENGL
  buffer_canvas.Destroy();
#endif

  DoubleBufferWindow::OnDestroy();
}
示例#4
0
int AL_PROTO ALEntryList::SetMarksFromListBox( HWND hDlg, int list_box /* = -1 */ )
{
    HWND window;

    if ( list_box != -1 )
        window = GetDlgItem( hDlg, (short int) list_box );
    else
        window = hDlg;

    WORD count = (WORD) SendMessage( window, LB_GETSELCOUNT, 0, 0L );
    int *items = new int[ count ];
    if ( items == 0 )
        return mStatus.SetError( AL_CANT_ALLOCATE_MEMORY,
                                   "Memory allocation failure in SetMarksFromListBox()" );
#ifdef AL_FLAT_MODEL
    if ( count != (WORD) SendMessage( window, LB_GETSELITEMS, count, (LPARAM) ( items ) ) ) {
#else
    if ( count != (WORD) SendMessage( window, LB_GETSELITEMS, count, (LPARAM) ( (int _far * ) items ) ) ) {
#endif
        mStatus.SetError( AL_LOGIC_ERROR,
                            "Logic error in SetMarksFromListBox()."
                            "Mismatch in select count from list box." );
        delete[] items;
        return AL_LOGIC_ERROR;
    }
    for ( WORD i = 0 ; i < count ; i++ ) {
        WORD length = (WORD) SendMessage( window, LB_GETTEXTLEN, (short int) items[ i ], 0L );
        AL_ASSERT( length != (WORD) LB_ERR, "SetMarksFromListBox: LB_ERR returned from list box" );
        if ( length > 0 ) {
            char *name = new char[ length + 1 ];
            if ( name ) {
                if ( SendMessage( window, LB_GETTEXT, (short int) items[ i ], (LPARAM)( (LPSTR) name ) ) >= 0 )
                    SetMarks( name );
                delete[] name;
            }
        }
    }
    delete[] items;
    return count;
}
示例#5
0
void CBookmarksView::ParseBookmarksEcl(std::_tstring ecl, std::_tstring user, std::_tstring inModule, std::_tstring inAttributeName, IAttributeType *attrType)
{
    int i = 0;
    int col = 0;
    int row = 0;

    std::_tstring bookmark = _T("");

    SetMarks(inModule, inAttributeName, false);

    for (int b = 0; b < (int)m_listMaster.m_bookmarks.size(); b++)
    {
        bookmark = m_listMaster.m_bookmarks[b];
        if (bookmark.length() == 0) {
            continue;
        }

        int n = static_cast<int>(ecl.find(bookmark, i));

        if (n > 0) {
            std::_tstring line;
            int index = 0;
            bool found = false;

            typedef std::vector<std::_tstring> split_vector_type;
            split_vector_type lines;
            boost::algorithm::split(lines, ecl, boost::algorithm::is_any_of(_T("\n")), boost::algorithm::token_compress_on);

            for (split_vector_type::const_iterator itr = lines.begin(); itr != lines.end(); ++itr)
            {
                line = itr[0];
                ++index;

                n = static_cast<int>(line.find(_T("//"), 0));
                if (n < 0)
                {
                    continue;
                }

                n = static_cast<int>(line.find(bookmark, 0));

                if (n >= 0) {
                    col = 0;

                    std::wostringstream ss;
                    ss << (index);
                    std::_tstring nStr = ss.str();
                    found = false;

                    for (int i = 0; i < m_listMaster.GetItemCount(); ++i)
                    {
                        std::_tstring liner = m_listMaster.GetItemText(i, 0);
                        std::_tstring module = m_listMaster.GetItemText(i, 3);
                        std::_tstring attributeName = m_listMaster.GetItemText(i, 4);

                        if (liner == nStr && module == inModule && attributeName == inAttributeName)
                        {
                            found = true;
                            BookmarkItemData *data = reinterpret_cast<BookmarkItemData *>(m_listMaster.GetItemData(i));
                            data->marked = true;
                            break;
                        }
                    }

                    if (!found) {
                        row = m_listMaster.InsertItem(col++, nStr.c_str());
                        m_listMaster.SetItemText(row, col++, bookmark.c_str());
                        m_listMaster.SetItemText(row, col++, user.c_str());
                        m_listMaster.SetItemText(row, col++, inModule.c_str());
                        m_listMaster.SetItemText(row, col++, inAttributeName.c_str());
                        m_listMaster.SetItemText(row, col++, attrType->GetRepositoryCode());
                        m_listMaster.SetItemText(row, col++, trim(line.substr(n + m_listMaster.m_bookmarks[b].length())).c_str());
                        BookmarkItemData *data = new BookmarkItemData;
                        data->marked = true;
                        data->bookmarkType = (BM_TYPE)b;
                        data->column = n;
                        m_listMaster.SetItemData(row, (DWORD_PTR)data);
                    }
                }
            }
        }
    }

    DeleteMarkedBookmarks(inModule, inAttributeName,false);

    for (int i = 0; i < col; ++i)
    {
        m_listMaster.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
    }

    DoRefresh(NULL, 0);
}