Example #1
0
#pragma warning restore CS0649

        public StationStyleForm(IPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;
            var tt    = pluginInterface.Timetable;
            var attrs = new TimetableStyle(tt);

            backupHandle = pluginInterface.BackupTimetable();

            Eto.Serialization.Xaml.XamlReader.Load(this);

            var cc = new ColorCollection(pluginInterface.Settings);
            var ds = new DashStyleHelper();

            var lineWidths = Enumerable.Range(1, 5).Cast <object>().ToArray();

            gridView.AddColumn <StationStyle>(t => t.Station.SName, T._("Name"));
            gridView.AddDropDownColumn <StationStyle>(t => t.HexColor, cc.ColorHexStrings, EtoBindingExtensions.ColorBinding(cc), T._("Farbe"), true);
            gridView.AddDropDownColumn <StationStyle>(t => t.StationWidthInt, lineWidths, Binding.Delegate <int, string>(i => i.ToString()), T._("Linienstärke"), true);
            gridView.AddDropDownColumn <StationStyle>(t => t.LineStyle, ds.Indices.Cast <object>(), Binding.Delegate <int, string>(i => ds.GetDescription(i)), T._("Linientyp"), true);
            gridView.AddCheckColumn <StationStyle>(t => t.Show, T._("Station zeichnen"), true);

            gridView.DataStore = tt.Stations.Select(s => new StationStyle(s, attrs)).ToArray();

            this.AddCloseHandler();
        }
Example #2
0
 public PrintRenderer(IPluginInterface pluginInterface, int route)
 {
     this.pluginInterface = pluginInterface;
     this.tt    = pluginInterface.Timetable;
     this.route = route;
     attrs      = new TimetableStyle(tt);
 }
Example #3
0
 public PrintRenderer(IInfo info, int route)
 {
     this.info  = info;
     this.tt    = info.Timetable;
     this.route = route;
     attrs      = new TimetableStyle(tt);
 }
Example #4
0
        public ConfigForm(Timetable tt, IPluginInterface pluginInterface)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            backupHandle = pluginInterface.BackupTimetable();

            this.tt = tt;
            this.pluginInterface = pluginInterface;

            heightPerHourValidator = new NumberValidator(heightPerHourTextBox, false, false, errorMessage: "Bitte eine Zahl als Höhe pro Stunde angeben!");
            startTimeValidator     = new TimeValidator(startTimeTextBox, false, errorMessage: "Bitte eine gültige Uhrzeit im Format hh:mm angeben!");
            endTimeValidator       = new TimeValidator(endTimeTextBox, false, errorMessage: "Bitte eine gültige Uhrzeit im Format hh:mm angeben!", maximum: new TimeEntry(48, 0));
            validators             = new ValidatorCollection(heightPerHourValidator, startTimeValidator, endTimeValidator);

            DropDownBind.Color <TimetableStyle>(pluginInterface.Settings, bgColorComboBox, "BgColor");
            DropDownBind.Color <TimetableStyle>(pluginInterface.Settings, stationColorComboBox, "StationColor");
            DropDownBind.Color <TimetableStyle>(pluginInterface.Settings, timeColorComboBox, "TimeColor");
            DropDownBind.Color <TimetableStyle>(pluginInterface.Settings, trainColorComboBox, "TrainColor");

            DropDownBind.Font <TimetableStyle>(stationFontComboBox, stationFontSizeComboBox, "StationFont");
            DropDownBind.Font <TimetableStyle>(timeFontComboBox, timeFontSizeComboBox, "TimeFont");
            DropDownBind.Font <TimetableStyle>(trainFontComboBox, trainFontSizeComboBox, "TrainFont");

            DropDownBind.Width <TimetableStyle>(hourTimeWidthComboBox, "HourTimeWidth");
            DropDownBind.Width <TimetableStyle>(minuteTimeWidthComboBox, "MinuteTimeWidth");
            DropDownBind.Width <TimetableStyle>(stationWidthComboBox, "StationWidth");
            DropDownBind.Width <TimetableStyle>(trainWidthComboBox, "TrainWidth");

            var styles = new Dictionary <StationLineStyle, string>()
            {
                [StationLineStyle.None]   = "Keine",
                [StationLineStyle.Normal] = "Gerade Linien",
                [StationLineStyle.Cubic]  = "Kubische Linien",
            };

            if (tt.Version == TimetableVersion.JTG2_x)
            {
                styles.Remove(StationLineStyle.Cubic);
            }
            DropDownBind.Enum <TimetableStyle, StationLineStyle>(stationLinesDropDown, "StationLines", styles);

            heightPerHourTextBox.TextBinding.AddFloatConvBinding <TimetableStyle, TextControl>(s => s.HeightPerHour);

            startTimeTextBox.TextBinding.AddTimeEntryConvBinding <TimetableStyle, TextControl>(s => s.StartTime);
            endTimeTextBox.TextBinding.AddTimeEntryConvBinding <TimetableStyle, TextControl>(s => s.EndTime);

            includeKilometreCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.DisplayKilometre);
            drawStationNamesCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.DrawHeader);
            stationVerticalCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.StationVertical);
            multitrackCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.MultiTrack);
            networkTrainsCheckBox.CheckedBinding.BindDataContext <TimetableStyle>(s => s.DrawNetworkTrains);

            networkTrainsCheckBox.Enabled = tt.Type == TimetableType.Network;

            attrs       = new TimetableStyle(tt);
            DataContext = attrs;

            this.AddCloseHandler();
        }
Example #5
0
 public TrainRenderer(IEnumerable <Station> stations, Timetable tt, Margins margin, TimeEntry startTime, Dictionary <Station, StationRenderProps> stationOffsets)
 {
     this.stations       = stations;
     this.tt             = tt;
     this.margin         = margin;
     this.startTime      = startTime;
     this.stationOffsets = stationOffsets;
     attrs = new TimetableStyle(tt);
 }
Example #6
0
 public TrainRenderer(List <Station> stations, Timetable tt, Margins margin, TimeSpan startTime, Dictionary <Station, StationX> stationOffsets)
 {
     this.stations       = stations;
     this.tt             = tt;
     this.margin         = margin;
     this.startTime      = startTime;
     this.stationOffsets = stationOffsets;
     attrs = new TimetableStyle(tt);
 }
Example #7
0
        public void Initialize(IInfo info)
        {
            attrs = new TimetableStyle(info.Timetable);

            for (int i = 0; i < attrs.RenderDays.Length; i++)
            {
                daysBoxes[i].Checked         = attrs.RenderDays[i];
                daysBoxes[i].CheckedChanged += CheckBox_CheckedChanged;
            }
        }
Example #8
0
        public TrainColorEditForm(Train train, ISettings settings) : this(settings)
        {
            Train = train;
            style = new TrainStyle(train);
            var attrs = new TimetableStyle(train._parent);

            colorComboBox.SelectedValue = ColorFormatter.ToString(style.TrainColor ?? attrs.TrainColor);
            widthComboBox.SelectedValue = style.TrainWidth ?? attrs.TrainWidth;
            dashComboBox.SelectedValue  = style.LineStyle;
            drawCheckBox.Checked        = style.Show;
        }
Example #9
0
        public StationStyleEditForm(Station station, ISettings settings) : this(settings)
        {
            Station = station;
            style   = new StationStyle(station);
            var attrs = new TimetableStyle(station._parent);

            colorComboBox.SelectedValue = ColorFormatter.ToString(style.StationColor ?? attrs.StationColor);
            widthComboBox.SelectedValue = style.StationWidth ?? attrs.StationWidth;
            dashComboBox.SelectedValue  = style.LineStyle;
            drawCheckBox.Checked        = style.Show;
        }
Example #10
0
        public PreviewForm(IPluginInterface pluginInterface)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            this.pluginInterface              = pluginInterface;
            pluginInterface.FileStateChanged += PluginInterface_FileStateChanged;
            pluginInterface.FileOpened       += PluginInterfaceOnFileOpened;

            var mainForm = (FForm)pluginInterface.RootForm;

            if (Screen != null && mainForm.Bounds.TopRight.X + 500 < Screen.Bounds.Width)
            {
                Location = mainForm.Bounds.TopRight + new Point(10, 0);
            }

            this.SizeChanged += (s, e) => panel.Invalidate();

            routesDropDown.SelectedRouteChanged += (s, e) => ResetRenderer();
            dtc.SelectedDaysChanged             += (s, e) =>
            {
                var attrs = new TimetableStyle(pluginInterface.Timetable);
                attrs.RenderDays = dtc.SelectedDays;
                ResetRenderer();
            };

            splitCheckBox.Checked         = pluginInterface.Settings.Get <bool>("bifpl.lock-stations");
            splitCheckBox.CheckedChanged += (s, e) =>
            {
                ResetRenderer();
                pluginInterface.Settings.Set("bifpl.lock-stations", splitCheckBox.Checked.Value);
            };

            adbg = new AsyncDoubleBufferedGraph(panel, pluginInterface)
            {
                RenderingFinished = () =>
                {
                    if (scrollPosition.HasValue)
                    {
                        scrollable.ScrollPosition = scrollPosition.Value;
                    }
                    scrollPosition = null;
                }
            };

            // Initialisierung der Daten
            dtc.SelectedDays = new TimetableStyle(pluginInterface.Timetable).RenderDays;
            routesDropDown.Initialize(pluginInterface);
            routesDropDown.EnableVirtualRoutes = true;
            virtualRoutesButton.Visible        = pluginInterface.Timetable is { Type : TimetableType.Network };
        }
Example #11
0
#pragma warning restore CS0649

        public StationStyleForm(IInfo info)
        {
            this.info    = info;
            tt           = info.Timetable;
            attrs        = new TimetableStyle(tt);
            backupHandle = info.BackupTimetable();

            Eto.Serialization.Xaml.XamlReader.Load(this);

            cc = new ColorCollection(info.Settings);
            ds = new DashStyleHelper();

            gridView.AddColumn <Station>(t => t.SName, "Name");
            gridView.AddColumn <Station>(t => cc.ToName(new StationStyle(t).StationColor ?? attrs.StationColor), "Farbe");
            gridView.AddColumn <Station>(t => (new StationStyle(t).StationWidth ?? attrs.StationWidth).ToString(), "Linienstärke");
            gridView.AddColumn <Station>(t => ds.GetDescription(new StationStyle(t).LineStyle), "Linientyp");
            gridView.AddColumn <Station>(t => new StationStyle(t).Show.ToString(), "Station zeichnen");

            gridView.CellDoubleClick += (s, e) => EditColor(false);

            UpdateStations();

            this.AddCloseHandler();
        }
Example #12
0
 public HeaderRenderer(List <Station> stations, TimetableStyle attrs, int route)
 {
     this.stations = stations;
     this.route    = route;
     this.attrs    = attrs;
 }
Example #13
0
 public TimeRenderer(TimetableStyle attrs, Renderer parent)
 {
     this.attrs  = attrs;
     this.parent = parent;
 }
Example #14
0
 public HeaderRenderer(TimetableStyle attrs, PathData path)
 {
     this.path  = path;
     this.attrs = attrs;
 }
Example #15
0
 public TimeRenderer(TimetableStyle attrs)
 {
     this.attrs = attrs;
 }
Example #16
0
 public Renderer(Timetable timetable, Func <PathData> getPathData)
 {
     tt = timetable;
     this.getPathData = getPathData;
     attrs            = new TimetableStyle(tt);
 }
Example #17
0
 public Renderer(Timetable timetable, int route)
 {
     tt         = timetable;
     this.route = route;
     attrs      = new TimetableStyle(tt);
 }