private void RenderIcon(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { Waypoint pt = (Waypoint)model.GetValue(iter, 0); CellRendererPixbuf icon = cell as CellRendererPixbuf; if (pt is Geocache) { icon.Pixbuf = IconManager.GetSmallCacheIcon((pt as Geocache).TypeOfCache); } else { icon.Pixbuf = IconManager.GetSmallWaypointIcon(pt.Symbol); } }
private void GenerateMarker(double lat, double lon, string iconModifier, Geocache cache, string cachedesc, string mode, bool isExtra) { StringBuilder addMarkerReq = new StringBuilder(); if (isExtra) { addMarkerReq.Append("addExtraMarker("); } else { addMarkerReq.Append("addMarker("); } addMarkerReq.Append(lat.ToString(CultureInfo.InvariantCulture)); addMarkerReq.Append(","); addMarkerReq.Append(lon.ToString(CultureInfo.InvariantCulture)); addMarkerReq.Append(",'../icons/24x24/"); addMarkerReq.Append(iconModifier); string statIcon = IconManager.GetStatusIcon(cache, m_App, m_IgnoreFinds); if (null != statIcon) { addMarkerReq.Append(statIcon); } else { addMarkerReq.Append(IconManager.GetMapIcon(cache)); } addMarkerReq.Append("',\""); addMarkerReq.Append(cache.Name); addMarkerReq.Append("\",\""); addMarkerReq.Append(cache.CacheName.Replace("\"", "'")); addMarkerReq.Append("\",\""); addMarkerReq.Append(cachedesc.Replace("\"", "''")); addMarkerReq.Append("\",\""); addMarkerReq.Append(mode); addMarkerReq.Append("\""); if (AppConfig.ShowDiffTerrIcon) { addMarkerReq.Append(","); addMarkerReq.Append(cache.Difficulty.ToString(CultureInfo.InvariantCulture)); addMarkerReq.Append(","); addMarkerReq.Append(cache.Terrain.ToString(CultureInfo.InvariantCulture)); } addMarkerReq.Append(")"); LoadScript(addMarkerReq.ToString()); }
private void AddChildWaypointMarker(Waypoint pt, bool isExtra) { if (!m_UnfilteredCaches.ContainsKey(pt.Parent)) { return; } Geocache cache = m_UnfilteredCaches[pt.Parent]; string desc = pt.Desc.Replace("\"", "''"); desc = desc.Replace("\n", "<br/>"); string iconModifier = String.Empty; if (m_App.AppConfig.ShowStaleCaches) { if ((DateTime.Now - cache.Updated) > (new TimeSpan(m_App.AppConfig.StaleCacheInterval, 0, 0, 0, 0))) { iconModifier = "stale-"; } } if (m_App.AppConfig.ShowNewCaches) { if ((DateTime.Now - cache.Time) <= (new TimeSpan(m_App.AppConfig.NewCacheInterval, 0, 0, 0, 0))) { iconModifier = "new-"; } } if (cache.Archived) { iconModifier = "archived-"; } else if (!cache.Available) { iconModifier = "disabled-"; } if (isExtra) { LoadScript("addExtraMarker(" + pt.Lat.ToString(CultureInfo.InvariantCulture) + "," + pt.Lon.ToString(CultureInfo.InvariantCulture) + ",'../icons/24x24/" + iconModifier + IconManager.GetMapIcon(pt.Symbol) + "',\"" + cache.Name + "\",\"" + cache.CacheName.Replace("\"", "'") + "\",\"" + pt.Name + "-" + desc + "\")"); } else { LoadScript("addMarker(" + pt.Lat.ToString(CultureInfo.InvariantCulture) + "," + pt.Lon.ToString(CultureInfo.InvariantCulture) + ",'../icons/24x24/" + iconModifier + IconManager.GetMapIcon(pt.Symbol) + "',\"" + cache.Name + "\",\"" + cache.CacheName.Replace("\"", "'") + "\",\"" + pt.Name + "-" + desc + "\")"); } }
public void setCacheIcon(Geocache.CacheType type) { Pixbuf icon = IconManager.GetLargeCacheIcon(type); cacheIcon.Pixbuf = icon; }
private void ShowAttrIcons(CacheAttribute[] attrs, StringBuilder bldr) { Gtk.Table.TableChild props; bool isFirst = true; uint colCount = 0; foreach (CacheAttribute attr in attrs) { Pixbuf buf; if (attr.Include) { buf = IconManager.GetYAttrIcon(attr.AttrValue); } else { buf = IconManager.GetNAttrIcon(attr.AttrValue); } if (buf != null) { Gtk.Image img = new Gtk.Image(); img.Pixbuf = buf; img.TooltipText = Catalog.GetString(attr.AttrValue); attrTable.Add(img); props = ((Gtk.Table.TableChild)(this.attrTable[img])); props.TopAttach = 0; props.LeftAttach = colCount; props.RightAttach = colCount + 1; props.BottomAttach = 1; props.XOptions = AttachOptions.Shrink; img.Show(); colCount++; continue; } if (isFirst) { isFirst = false; } else { bldr.Append(", "); } if (!attr.Include) { bldr.Append("<span fgcolor='red' strikethrough='true'>"); bldr.Append(attr.AttrValue); bldr.Append("</span>"); } else { bldr.Append(attr.AttrValue); } } Label filler = new Label(""); attrTable.Add(filler); props = ((Gtk.Table.TableChild)(this.attrTable[filler])); props.TopAttach = 0; props.LeftAttach = colCount; props.RightAttach = colCount + 1; props.BottomAttach = 1; props.XOptions = AttachOptions.Expand; filler.Show(); if (bldr.Length > 0) { attrTable.Add(attrLabel); props = ((Gtk.Table.TableChild)(this.attrTable[attrLabel])); props.TopAttach = 1; props.LeftAttach = 0; props.RightAttach = colCount + 1; props.BottomAttach = 2; attrLabel.Markup = bldr.ToString(); attrLabel.Show(); } }
private void RenderCacheIcon(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { Geocache cache = (Geocache)model.GetValue(iter, 0); if (cache == null) { return; } CellRendererPixbuf icon = cell as CellRendererPixbuf; cell.CellBackground = null; if (m_app.AppConfig.ShowStaleCaches) { if ((DateTime.Now - cache.Updated) > (new TimeSpan(m_app.AppConfig.StaleCacheInterval, 0, 0, 0, 0))) { cell.CellBackground = "gold"; } } if (m_app.AppConfig.ShowNewCaches) { if ((DateTime.Now - cache.Time) <= (new TimeSpan(m_app.AppConfig.NewCacheInterval, 0, 0, 0, 0))) { cell.CellBackground = "light green"; } } if (cache.FTF) { icon.Pixbuf = IconManager.FTF_S; } else if (cache.DNF && Config.ShowDNFIcon) { icon.Pixbuf = IconManager.DNF_S; } else if (cache.Found) { icon.Pixbuf = IconManager.GetSmallCacheIcon(Geocache.CacheType.FOUND); } else if (m_app.OwnerIDs.Contains(cache.OwnerID) || m_app.OwnerIDs.Contains(cache.CacheOwner)) { icon.Pixbuf = IconManager.GetSmallCacheIcon(Geocache.CacheType.MINE); } else if (cache.HasCorrected || cache.HasFinal) { if (Config.SolvedModeState == SolvedMode.ALL) { icon.Pixbuf = IconManager.CORRECTED_S; } else if ((Config.SolvedModeState == SolvedMode.PUZZLES) && (cache.TypeOfCache == Geocache.CacheType.MYSTERY)) { icon.Pixbuf = IconManager.CORRECTED_S; } else { icon.Pixbuf = IconManager.GetSmallCacheIcon(cache.TypeOfCache); } } else { icon.Pixbuf = IconManager.GetSmallCacheIcon(cache.TypeOfCache); } }