public void copy_from(ui_context other) { name = other.name; auto_match = other.auto_match; views = other.views.ToList(); show_filter = other.show_filter; show_source = other.show_source; show_fulllog = other.show_fulllog; }
private void addContext_Click(object sender, EventArgs e) { new_context_form new_ = new new_context_form(); new_.Location = Cursor.Position; if ( new_.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ui_context new_ctx = new ui_context(); if ( new_.basedOnExisting.Checked) new_ctx.copy_from( cur_context()); new_ctx.name = new_.name.Text; contexts_.Add(new_ctx); curContextCtrl.Items.Add( new_ctx.name); curContextCtrl.SelectedIndex = curContextCtrl.Items.Count - 1; } }
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); } }