예제 #1
0
        private ButtonMenuItem editRoot, previewRoot, undoItem;        // Type="Both"

        public void Init(IInfo info)
        {
            this.info              = info;
            info.FileStateChanged += Info_FileStateChanged;
            info.ExtensionsLoaded += Info_ExtensionsLoaded;

            info.Register <IExport>(new FPLedit.NonDefaultFiletypes.CleanedXMLExport());
            info.Register <ITimetableCheck>(new FPLedit.TimetableChecks.TransitionsCheck());
            info.Register <ITimetableCheck>(new FPLedit.TimetableChecks.DayOverflowCheck());
            info.Register <ITimetableInitAction>(new FPLedit.TimetableChecks.UpdateColorsAction());
            info.Register <ITimetableInitAction>(new FPLedit.TimetableChecks.FixNetworkAttributesAction());

            if (Environment.OSVersion.Platform != PlatformID.Win32NT || info.Settings.Get <bool>("mp-compat.route-edit-button"))
            {
                info.Register <IRouteAction>(new Network.EditRouteAction());
            }

            editRoot = ((MenuBar)info.Menu).CreateItem("Bearbeiten");

            undoItem          = editRoot.CreateItem("Rückgängig");
            undoItem.Shortcut = Keys.Control | Keys.Z;
            undoItem.Enabled  = false;
            undoItem.Click   += (s, e) => info.Undo();

            editRoot.Items.Add(new SeparatorMenuItem());

            editLineItem         = editRoot.CreateItem("Strecke bearbeiten (linear)");
            editLineItem.Enabled = false;
            editLineItem.Click  += (s, e) => ShowForm(new LineEditForm(info, Timetable.LINEAR_ROUTE_ID));

            editTrainsItem         = editRoot.CreateItem("Züge bearbeiten");
            editTrainsItem.Enabled = false;
            editTrainsItem.Click  += (s, e) =>
            {
                if (info.Timetable.Type == TimetableType.Linear)
                {
                    ShowForm(new Linear.TrainsEditForm(info));
                }
                else
                {
                    ShowForm(new Network.TrainsEditingForm(info));
                }
            };

            editTimetableItem         = editRoot.CreateItem("Fahrplan bearbeiten");
            editTimetableItem.Enabled = false;
            editTimetableItem.Click  += (s, e) =>
            {
                if (info.Timetable.Type == TimetableType.Linear)
                {
                    ShowForm(new Linear.LineTimetableEditForm(info));
                }
                else
                {
                    ShowForm(new Network.MultipleTimetableEditForm(info));
                }
            };

            editRoot.Items.Add(new SeparatorMenuItem());

            designItem         = editRoot.CreateItem("Fahrplandarstellung");
            designItem.Enabled = false;
            designItem.Click  += (s, e) => ShowForm(new DesignableForm(info));

            filterItem         = editRoot.CreateItem("Filterregeln");
            filterItem.Enabled = false;
            filterItem.Click  += (s, e) => ShowForm(new Filters.FilterForm(info));

            previewRoot = ((MenuBar)info.Menu).CreateItem("Vorschau");
        }