Пример #1
0
        //private TimetableStyle attrs;

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

            info.Register <IExport>(new BitmapExport());

            ButtonMenuItem item = ((MenuBar)info.Menu).CreateItem("Bildfahrplan");

            showItem         = item.CreateItem("Anzeigen");
            showItem.Enabled = false;
            showItem.Click  += ShowItem_Click;

            configItem         = item.CreateItem("Darstellung ändern");
            configItem.Enabled = false;
            configItem.Click  += ConfigItem_Click;

            printItem         = item.CreateItem("Drucken");
            printItem.Enabled = false;
            printItem.Click  += PrintItem_Click;

            trainColorItem         = item.CreateItem("Zugdarstellung ändern");
            trainColorItem.Enabled = false;
            trainColorItem.Click  += TrainColorItem_Click;

            stationStyleItem         = item.CreateItem("Stationsdarstellung ändern");
            stationStyleItem.Enabled = false;
            stationStyleItem.Click  += StationStyleItem_Click;

            overrideItem = item.CreateCheckItem("Verwende nur Plandarstellung");
            overrideItem.CheckedChanged += OverrideItem_CheckedChanged;
            overrideItem.Checked         = info.Settings.Get <bool>("bifpl.override-entity-styles");
        }
Пример #2
0
        private void Info_ExtensionsLoaded(object sender, EventArgs e)
        {
            var previewables = info.GetRegistered <IPreviewable>();

            if (previewables.Length == 0)
            {
                info.Menu.Items.Remove(previewRoot); // Ausblenden in der harten Art
            }
            foreach (var prev in previewables)
            {
                var itm = previewRoot.CreateItem(prev.DisplayName);
                itm.Enabled = false;
                itm.Click  += (s, ev) => prev.Show(info);
            }

            dialogs = info.GetRegistered <IEditingDialog>();
            if (dialogs.Length > 0)
            {
                editRoot.Items.Add(new SeparatorMenuItem());
            }

            dialogOffset = editRoot.Items.Count;
            foreach (var dialog in dialogs)
            {
                var itm = editRoot.CreateItem(dialog.DisplayName);
                itm.Enabled = dialog.IsEnabled(info);
                itm.Click  += (s, ev) => dialog.Show(info);
            }

            hasFilterables = info.GetRegistered <IFilterableUi>().Length > 0;
            hasDesignables = info.GetRegistered <IDesignableUiProxy>().Length > 0;
        }
Пример #3
0
        private void PluginInterface_ExtensionsLoaded(object sender, EventArgs e)
        {
            var previewables = pluginInterface.GetRegistered <IPreviewAction>();

            if (previewables.Length == 0)
            {
                pluginInterface.Menu.Items.Remove(previewRoot); // Ausblenden in der harten Art
            }
#pragma warning disable CA2000
            foreach (var prev in previewables)
            {
                previewRoot.CreateItem(prev.MenuName, enabled: false, clickHandler: (s, ev) => prev.Show(pluginInterface));
            }
#pragma warning restore CA2000

            editMenuActions = pluginInterface.GetRegistered <IEditMenuItemAction>();
            if (editMenuActions.Length > 0)
            {
                editRoot.Items.Add(new SeparatorMenuItem());
            }

            dialogOffset = editRoot.Items.Count;
#pragma warning disable CA2000
            foreach (var dialog in editMenuActions)
            {
                editRoot.CreateItem(dialog.DisplayName, enabled: dialog.IsEnabled(pluginInterface), clickHandler: (s, ev) => dialog.Invoke(pluginInterface));
            }
#pragma warning restore CA2000
        }
Пример #4
0
        private ButtonMenuItem editRoot, undoItem;                     // Type="Both"

        public void Init(IPluginInterface pluginInterface, IComponentRegistry componentRegistry)
        {
            this.pluginInterface              = pluginInterface;
            pluginInterface.FileStateChanged += PluginInterface_FileStateChanged;
            pluginInterface.ExtensionsLoaded += PluginInterface_ExtensionsLoaded;

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

            editRoot = (ButtonMenuItem)((MenuBar)pluginInterface.Menu).GetItem(MainForm.LocEditMenu);

            undoItem = editRoot.CreateItem(T._("&Rückgängig"), enabled: false, shortcut: Keys.Control | Keys.Z, clickHandler: (s, e) => pluginInterface.Undo());

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

            editLineItem = editRoot.CreateItem(T._("&Strecke bearbeiten (linear)"), enabled: false, shortcut: Keys.Control | Keys.L,
                                               clickHandler: (s, e) => ShowForm(new LineEditForm(pluginInterface, Timetable.LINEAR_ROUTE_ID)));

            editTrainsItem        = editRoot.CreateItem(T._("&Züge bearbeiten"), enabled: false, shortcut: Keys.Control | Keys.R);
            editTrainsItem.Click += (s, e) =>
            {
                if (pluginInterface.Timetable.Type == TimetableType.Linear)
                {
                    ShowForm(new Linear.LinearTrainsEditForm(pluginInterface));
                }
                else
                {
                    ShowForm(new Network.NetworkTrainsEditForm(pluginInterface));
                }
            };

            editTimetableItem        = editRoot.CreateItem(T._("&Fahrplan bearbeiten"), enabled: false, shortcut: Keys.Control | Keys.T);
            editTimetableItem.Click += (s, e) =>
            {
                if (pluginInterface.Timetable.Type == TimetableType.Linear)
                {
                    ShowForm(new Linear.LinearTimetableEditForm(pluginInterface));
                }
                else
                {
                    ShowForm(new Network.MultipleTimetableEditForm(pluginInterface));
                }
            };

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

            designItem = editRoot.CreateItem(T._("Fahrplan&darstellung"), enabled: false, clickHandler: (s, e) => ShowForm(new RenderSettingsForm(pluginInterface)));
            filterItem = editRoot.CreateItem(T._("Fi&lterregeln"), enabled: false, clickHandler: (s, e) => ShowForm(new Filters.FilterForm(pluginInterface)));
        }
Пример #5
0
#pragma warning restore CA2213

        public void Init(IPluginInterface pluginInterface, IComponentRegistry componentRegistry)
        {
            this.pluginInterface  = pluginInterface;
            Style.PluginInterface = pluginInterface;

            if (!GdiAvailabilityTest.Test())
            {
                pluginInterface.Logger.Error(T._("Die Bibliothek libgdiplus wurde nicht gefunden! Die Bildfahrplanfunktionen stehen nicht zur Verfügung. Zur Installation siehe Installatiosnhinweise unter https://fahrplan.manuelhu.de/download/."));
                return;
            }

            dpf = new DynamicPreview();
            componentRegistry.Register <IPreviewAction>(dpf);
            pluginInterface.AppClosing += (s, e) => dpf.Close();

#if !DEBUG
            if (pluginInterface.Settings.Get <bool>("feature.enable-full-graph-editor"))
            {
#endif
            pluginInterface.FileStateChanged += PluginInterface_FileStateChanged;

            graphItem = ((MenuBar)pluginInterface.Menu).CreateItem(T._("B&ildfahrplan"));

            showItem = graphItem.CreateItem(T._("&Anzeigen"), enabled: false, clickHandler: ShowItem_Click);
            graphItem.Items.Add(new SeparatorMenuItem());
            printItem  = graphItem.CreateItem(T._("&Drucken"), enabled: false, clickHandler: PrintItem_Click);
            exportItem = graphItem.CreateItem(T._("&Exportieren"), enabled: false, clickHandler: ExportItem_Click);
            graphItem.Items.Add(new SeparatorMenuItem());
            configItem        = graphItem.CreateItem(T._("Darste&llung ändern"), enabled: false, clickHandler: (s, ev) => ShowForm(new ConfigForm(pluginInterface.Timetable, pluginInterface)));
            virtualRoutesItem = graphItem.CreateItem(T._("&Virtuelle Strecken"), enabled: false, clickHandler: (s, ev) => ShowForm(new VirtualRouteForm(pluginInterface)));
            trainColorItem    = graphItem.CreateItem(T._("&Zugdarstellung ändern"), enabled: false, clickHandler: (s, ev) => ShowForm(new TrainStyleForm(pluginInterface)));
            stationStyleItem  = graphItem.CreateItem(T._("&Stationsdarstellung ändern"), enabled: false, clickHandler: (s, ev) => ShowForm(new StationStyleForm(pluginInterface)));
            overrideItem      = graphItem.CreateCheckItem(T._("Verwende nur &Plandarstellung"), isChecked: pluginInterface.Settings.Get <bool>("bifpl.override-entity-styles"),
                                                          changeHandler: OverrideItem_CheckedChanged);
#if !DEBUG
        }
#endif
        }
Пример #6
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");
        }