Example #1
0
void MyTreeCtrl::RefreshTreeStatus(Builder *pBuilder)
{
	VTLOG("(Refreshing Tree Status)\n");

	wxTreeItemId root = GetRootItem();
	wxTreeItemId parent, item;

	wxTreeItemIdValue cookie;
	for (parent = GetFirstChild(root, cookie); parent; parent = GetNextChild(root, cookie))
	{
		wxTreeItemIdValue cookie2;
		for (item = GetFirstChild(parent, cookie2); item; item = GetNextChild(parent, cookie2))
		{
			MyTreeItemData *data = (MyTreeItemData *)GetItemData(item);
			if (data)
			{
				SetItemText(item, MakeItemName(data->m_pLayer));
				if (data->m_pLayer == pBuilder->GetActiveLayer())
					SelectItem(item);
				if (data->m_pLayer->GetVisible())
				{
					SetItemFont(item, *wxNORMAL_FONT);
					SetItemTextColour(item, wxColour(0,0,0));
				}
				else
				{
					SetItemFont(item, *wxITALIC_FONT);
					SetItemTextColour(item, wxColour(80,80,80));
				}
			}
		}
	}
}
Example #2
0
void SymbolTree::AddItem(TagNode* node)
{
	// Get node icon index
	TagEntry nodeData = node->GetData();

	int iconIndex = GetItemIconIndex(nodeData.GetKind(), nodeData.GetAccess());
	wxString displayName(nodeData.GetDisplayName());

	wxTreeItemId parentHti;
	if (nodeData.GetName().IsEmpty())
		return;

        wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
        if (nodeData.GetKind() == wxT("prototype")) {
            font.SetStyle(wxFONTSTYLE_ITALIC);
        }
        if (nodeData.GetAccess() == wxT("public")) {
            font.SetWeight(wxFONTWEIGHT_BOLD);
        }
        
	//-------------------------------------------------------------------------------
	// We gather globals together under special node
	//-------------------------------------------------------------------------------
	if ( (nodeData.GetParent() == wxT("<global>")) &&					// parent is global scope
	        m_globalsKind.find(nodeData.GetKind()) != m_globalsKind.end() ) { //the node kind is one of function, prototype or variable
		if (nodeData.GetKind() == wxT("prototype"))
			parentHti = m_prototypesNode;
		else
			parentHti = m_globalsNode;
	} else
		parentHti = node->GetParent()->GetData().GetTreeItemId();

	//---------------------------------------------------------------------------------
	// Macros are gathered under the 'Macros' node
	//---------------------------------------------------------------------------------
	if (nodeData.GetKind() == wxT("macro")) {
		parentHti = m_macrosNode;
	}

	//only if parent is valid, we add item to the tree
	wxTreeItemId hti;

	if (parentHti.IsOk() == false) {
		parentHti = GetRootItem();
	}

	if (parentHti.IsOk()) {
		hti = AppendItem(parentHti,				// parent
		                 displayName,			// display name
		                 iconIndex,				// item image index
		                 iconIndex,				// selected item image
                         new MyTreeItemData(node->GetData().GetFile(), node->GetData().GetPattern(), node->GetData().GetLine()));
                SetItemFont(hti, font);
		node->GetData().SetTreeItemId( hti );
		m_sortItems[parentHti.m_pItem] = true;
		m_items[nodeData.Key()] = hti.m_pItem;
	}
}
JBoolean
JXStringCompletionMenu::AddString
	(
	const JCharacter* str
	)
{
	const JIndex i = GetItemCount()+1;
	if (i <= kMaxItemCount)
		{
		if (IsEmpty())
			{
			JFontID id;
			JSize size;
			JFontStyle style;
			itsTE->GetDefaultFont(&id, &size, &style);
			SetDefaultFont(id, size, style, kJFalse);
			}

		JString shortcut;
		if (i <= 10)
			{
			shortcut = JString(i%10, JString::kBase10);
			}
		else if (i <= 36)
			{
			shortcut = " ";
			shortcut.SetCharacter(1, 'a' + i - 11);
			}

		JString s = kItemPrefixStr;
		s += str;
		if (!shortcut.IsEmpty())
			{
			s.SetCharacter(1, shortcut.GetFirstCharacter());
			s.SetCharacter(3, '-');
			}

		AppendItem(s, kPlainType, shortcut);
		return kJTrue;
		}
	else if (i == kMaxItemCount+1)
		{
		AppendItem(kTruncationStr);
		SetItemFont(i, JGetDefaultFontName(), kJDefaultFontSize,
					JFontStyle(kJFalse, kJTrue, 0, kJFalse));
		return kJFalse;
		}
	else
		{
		return kJFalse;
		}
}
/*
 * WxCheckBoxUnderlineClick
 */
void MadHighlightingDialog::WxCheckBoxUnderlineClick(wxCommandEvent& event)
{
    wxFont font=GetItemFont(WxListCtrlKeyword, g_Index);
    if(event.IsChecked()) 
    {
        g_KeywordInfoTable[g_Index].attr->style |= fsUnderline;
    }
    else
    {
        g_KeywordInfoTable[g_Index].attr->style &= (~fsUnderline);
    }
    SetFontStyle(font, g_KeywordInfoTable[g_Index].attr->style);
    SetItemFont(WxListCtrlKeyword, g_Index, font);
    WxListCtrlKeyword->SetColumnWidth(0, WxListCtrlKeyword->GetClientSize().x - 4);
    SetToModifiedSyntax(g_Syntax);
}
void MadHighlightingDialog::RepaintKeyword()
{
    vector<KeywordInfo>::iterator it=g_KeywordInfoTable.begin();
    vector<KeywordInfo>::iterator itend=g_KeywordInfoTable.end();
    long idx=0;
    wxFont font;
    wxColour &fc0=it->attr->color;
    wxColour &bc0=it->attr->bgcolor;
    wxColour fc, bc;
    WxListCtrlKeyword->Freeze();
    do
    {
        switch(it->kind)
        {
        case kindSysAttr1:
        case kindSysAttr2:
        case kindKeyword:
            fc=it->attr->color;
            bc=it->attr->bgcolor;
            font=GetItemFont(WxListCtrlKeyword, idx);
            SetFontStyle(font, it->attr->style);
            SetItemFont(WxListCtrlKeyword, idx, font);
            break;
        case kindRange:
            fc=wxNullColour;
            bc=*it->range_bgcolor;
            break;
        }
        if(fc==wxNullColour) fc=fc0;
        if(bc==wxNullColour) bc=bc0;
        SetItemColour(WxListCtrlKeyword, idx, fc, bc);
        ++idx;
    }
    while(++it != itend);
    WxListCtrlKeyword->SetColumnWidth(0, WxListCtrlKeyword->GetClientSize().x - 4);
    WxListCtrlKeyword->Thaw();
}
Example #6
0
void MyTreeCtrl::CreateButtonsImageList(int size)
{
    if ( size == -1 )
    {
        SetButtonsImageList(NULL);
        return;
    }

    // Make an image list containing small icons
    wxImageList *images = new wxImageList(size, size, true);

    // should correspond to TreeCtrlIcon_xxx enum
    wxBusyCursor wait;
    wxIcon icons[4];
    icons[0] = wxIcon(icon3_xpm);   // closed
    icons[1] = wxIcon(icon3_xpm);   // closed, selected
    icons[2] = wxIcon(icon5_xpm);   // open
    icons[3] = wxIcon(icon5_xpm);   // open, selected

    for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
    {
        int sizeOrig = icons[i].GetWidth();
        if ( size == sizeOrig )
        {
            images->Add(icons[i]);
        }
        else
        {
            images->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size)));
        }
    }

    AssignButtonsImageList(images);
#else
void MyTreeCtrl::CreateButtonsImageList(int WXUNUSED(size))
{
#endif
}

int MyTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
                               const wxTreeItemId& item2)
{
    if ( m_reverseSort )
    {
        // just exchange 1st and 2nd items
        return wxTreeCtrl::OnCompareItems(item2, item1);
    }
    else
    {
        return wxTreeCtrl::OnCompareItems(item1, item2);
    }
}

void MyTreeCtrl::AddItemsRecursively(const wxTreeItemId& idParent,
                                     size_t numChildren,
                                     size_t depth,
                                     size_t folder)
{
    if ( depth > 0 )
    {
        bool hasChildren = depth > 1;

        wxString str;
        for ( size_t n = 0; n < numChildren; n++ )
        {
            // at depth 1 elements won't have any more children
            if ( hasChildren )
                str.Printf(wxT("%s child %u"), wxT("Folder"), unsigned(n + 1));
            else
                str.Printf(wxT("%s child %u.%u"), wxT("File"), unsigned(folder), unsigned(n + 1));

            // here we pass to AppendItem() normal and selected item images (we
            // suppose that selected image follows the normal one in the enum)
            int image, imageSel;
            if ( wxGetApp().ShowImages() )
            {
                image = depth == 1 ? TreeCtrlIcon_File : TreeCtrlIcon_Folder;
                imageSel = image + 1;
            }
            else
            {
                image = imageSel = -1;
            }
            wxTreeItemId id = AppendItem(idParent, str, image, imageSel,
                                         new MyTreeItemData(str));

            // and now we also set the expanded one (only for the folders)
            if ( hasChildren && wxGetApp().ShowImages() )
            {
                SetItemImage(id, TreeCtrlIcon_FolderOpened,
                             wxTreeItemIcon_Expanded);
            }

            // remember the last child for OnEnsureVisible()
            if ( !hasChildren && n == numChildren - 1 )
            {
                m_lastItem = id;
            }

            AddItemsRecursively(id, numChildren, depth - 1, n + 1);
        }
    }
    //else: done!
}

void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
                                    size_t depth)
{
    int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_Folder : -1;
    wxTreeItemId rootId = AddRoot(wxT("Root"),
                                  image, image,
                                  new MyTreeItemData(wxT("Root item")));
    if ( !HasFlag(wxTR_HIDE_ROOT) && image != -1 )
    {
        SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
    }

    AddItemsRecursively(rootId, numChildren, depth, 0);

    // set some colours/fonts for testing
    if ( !HasFlag(wxTR_HIDE_ROOT) )
        SetItemFont(rootId, *wxITALIC_FONT);

    wxTreeItemIdValue cookie;
    wxTreeItemId id = GetFirstChild(rootId, cookie);
    SetItemTextColour(id, *wxBLUE);

    id = GetNextChild(rootId, cookie);
    id = GetNextChild(rootId, cookie);
    SetItemTextColour(id, *wxRED);
    SetItemBackgroundColour(id, *wxLIGHT_GREY);
}
Example #7
0
void CGameListCtrl::Update()
{
	int scrollPos = wxWindow::GetScrollPos(wxVERTICAL);
	// Don't let the user refresh it while a game is running
	if (Core::GetState() != Core::CORE_UNINITIALIZED)
		return;

	if (m_imageListSmall)
	{
		delete m_imageListSmall;
		m_imageListSmall = NULL;
	}

	// NetPlay : Set/Reset the GameList string
	m_gameList.clear();
	m_gamePath.clear();

	Hide();

	ScanForISOs();

	ClearAll();

	if (m_ISOFiles.size() != 0)
	{
		// Don't load bitmaps unless there are games to list
		InitBitmaps();

		// add columns
		InsertColumn(COLUMN_DUMMY,_T(""));
		InsertColumn(COLUMN_PLATFORM, _T(""));
		InsertColumn(COLUMN_BANNER, _("Banner"));
		InsertColumn(COLUMN_TITLE, _("Title"));

		// Instead of showing the notes + the company, which is unknown with
		// wii titles We show in the same column : company for GC games and
		// description for wii/wad games
		InsertColumn(COLUMN_NOTES, _("Notes"));
		InsertColumn(COLUMN_COUNTRY, _T(""));
		InsertColumn(COLUMN_SIZE, _("Size"));
		InsertColumn(COLUMN_EMULATION_STATE, _("State"));

#ifdef __WXMSW__
		const int platform_padding = 0;
#else
		const int platform_padding = 8;
#endif
		
		// set initial sizes for columns
		SetColumnWidth(COLUMN_DUMMY,0);
		SetColumnWidth(COLUMN_PLATFORM, 35 + platform_padding);
		SetColumnWidth(COLUMN_BANNER, 96 + platform_padding);
		SetColumnWidth(COLUMN_TITLE, 200 + platform_padding);
		SetColumnWidth(COLUMN_NOTES, 200 + platform_padding);
		SetColumnWidth(COLUMN_COUNTRY, 32 + platform_padding);
		SetColumnWidth(COLUMN_EMULATION_STATE, 50 + platform_padding);

		// add all items
		for (int i = 0; i < (int)m_ISOFiles.size(); i++)
		{
			InsertItemInReportView(i);
			if (m_ISOFiles[i]->IsCompressed())
				SetItemTextColour(i, wxColour(0xFF0000));
		}

		// Sort items by Title
		if (!sorted)
			last_column = 0;
		sorted = false;
		wxListEvent event;
		event.m_col = SConfig::GetInstance().m_ListSort2;
		OnColumnClick(event);

		event.m_col = SConfig::GetInstance().m_ListSort;
		OnColumnClick(event);
		sorted = true;

		SetColumnWidth(COLUMN_SIZE, wxLIST_AUTOSIZE);
	}
	else
	{
		wxString errorString;
		// We just check for one hide setting to be enabled, as we may only
		// have GC games for example, and hide them, so we should show the
		// second message instead
		if ((SConfig::GetInstance().m_ListGC  &&
			SConfig::GetInstance().m_ListWii  &&
			SConfig::GetInstance().m_ListWad) &&
			(SConfig::GetInstance().m_ListJap &&
			SConfig::GetInstance().m_ListUsa  &&
			SConfig::GetInstance().m_ListPal))
		{
			errorString = _("Dolphin could not find any GC/Wii ISOs.  Doubleclick here to browse for files...");
		}
		else
		{
			errorString = _("Dolphin is currently set to hide all games.  Doubleclick here to show all games...");
		}
		InsertColumn(0, _("No ISOs or WADS found"));
		long index = InsertItem(0, errorString);
		SetItemFont(index, *wxITALIC_FONT);
		SetColumnWidth(0, wxLIST_AUTOSIZE);
	}
	if (GetSelectedISO() == NULL)
		main_frame->UpdateGUI();
	Show();

	AutomaticColumnWidth();
	ScrollLines(scrollPos);
	SetFocus();
}
Example #8
0
void CGameListCtrl::Update()
{
	int scrollPos = wxWindow::GetScrollPos(wxVERTICAL);
	// Don't let the user refresh it while a game is running
	if (Core::GetState() != Core::CORE_UNINITIALIZED)
		return;

	if (m_imageListSmall)
	{
		delete m_imageListSmall;
		m_imageListSmall = nullptr;
	}

	Hide();

	ScanForISOs();

	ClearAll();

	if (m_ISOFiles.size() != 0)
	{
		// Don't load bitmaps unless there are games to list
		InitBitmaps();

		// add columns
		InsertColumn(COLUMN_DUMMY, "");
		InsertColumn(COLUMN_PLATFORM, "");
		InsertColumn(COLUMN_BANNER, _("Banner"));
		InsertColumn(COLUMN_TITLE, _("Title"));

		InsertColumn(COLUMN_MAKER, _("Maker"));
		InsertColumn(COLUMN_FILENAME, _("File"));
		InsertColumn(COLUMN_ID, _("ID"));
		InsertColumn(COLUMN_COUNTRY, "");
		InsertColumn(COLUMN_SIZE, _("Size"));
		InsertColumn(COLUMN_EMULATION_STATE, _("State"));

#ifdef __WXMSW__
		const int platform_padding = 0;
#else
		const int platform_padding = 8;
#endif

		const int platform_icon_padding = 1;

		// set initial sizes for columns
		SetColumnWidth(COLUMN_DUMMY, 0);
		SetColumnWidth(COLUMN_PLATFORM, SConfig::GetInstance().m_showSystemColumn ? 32 + platform_icon_padding + platform_padding : 0);
		SetColumnWidth(COLUMN_BANNER, SConfig::GetInstance().m_showBannerColumn ? 96 + platform_padding : 0);
		SetColumnWidth(COLUMN_TITLE, 175 + platform_padding);
		SetColumnWidth(COLUMN_MAKER, SConfig::GetInstance().m_showMakerColumn ? 150 + platform_padding : 0);
		SetColumnWidth(COLUMN_FILENAME, SConfig::GetInstance().m_showFileNameColumn ? 100 + platform_padding : 0);
		SetColumnWidth(COLUMN_ID, SConfig::GetInstance().m_showIDColumn ? 75 + platform_padding : 0);
		SetColumnWidth(COLUMN_COUNTRY, SConfig::GetInstance().m_showRegionColumn ? 32 + platform_padding : 0);
		SetColumnWidth(COLUMN_EMULATION_STATE, SConfig::GetInstance().m_showStateColumn ? 48 + platform_padding : 0);

		// add all items
		for (int i = 0; i < (int)m_ISOFiles.size(); i++)
		{
			InsertItemInReportView(i);
			if (SConfig::GetInstance().m_ColorCompressed && m_ISOFiles[i]->IsCompressed())
				SetItemTextColour(i, wxColour(0xFF0000));
		}

		// Sort items by Title
		if (!sorted)
			last_column = 0;
		sorted = false;
		wxListEvent event;
		event.m_col = SConfig::GetInstance().m_ListSort2;
		OnColumnClick(event);

		event.m_col = SConfig::GetInstance().m_ListSort;
		OnColumnClick(event);
		sorted = true;

		SetColumnWidth(COLUMN_SIZE, SConfig::GetInstance().m_showSizeColumn ? wxLIST_AUTOSIZE : 0);
	}
	else
	{
		wxString errorString;
		// We just check for one hide setting to be enabled, as we may only
		// have GC games for example, and hide them, so we should show the
		// first message instead
		if (IsHidingItems())
		{
			errorString = _("Dolphin is currently set to hide all games. Double-click here to show all games...");
		}
		else
		{
			errorString = _("Dolphin could not find any GameCube/Wii ISOs or WADs. Double-click here to set a games directory...");
		}
		InsertColumn(0, "");
		long index = InsertItem(0, errorString);
		SetItemFont(index, *wxITALIC_FONT);
		SetColumnWidth(0, wxLIST_AUTOSIZE);
	}
	if (GetSelectedISO() == nullptr)
		main_frame->UpdateGUI();
	Show();

	AutomaticColumnWidth();
	ScrollLines(scrollPos);
	SetFocus();
}
Example #9
0
void MyTreeCtrl::RefreshTreeItems(Builder *pBuilder)
{
	VTLOG1("Refreshing Tree Items:");

	// Deleting the previous items can call OnSelChanged, which can cause VTB
	//  to forget the active layer, so indicate that this is not user input.
	m_bUser = false;
	DeleteAllItems();
	m_bUser = true;

	rootId = AddRoot(_("Layers"));
	SetItemBold(rootId);

	int	image, imageSel;

	wxTreeItemId elevId =	AddRootItem(MyTreeCtrl::TreeCtrlIcon_Grid, _("Elevation"));
	SetItemData(elevId, new MyTreeItemData(LT_ELEVATION));

	wxTreeItemId imageId =	AddRootItem(MyTreeCtrl::TreeCtrlIcon_Image, _("Images"));
	SetItemData(imageId, new MyTreeItemData(LT_IMAGE));

	wxTreeItemId buildId =	AddRootItem(MyTreeCtrl::TreeCtrlIcon_Building, _("Structures"));
	SetItemData(buildId, new MyTreeItemData(LT_STRUCTURE));

	wxTreeItemId roadId =	AddRootItem(MyTreeCtrl::TreeCtrlIcon_Road, _("Roads"));
	SetItemData(roadId, new MyTreeItemData(LT_ROAD));

	wxTreeItemId vegId =	AddRootItem(MyTreeCtrl::TreeCtrlIcon_Veg1, _("Vegetation"));
	SetItemData(vegId, new MyTreeItemData(LT_VEG));

	wxTreeItemId waterId =	AddRootItem(MyTreeCtrl::TreeCtrlIcon_Water, _("Water"));
	SetItemData(waterId, new MyTreeItemData(LT_WATER));

	wxTreeItemId utilityId = AddRootItem(MyTreeCtrl::TreeCtrlIcon_Utility, _("Utilities"));
	SetItemData(utilityId, new MyTreeItemData(LT_UTILITY));

	wxTreeItemId rawId =	AddRootItem(MyTreeCtrl::TreeCtrlIcon_Raw, _("Raw"));
	SetItemData(rawId, new MyTreeItemData(LT_RAW));

	image = TreeCtrlIcon_File;
	imageSel = TreeCtrlIcon_FileSelected;
	vtLayerPtr lp;
	int iLayers = 0;
	if (pBuilder) iLayers = pBuilder->NumLayers();
	wxTreeItemId hSelectedItem;
	for (int i = 0; i < iLayers; i++)
	{
		lp = pBuilder->GetLayer(i);

		wxString str = MakeItemName(lp);

		wxTreeItemId hItem;
		switch (lp->GetType())
		{
		case LT_ELEVATION:
			hItem = AppendItem(elevId, str, image, imageSel);
			break;
		case LT_IMAGE:
			hItem = AppendItem(imageId, str, image, imageSel);
			break;
		case LT_ROAD:
			hItem = AppendItem(roadId, str, image, imageSel);
			break;
		case LT_STRUCTURE:
			hItem = AppendItem(buildId, str, image, imageSel);
			break;
		case LT_VEG:
			hItem = AppendItem(vegId, str, image, imageSel);
			break;
		case LT_WATER:
			hItem = AppendItem(waterId, str, image, imageSel);
			break;
		case LT_UTILITY:
			hItem = AppendItem(utilityId, str, image, imageSel);
			break;
		case LT_RAW:
			hItem = AppendItem(rawId, str, image, imageSel);
			break;
		case LT_UNKNOWN:
		case LAYER_TYPES:
			// Keep picky compilers quiet.
			break;
		}
		if (hItem.IsOk())
		{
			SetItemData(hItem, new MyTreeItemData(lp));

			if (lp == pBuilder->GetActiveLayer())
				hSelectedItem = hItem;
			if (!lp->GetVisible())
			{
				SetItemFont(hItem, *wxITALIC_FONT);
				SetItemTextColour(hItem, wxColour(80,80,80));
			}
		}
	}
	VTLOG(" %d layers.\n", iLayers);

	// Expand the groups after they have all their items.  It doesn't work
	//  to expand before, because then not all items are shown.
	Expand(elevId);
	Expand(imageId);
	Expand(roadId);
	Expand(buildId);
	Expand(vegId);
	Expand(waterId);
	Expand(utilityId);
	Expand(rawId);

	// Wait until all the groups are expanded, before highlighting the
	//  selected item, so that it will definitely be in view.
	if (hSelectedItem.IsOk())
		SelectItem(hSelectedItem);
}
void MadHighlightingDialog::WxListBoxSyntaxSelected(wxCommandEvent& event)
{
    wxString title=WxListBoxSyntax->GetString(event.GetSelection());
    g_Syntax=GetSyntax(title);

    // build keyword list
    WxListCtrlKeyword->Freeze();
    WxListCtrlKeyword->DeleteAllItems();
    g_KeywordInfoTable.clear();
    int index=0;

    // system attributes
    for(int ae=aeText; ae<aeNone; ++ae)
    {
        long item = WxListCtrlKeyword->InsertItem(index++, MadSyntax::GetAttributeName((MadAttributeElement)ae));
        MadAttributes *attr = g_Syntax->GetAttributes((MadAttributeElement)ae);
        int kind=kindSysAttr1;
        if(ae==aeActiveLine || ae==aeBookmark) kind=kindSysAttr2;
        g_KeywordInfoTable.push_back(KeywordInfo(kind, attr, NULL));

        if(ae==aeText)
        {
            WxListCtrlKeyword->SetBackgroundColour(attr->bgcolor);
        }

        SetItemColour(WxListCtrlKeyword, item, attr->color, attr->bgcolor);
        wxFont font=GetItemFont(WxListCtrlKeyword, item);
        SetFontStyle(font, attr->style);
        SetItemFont(WxListCtrlKeyword, item, font);
    }
    
    // custom ranges
    size_t i;
    for(i=0; i<g_Syntax->m_CustomRange.size(); ++i)
    {
        wxString text;
        text.Printf(wxT("Range %s %s"), g_Syntax->m_CustomRange[i].begin.c_str(), g_Syntax->m_CustomRange[i].end.c_str());
        long item = WxListCtrlKeyword->InsertItem(index++, text);
        wxColour *bg = &(g_Syntax->m_CustomRange[i].bgcolor);
        g_KeywordInfoTable.push_back( KeywordInfo(kindRange, NULL, bg) );
        SetItemColour(WxListCtrlKeyword, item, g_KeywordInfoTable[0].attr->color, *bg);
    }
    
    // custom keywords
    for(i=0; i<g_Syntax->m_CustomKeyword.size(); ++i)
    {
        long item = WxListCtrlKeyword->InsertItem(index++, g_Syntax->m_CustomKeyword[i].m_Name);
        MadAttributes *attr = &(g_Syntax->m_CustomKeyword[i].m_Attr);
        g_KeywordInfoTable.push_back(KeywordInfo(kindKeyword, attr, NULL));

        SetItemColour(WxListCtrlKeyword, item, attr->color, attr->bgcolor);
        wxFont font=GetItemFont(WxListCtrlKeyword, item);
        SetFontStyle(font, attr->style);
        SetItemFont(WxListCtrlKeyword, item, font);
    }

    WxListCtrlKeyword->SetColumnWidth( 0, WxListCtrlKeyword->GetClientSize().x - 4);
    WxListCtrlKeyword->Thaw();

    g_Index=-1;
    wxListEvent e;
    e.m_itemIndex=0;
    WxListCtrlKeywordSelected(e);
}