Example #1
0
        public log_wizard()
        {
            InitializeComponent();
            show_tips_ = new show_tips(status);
            whatsup.animate = false;
            toggled_to_custom_ui_ = first_available_toggle_custom_ui();
            forms_.Add(this);
            Text += " " + version();
            bool first_time = contexts_.Count == 0;
            if (first_time) {
                load_contexts(sett_);
                notes_keeper.inst.init( util.is_debug ? "notes" : Program.local_dir() + "\\notes", app.inst.identify_notes_files);

                new Thread(load_release_info_thread) {IsBackground = true}.Start();
            }
            notes.set_author( app.inst.notes_author_name, app.inst.notes_initials, app.inst.notes_color);
            notes.on_note_selected = on_note_selected;

            description.on_description_changed += on_description_template_changed;

            ++ignore_change_;

            full_log_ctrl_ = new log_view( this, log_view.FULLLOG_NAME);
            full_log_ctrl_.Dock = DockStyle.Fill;
            filteredLeft.Panel2.Controls.Add(full_log_ctrl_);
            full_log_ctrl_.show_name = false;
            full_log_ctrl_.show_view(true);

            filtCtrl.design_mode = false;
            filtCtrl.on_save = save;
            filtCtrl.ui_to_view = (view_idx) => log_view_for_tab(view_idx).set_filter(filtCtrl.to_filter_row_list());
            filtCtrl.on_rerun_view = (view_idx) => refreshToolStripMenuItem_Click(null, null);
            filtCtrl.on_refresh_view = (view_idx) => {
                log_view_for_tab(view_idx).Refresh();
                full_log.list.Refresh();
            };
            filtCtrl.mark_match = (filter_idx) => {
                var lv = log_view_for_tab(viewsTab.SelectedIndex);
                Color fg = util.str_to_color(sett_.get("filter_fg", "transparent"));
                Color bg = util.str_to_color(sett_.get("filter_bg", "#faebd7"));
                lv.mark_match(filter_idx, fg, bg);
            };

            recreate_contexts_combo();

            foreach ( history hist in history_)
                logHistory.Items.Add(hist.ui_friendly_name);

            --ignore_change_;
            load();
            ++ignore_change_;

            util.postpone(() => set_tabs_visible(leftPane, false), 1);

            msg_details_ = new msg_details_ctrl(this);
            Controls.Add(msg_details_);
            msg_details_.force_hide = global_ui.show_details;
            handle_subcontrol_keys(this);

            viewsTab.DrawMode = TabDrawMode.OwnerDrawFixed;
            viewsTab.DrawItem += ViewsTabOnDrawItem;

            update_topmost_image();
            update_toggle_topmost_visibility();
            --ignore_change_;

            update_status_prefix();
            set_status_forever("");

            // 1.0.80d+ - the reason we postpone this is so that we don't set up all UI in the constructor - the splitters would get extra SplitterMove() events,
            //            and we would end up positioning them wrong
            bool is_first_form = forms_.Count == 1;
            // 1.5.20+ note: if more than one form -> for the new forms, don't select anything
            if ( is_first_form)
                util.postpone(() => {
                    bool open_cmd_line_file = forms_.Count == 1 && Program.open_file_name != null;
                    if (history_.Count > 0 && !open_cmd_line_file)
                        logHistory.SelectedIndex = history_.Count - 1;
                    if (open_cmd_line_file)
                        on_file_drop(Program.open_file_name);
                }, 10);
            else 
                set_status("Alternatively, you can <i>Actions >> Open Log</i>, or re-open an older log (<i>Actions >> Show History</i>)");

            util.postpone(animate_whatsup, util.is_debug ? 2500 : 10000);
        }