private void load_contexts() { logger.Debug("loading contexts"); int history_count = int.Parse( sett.get("history_count", "0")); for (int idx = 0; idx < history_count; ++idx) { history hist = new history(); hist.type = int.Parse( sett.get("history." + idx + "type", "0")); hist.name = sett.get("history." + idx + "name"); hist.friendly_name = sett.get("history." + idx + "friendly_name"); hist.log_syntax = sett.get("history." + idx + "log_syntax"); history_.Add( hist ); } int count = int.Parse( sett.get("context_count", "1")); for ( int i = 0; i < count ; ++i) { ui_context ctx = new ui_context(); ctx.name = sett.get("context." + i + ".name", "Default"); ctx.auto_match = sett.get("context." + i + ".auto_match"); ctx.show_filter = sett.get("context." + i + ".show_filter", "1") != "0"; ctx.show_source = sett.get("context." + i + ".show_source", "1") != "0"; ctx.show_fulllog = sett.get("context." + i + ".show_fulllog", "0") != "0"; int view_count = int.Parse( sett.get("context." + i + ".view_count", "1")); for ( int v = 0; v < view_count; ++v) { ui_view lv = new ui_view(); lv.name = sett.get("context." + i + ".view" + v + ".name"); int filter_count = int.Parse( sett.get("context." + i + ".view" + v + ".filter_count", "0")); for ( int f = 0; f < filter_count; ++f) { string prefix = "context." + i + ".view" + v + ".filt" + f + "."; bool enabled = int.Parse( sett.get(prefix + "enabled", "1")) != 0; bool dimmed = int.Parse( sett.get(prefix + "dimmed", "0")) != 0; string text = sett.get(prefix + "text"); lv.filters.Add( new ui_filter { enabled = enabled, dimmed = dimmed, text = text } ); } ctx.views.Add(lv); } contexts_.Add(ctx); } }
private void newFilteredView_Click(object sender, EventArgs e) { ui_context cur = cur_context(); int cur_view = viewsTab.SelectedIndex; var filters = cur_view >= 0 ? cur.views[cur_view].filters : new List<ui_filter>(); ui_view new_ = new ui_view() { name = "New_" + cur.views.Count, filters = filters.ToList() }; cur.views.Insert(cur_view + 1, new_); viewsTab.TabPages.Insert(cur_view + 1, new_.name); viewsTab.SelectedIndex = cur_view + 1; ensure_we_have_log_view_for_tab( cur_view + 1); save(); }
public void view_to_ui(ui_view view, int view_idx) { if ( view_ != view && view_ != null) if (needs_save_) { on_save(); ui_to_view(view_idx_); } view_ = view; view_idx_ = view_idx; ++ignore_change_; List<object> items = new List<object>(); var filters = view_.filters; for (int idx = 0; idx < filters.Count; ++idx) { var i = new filter_item(filters[idx]); items.Add(i); } filterCtrl.SetObjects(items); curFilterCtrl.Text = ""; applyToExistingLines.Checked = false; curFilterCtrl.Enabled = filterCtrl.SelectedIndex >= 0; --ignore_change_; ui_to_view(view_idx_); }