Esempio n. 1
0
 private void SetFilterFields(QuickFilter filter)
 {
     m_IgnoreStatusChange = true;
     foundCheck.Active    = filter.Found;
     notFoundCheck.Active = filter.NotFound;
     mineCheck.Active     = filter.Mine;
     availCheck.Active    = filter.Available;
     notAvailCheck.Active = filter.Unavailable;
     archiveCheck.Active  = filter.Archived;
     CheckAvailFlags();
     CheckFoundFlags();
     if (filter.Distance > 0)
     {
         distanceEntry.Text = filter.Distance.ToString();
     }
     else
     {
         distanceEntry.Text = String.Empty;
     }
     if (!String.IsNullOrEmpty(filter.NameFilter))
     {
         nameEntry.Text = filter.NameFilter;
     }
     else
     {
         nameEntry.Text = String.Empty;
     }
     UpdateNameFilter();
     UpdateDistanceFilter();
     m_app.CacheStore.AdvancedFilters   = filter.AdvancedFilters;
     m_app.CacheStore.CombinationFilter = filter.ComboFilter;
     m_IgnoreStatusChange = false;
 }
Esempio n. 2
0
 /// <summary>
 /// Adds global critera from an existing quickfilter to the condition
 /// </summary>
 /// <param name="condition">
 /// The condition<see cref="FilterList"/>
 /// </param>
 /// <param name="qf">
 /// The source quick filter <see cref="QuickFilter"/>
 /// </param>
 private static void AddGlobalCriteria(FilterList condition, QuickFilter qf)
 {
     condition.AddFilterCriteria(FilterList.KEY_STATUS,
                                 new bool[] { qf.Found, qf.NotFound, qf.Mine,
                                              qf.Available, qf.Unavailable, qf.Archived });
     if (qf.Distance > 0)
     {
         condition.AddFilterCriteria(FilterList.KEY_DIST, (double)qf.Distance);
         condition.AddFilterCriteria(FilterList.KEY_DIST_OP, "<=");
     }
 }
Esempio n. 3
0
        protected virtual void OnImportQuickFilter(object sender, System.EventArgs e)
        {
            DeleteItem dlg = new DeleteItem(m_Win.App.QuickFilterList, true);

            dlg.Title  = Catalog.GetString("Import Quick Filter");
            dlg.Icon   = this.Icon;
            dlg.Parent = this;
            if ((int)ResponseType.Ok == dlg.Run())
            {
                QuickFilter qf = m_Win.App.QuickFilterList.GetFilter(dlg.ItemToDelete);
                ImportQuickFilter(qf);
            }
        }
Esempio n. 4
0
        public void InitializeApp(string filename, bool quitAfterImport)
        {
            m_Store = new FileStore(m_Config.DBFile);
            InitalizeTracing();
            m_Locations    = LocationList.LoadLocationList();
            m_QuickFilters = QuickFilters.LoadQuickFilters();
            m_Profiles     = GPSProfileList.LoadProfileList();
            m_Tools        = EToolList.LoadEToolList();
            m_Bookmarks    = new BookmarkManager(this);
            m_CentreLat    = AppConfig.LastLat;
            m_CentreLon    = AppConfig.LastLon;
            m_CentreName   = AppConfig.LastName;
            m_Window       = new OCMMainWindow(this);
            QuickFilter startup = m_QuickFilters.GetFilter(AppConfig.StartupFilter);

            if (startup != null)
            {
                m_Window.CacheList.ApplyInitalQuickFilter(startup);
            }

            if (filename != null)
            {
                if (filename.EndsWith(".zip"))
                {
                    ImportZip(filename);
                }
                else
                {
                    ImportGPXFile(filename);
                }
                if (quitAfterImport)
                {
                    this.End();
                }
                else
                {
                    ShowMainWindow();
                }
            }
            else
            {
                m_splash = new OCMSplash();
                m_splash.Show();
                UpdateGUIThread();
                m_splash.Preload(this, startup);
            }
        }
Esempio n. 5
0
 public void PopulateQuickFilter(QuickFilter filter)
 {
     if (!String.IsNullOrEmpty(distanceEntry.Text))
     {
         filter.Distance = int.Parse(distanceEntry.Text);
     }
     else
     {
         filter.Distance = -1;
     }
     filter.NameFilter  = nameEntry.Text;
     filter.Archived    = archiveCheck.Active;
     filter.Available   = availCheck.Active;
     filter.Unavailable = notAvailCheck.Active;
     filter.NotFound    = notFoundCheck.Active;
     filter.Found       = foundCheck.Active;
     filter.Mine        = mineCheck.Active;
 }
Esempio n. 6
0
 public void ApplyQuickFilter(QuickFilter filter)
 {
     m_disableRefilter = true;
     FoundButton.Active = filter.Found;
     checkbutton1.Active = filter.NotFound;
     MineButton.Active = filter.Mine;
     checkbutton2.Active = filter.Available;
     UnavailableButton.Active = filter.Unavailable;
     ArchivedButton.Active = filter.Archived;
     if (filter.Distance > 0)
         distanceEntry.Text = filter.Distance.ToString();
     else
         distanceEntry.Text = String.Empty;
     if (!String.IsNullOrEmpty(filter.NameFilter))
         filterEntry.Text = filter.NameFilter;
     else
         filterEntry.Text = String.Empty;
     m_disableRefilter = false;
 }
Esempio n. 7
0
 public void AddFilter(QuickFilter filter)
 {
     if (m_filters.ContainsKey(filter.Name))
     {
         MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo,
                                               String.Format(Catalog.GetString("Are you sure you wish to " +
                                                                               "overwrite \"{0}\"?"), filter.Name));
         if ((int)ResponseType.Yes != dlg.Run())
         {
             dlg.Hide();
             return;
         }
         else
         {
             dlg.Hide();
             m_filters.Remove(filter.Name);
         }
     }
     m_filters.Add(filter.Name, filter);
     UpdateQFFile();
 }
Esempio n. 8
0
 /// <summary>
 /// Takes an existing quick filter and turns it into a condition (or multiple if
 /// the quickfilter has a combination filter)
 /// </summary>
 /// <param name="qf">
 /// QuickFilter to import<see cref="QuickFilter"/>
 /// </param>
 private void ImportQuickFilter(QuickFilter qf)
 {
     if (qf.ComboFilter != null)
     {
         foreach (FilterList item in qf.ComboFilter)
         {
             AddGlobalCriteria(item, qf);
             m_Store.AppendValues(item);
         }
     }
     else
     {
         FilterList condition = new FilterList();
         AddGlobalCriteria(condition, qf);
         if (qf.AdvancedFilters != null)
         {
             MergeFilterConditions(qf.AdvancedFilters.GetFilterTable(), condition);
         }
         m_Store.AppendValues(condition);
     }
 }
Esempio n. 9
0
        public void Preload(OCMApp app, QuickFilter filter)
        {
            m_App = app;

            if (filter != null)
            {
                m_App.CacheStore.GlobalFilters.AddFilterCriteria(FilterList.KEY_STATUS,
                                                                 new bool[] { filter.Found, filter.NotFound, filter.Mine,
                                                                              filter.Available, filter.Unavailable, filter.Archived });
                m_App.CacheStore.AdvancedFilters = filter.AdvancedFilters;
                if (filter.ComboFilter != null)
                {
                    m_App.CacheStore.CombinationFilter = filter.ComboFilter;
                }
            }
            app.CacheStore.Complete  += HandleAppCacheStoreComplete;
            app.CacheStore.ReadCache += HandleAppCacheStoreReadCache;
            if (app.AppConfig.UseGPSD)
            {
                app.EnableGPS(false);
            }
            app.CacheStore.GetUnfilteredCaches(app.CentreLat, app.CentreLon, app.OwnerIDs.ToArray());
        }
Esempio n. 10
0
 /// <summary>
 /// Adds global critera from an existing quickfilter to the condition
 /// </summary>
 /// <param name="condition">
 /// The condition<see cref="FilterList"/>
 /// </param>
 /// <param name="qf">
 /// The source quick filter <see cref="QuickFilter"/>
 /// </param>
 private static void AddGlobalCriteria(FilterList condition, QuickFilter qf)
 {
     condition.AddFilterCriteria(FilterList.KEY_STATUS,
             new bool[]{qf.Found, qf.NotFound, qf.Mine,
                         qf.Available, qf.Unavailable, qf.Archived});
     if (qf.Distance > 0)
     {
         condition.AddFilterCriteria(FilterList.KEY_DIST, (double) qf.Distance);
         condition.AddFilterCriteria(FilterList.KEY_DIST_OP, "<=");
     }
 }
Esempio n. 11
0
 void BuildMenuItem(QuickFilter filter, Menu qfMenu)
 {
     Gtk.Action action = new Gtk.Action(filter.Name, filter.Name);
     qfMenu.Append(action.CreateMenuItem());
     action.Activated += HandleActionActivated;
 }
Esempio n. 12
0
 public void AddFilter(QuickFilter filter)
 {
     if (m_filters.ContainsKey(filter.Name))
     {
         MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo,
                                               String.Format(Catalog.GetString("Are you sure you wish to " +
                                               	"overwrite \"{0}\"?"), filter.Name));
         if ((int) ResponseType.Yes != dlg.Run())
         {
             dlg.Hide();
             return;
         }
         else
         {
             dlg.Hide();
             m_filters.Remove(filter.Name);
         }
     }
     m_filters.Add(filter.Name, filter);
     UpdateQFFile();
 }
Esempio n. 13
0
 public void ApplyInitalQuickFilter(QuickFilter filter)
 {
     SetFilterFields(filter);
 }
Esempio n. 14
0
 public void ApplyQuickFilter(QuickFilter filter)
 {
     SetFilterFields(filter);
     Refresh();
 }
Esempio n. 15
0
        public void Preload(OCMApp app, QuickFilter filter)
        {
            m_App = app;

            if (filter != null)
            {
                m_App.CacheStore.GlobalFilters.AddFilterCriteria(FilterList.KEY_STATUS,
                                                       new bool[]{filter.Found, filter.NotFound, filter.Mine,
                                                                    filter.Available, filter.Unavailable, filter.Archived});
                m_App.CacheStore.AdvancedFilters = filter.AdvancedFilters;
                if (filter.ComboFilter != null)
                    m_App.CacheStore.CombinationFilter = filter.ComboFilter;
            }
            app.CacheStore.Complete += HandleAppCacheStoreComplete;
            app.CacheStore.ReadCache += HandleAppCacheStoreReadCache;
            if (app.AppConfig.UseGPSD)
                app.EnableGPS(false);
            app.CacheStore.GetUnfilteredCaches(app.CentreLat, app.CentreLon, app.OwnerIDs.ToArray());
        }
Esempio n. 16
0
 protected virtual void OnSaveQuickFilter(object sender, System.EventArgs e)
 {
     AddBookMarkDialog dlg = new AddBookMarkDialog ();
     dlg.Title = Catalog.GetString ("Save QuickFilter");
     if (((int)ResponseType.Ok) == dlg.Run ()) {
         QuickFilter filter = new QuickFilter ();
         filter.AdvancedFilters = m_app.CacheStore.AdvancedFilters;
         if (m_app.CacheStore.CombinationFilter != null)
             filter.ComboFilter = new List<FilterList>(m_app.CacheStore.CombinationFilter);
         filter.Name = dlg.BookmarkName;
         CacheList.PopulateQuickFilter(filter);
         m_app.QuickFilterList.AddFilter (filter);
         RebuildQuickFilters();
     }
 }
Esempio n. 17
0
 public void PopulateQuickFilter(QuickFilter filter)
 {
     filter.Found = FoundButton.Active;
     filter.NotFound = checkbutton1.Active;
     filter.Mine = MineButton.Active;
     filter.Available = checkbutton2.Active;
     filter.Unavailable = UnavailableButton.Active;
     filter.Archived = ArchivedButton.Active;
     if (!String.IsNullOrEmpty(distanceEntry.Text))
         filter.Distance = int.Parse(distanceEntry.Text);
     else
         filter.Distance = -1;
     filter.NameFilter = filterEntry.Text;
 }
Esempio n. 18
0
 private void SetFilterFields(QuickFilter filter)
 {
     m_IgnoreStatusChange = true;
     foundCheck.Active = filter.Found;
     notFoundCheck.Active = filter.NotFound;
     mineCheck.Active = filter.Mine;
     availCheck.Active = filter.Available;
     notAvailCheck.Active = filter.Unavailable;
     archiveCheck.Active = filter.Archived;
     CheckAvailFlags();
     CheckFoundFlags();
     if (filter.Distance > 0)
         distanceEntry.Text = filter.Distance.ToString();
     else
         distanceEntry.Text = String.Empty;
     if (!String.IsNullOrEmpty(filter.NameFilter))
         nameEntry.Text = filter.NameFilter;
     else
         nameEntry.Text = String.Empty;
     UpdateNameFilter();
     UpdateDistanceFilter();
     m_app.CacheStore.AdvancedFilters = filter.AdvancedFilters;
     m_app.CacheStore.CombinationFilter = filter.ComboFilter;
     m_IgnoreStatusChange = false;
 }
Esempio n. 19
0
 /// <summary>
 /// Takes an existing quick filter and turns it into a condition (or multiple if 
 /// the quickfilter has a combination filter)
 /// </summary>
 /// <param name="qf">
 /// QuickFilter to import<see cref="QuickFilter"/>
 /// </param>
 private void ImportQuickFilter(QuickFilter qf)
 {
     if (qf.ComboFilter != null)
     {
         foreach(FilterList item in qf.ComboFilter)
         {
             AddGlobalCriteria(item, qf);
             m_Store.AppendValues(item);
         }
     }
     else
     {
         FilterList condition = new FilterList();
         AddGlobalCriteria (condition, qf);
         if (qf.AdvancedFilters != null)
         {
             MergeFilterConditions (qf.AdvancedFilters.GetFilterTable(), condition);
         }
         m_Store.AppendValues(condition);
     }
 }
Esempio n. 20
0
 void BuildMenuItem(QuickFilter filter, Menu qfMenu)
 {
     Gtk.Action action = new Gtk.Action(filter.Name, filter.Name);
     qfMenu.Append(action.CreateMenuItem());
     action.Activated += HandleActionActivated;
 }
Esempio n. 21
0
 public void PopulateQuickFilter(QuickFilter filter)
 {
     if (!String.IsNullOrEmpty(distanceEntry.Text))
         filter.Distance = int.Parse(distanceEntry.Text);
     else
         filter.Distance = -1;
     filter.NameFilter = nameEntry.Text;
     filter.Archived = archiveCheck.Active;
     filter.Available = availCheck.Active;
     filter.Unavailable = notAvailCheck.Active;
     filter.NotFound = notFoundCheck.Active;
     filter.Found = foundCheck.Active;
     filter.Mine = mineCheck.Active;
 }
Esempio n. 22
0
 public void ApplyQuickFilter(QuickFilter filter)
 {
     SetFilterFields (filter);
     Refresh();
 }
Esempio n. 23
0
 public void ApplyInitalQuickFilter(QuickFilter filter)
 {
     SetFilterFields (filter);
 }