public BrushList(InkControl control) { InitializeComponent(); this.control = control; if (eraserWhite == null) { eraserWhite = ResManager.LoadIcon("eraserWhite.svg", Util.GetGUISize()); } if (eraserAll == null) { eraserAll = ResManager.LoadIcon("eraserAll.svg", Util.GetGUISize()); } var colors = control.Page.GetListOfBrushes(); imageList1.ImageSize = new Size(Util.GetGUISize(), Util.GetGUISize()); lvBrushes.Items.Add("All", 0); imageList1.Images.Add(eraserAll); foreach (Color c in colors) { ListViewItem itm = new ListViewItem(ColorTranslator.ToHtml(c)); itm.ImageIndex = imageList1.Images.Count; itm.Tag = c; Bitmap icon = CreateIcon(c); imageList1.Images.Add(icon); lvBrushes.Items.Add(itm); } Icon = Program.WindowIcon; }
public LayoutEditor(KPage page, InkControl inkControl = null) { InitializeComponent(); this.page = page; this.inkControl = inkControl; //backgroundSelectPanel1.ItemClicked += BackgroundSelectPanel1_ItemClicked; label1.Text = (page.Border / 10f) + "cm"; this.StartPosition = FormStartPosition.CenterParent; cbShowDate.Checked = page.ShowDate; cbInvertColor.Checked = page.Filter != ColorFilter.Normal; lvBackgrounds.SelectedIndexChanged += LvBackgrounds_SelectedIndexChanged; createBackgroundList(page.Background != null ? page.Background.GetType() : null); this.BackColor = Style.Default.MenuBackground; this.ForeColor = Style.Default.MenuForeground; foreach (Control control in Controls) { if (control is Button) { control.BackColor = Style.Default.MenuContrast; } } Translator.Translate(this); }
public TextBoxInput(Forms.TextBox tb, InkControl parent) { InitializeComponent(); Translator.Translate(this); this.tb = tb; tbContent.Text = tb.Text; this.ink = parent; SetParent(Handle, parent.Handle); this.Text = Language.GetText("Dialog.textBox"); this.Icon = Icon.FromHandle(Forms.TextBox.BitmapTB.GetHicon()); foreach (FontFamily ff in FontFamily.Families) { cbFontFamilies.Items.Add(ff.Name); } cbFontFamilies.Text = tb.FontFamily; numFontSize.Value = (decimal)tb.FontSize; foreach (string name in Enum.GetNames(typeof(Renderer.BaseRenderer.TextAlign))) { cbAlignment.Items.Add(name); } CloseAll(); if (!opened.Contains(this)) { opened.Add(this); } this.FormClosing += TextBoxInput_FormClosing; }
public NewDocumentDialog(InkControl control, KDocument doc, MainWindow window) { InitializeComponent(); this.control = control; this.doc = doc; this.window = window; this.BackColor = Style.Default.MenuBackground; this.ForeColor = Style.Default.MenuForeground; this.Width = 5 * Util.GetGUISize(); this.Dock = DockStyle.Left; formats = PageFormat.GetFormats(); foreach (var f in formats) { cbPageFormat.Items.Add(f.Key); } foreach (ColorFilter filter in Enum.GetValues(typeof(ColorFilter))) { cbFilters.Items.Add(Language.GetText($"Newdoc.filter.{filter}")); } cbFilters.Text = Language.GetText($"Newdoc.filter.{ColorFilter.Normal}"); if (formats.ContainsKey(Configuration.DefaultFormat)) { cbPageFormat.Text = Configuration.DefaultFormat; } else { cbPageFormat.Text = cbPageFormat.Items[0].ToString(); } Translator.Translate(this); }
public Ruler(InkControl parent) { this.parent = parent; size = Util.MmToPoint(Configuration.RulerSize); grip = Util.MmToPoint(5); base.transformScale = false; }
public void Click(InkControl parent) { parent.SelectLines(new Line[] { this }); var editor = new Dialogues.TextBoxInput(this, parent); editor.Show(); parent.HideSelectionMenu(); }
public Compass(InkControl control) { ballRad = Util.MmToPoint(10); rad = Util.MmToPoint(50); parent = control; base.transformRotate = false; base.transformScale = false; }
public PageAdder(InkControl control, KDocument document) { InitializeComponent(); isPosition = new ItemSelector(); isPosition.Dock = DockStyle.Top; Controls.Add(isPosition); isPosition.SendToBack(); this.control = control; this.document = document; this.Width = 5 * Util.GetGUISize(); this.Dock = DockStyle.Left; comboBox1.Height = Util.GetGUISize(); comboBox1.Font = new Font(comboBox1.Font.FontFamily, Util.GetGUISize() / 2, GraphicsUnit.Pixel); panelBottom.Height = Util.GetGUISize(); btnAdd.Width = 3 * Util.GetGUISize(); isPosition.Height = 3 * Util.GetGUISize(); this.ClientSize = new Size(8 * Util.GetGUISize(), 6 * Util.GetGUISize()); var padding = this.Padding; padding.Top = Util.GetGUISize() / 2; this.Padding = padding; this.BackColor = Style.Default.MenuBackground; panelBottom.BackColor = Style.Default.MenuContrast; this.ForeColor = Style.Default.MenuForeground; comboBox1.BackColor = Style.Default.MenuContrast; comboBox1.ForeColor = Style.Default.MenuForeground; isPosition.ForeColor = Style.Default.MenuForeground; formats = PageFormat.GetFormats(); foreach (var f in formats) { comboBox1.Items.Add(f.Key); } if (formats.ContainsKey(document.DefaultFormat)) { comboBox1.Text = document.DefaultFormat; } else { comboBox1.Text = comboBox1.Items[0].ToString(); } Dialogues.Translator.Translate(this); isPosition.Items = new string[] { Language.GetText("Newpage.beforeCurrent"), Language.GetText("Newpage.afterCurrent"), Language.GetText("Newpage.atEnd") }; isPosition.SelectedIndex = 1; }
public TransformerRotate(KPage page, InkControl control) { rad = (int)(42 * Util.GetScaleFactor()); width = (int)(10 * Util.GetScaleFactor()); this.page = page; this.control = control; if (img == null) { imRect = new Rectangle(width * -2, -rad - width, width * 4, width * 2); Bitmap bmp = ResManager.LoadIcon("gui/rotator.svg", imRect.Width, imRect.Height); img = new Renderer.Image(bmp); } }
public PageList(KDocument doc, InkControl cltr) { InitializeComponent(); this.doc = doc; this.cltr = cltr; for (int i = 0; i < doc.Pages.Count; i++) { KPage page = doc.Pages[i]; int imgInd = imgList.Images.Count; imgList.Images.Add(page.GetThumbnail(imgList.ImageSize.Width, imgList.ImageSize.Height, Color.Transparent, Color.Teal, 4)); ListViewItem itm = new ListViewItem($"Page {i + 1}"); itm.ImageIndex = imgInd; itm.Tag = page; listView1.Items.Add(itm); } }
public TransformerTranslate(KPage page, InkControl control, params Transformer[] transformer) { innerRad = (int)(20 * Util.GetScaleFactor()); if (img == null || img.IsDisposed) { Bitmap bmp = ResManager.LoadIcon("gui/translator.svg", innerRad); img = new Renderer.Image(bmp); } this.control = control; this.page = page; this.pageVersion = page.Version; this.transformer = transformer; int c = 0; float _x = 0, _y = 0; selectedLines = new bool[page.LineCount]; for (int i = 0; i < page.LineCount; i++) { Line l = page.GetLine(i); if (l.Selected) { PointF center = new PointF(l.Bounds.X + l.Bounds.Width / 2, l.Bounds.Y + l.Bounds.Height / 2); _x += center.X; _y += center.Y; c++; } selectedLines[i] = l.Selected; } _x /= c; _y /= c; //control.GetTransform().Transform(ref _x, ref _y); //PointF pf = control.GetTransform().GetTranslation(); x = (int)(_x); y = (int)(_y); this.Others = new List <Transformer>(this.transformer); this.Others.Add(this); foreach (Transformer trans in this.transformer) { trans.SetPosition(x, y); trans.Others = this.Others; } }
public CastDialog(InkControl ink) { InitializeComponent(); this.ink = ink; this.Text = Language.GetText("File.cast"); Dialogues.Translator.Translate(this); string localIP; using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0)) { socket.Connect("8.8.8.8", 65530); IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint; localIP = endPoint.Address.ToString(); } lblCurrentIP.Text = Language.GetText("Cast.http.cip") + " " + localIP; lblCurrentIP.Tag = localIP; tbWebId.Text = Util.GetUsername() + "-cast"; }
public FileMenu(InkControl control, KDocument document, Form parent, MainWindow window) { InitializeComponent(); this.Font = new Font(this.Font.FontFamily, this.Font.Size * Util.GetScaleFactor()); this.Width = 5 * Util.GetGUISize(); this.control = control; this.document = document; this.parent = parent; this.window = window; this.BackColor = Style.Default.MenuBackground; this.ForeColor = Style.Default.MenuForeground; foreach (Control c in this.Controls) { if (c is Button) { c.Height = Util.GetGUISize(); c.Text = Language.GetText(c.Text); } } btnClose.Image = ResManager.LoadIcon("hamburger.svg", Util.GetGUISize()); /*btnNew.Image = ResManager.LoadIcon("new.svg", Util.GetGUISize()); * btnOpen.Image = ResManager.LoadIcon("open.svg", Util.GetGUISize()); * btnSave.Image = ResManager.LoadIcon("null", Util.GetGUISize()); * btnSaveAs.Image = ResManager.LoadIcon("save.svg", Util.GetGUISize()); * btnAddPage.Image = ResManager.LoadIcon("addPage.svg", Util.GetGUISize());*/ btnSave.Enabled = document.FilePath != ""; bool casting = HTTPCast.IsCasting | WebCast.IsCasting; if (casting) { btnCast.Text = Language.GetText("File.stopCast"); } btnSave.Enabled = !document.IsSaved(); }
public PenMenu(InkControl control) { InitializeComponent(); this.control = control; this.Mode = control.InkMode; this.Font = new Font(this.Font.FontFamily, this.Font.Size * Util.GetScaleFactor()); int guiSize = Util.GetGUISize(); this.Width = guiSize * Configuration.PenSizeNum; panelBottom.Height = guiSize; BackColor = Style.Default.MenuBackground; ForeColor = Style.Default.MenuForeground; panel1.BackColor = Style.Default.MenuForeground; foreach (Control cltr in Controls) { if (cltr is Button) { cltr.Height = Util.GetGUISize(); cltr.Text = Language.GetText(cltr.Text); } } if (bmpEraser == null) { bmpEraser = ResManager.LoadIcon("eraserAll.svg", Util.GetGUISize()); } int btnSize = Util.GetGUISize(); btnLine.Image = Forms.LinearLine.BitmapLL; btnRect.Image = Forms.Rect.BitmapRect; btnCircle.Image = Forms.Arc.BitmapArc; btnArc2.Image = Forms.Arc2.BitmapArc2; btnStroke.Image = Line.BitmapStrk; btnRuler.Image = Ruler.Icon; btnCompass.Image = Compass.Icon; btnTextBox.Image = Forms.TextBox.BitmapTB; btnAddImage.Image = Forms.ImageObject.IconPhoto; if (control.EraserColor == Color.Transparent) { btnEraser.Image = bmpEraser; } else { btnEraser.Image = Dialogues.BrushList.CreateIcon(control.EraserColor); } for (int i = 0; i < Configuration.PenSizeNum; i++) { float size = Configuration.PenSizeMin + i * (Configuration.PenSizeMax - Configuration.PenSizeMin) / (float)(Configuration.PenSizeNum - 1); Button btn = new Button(); Bitmap bmp = new Bitmap(guiSize, guiSize); Graphics g = Graphics.FromImage(bmp); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; g.FillEllipse(Brushes.Black, new RectangleF(guiSize / 2 - size, guiSize / 2 - size, size * 2, size * 2)); g.Dispose(); btn.BackgroundImage = bmp; btn.Bounds = new Rectangle(i * guiSize, 0, guiSize, guiSize); panelBottom.Controls.Add(btn); btn.Tag = size; btn.Click += Btn_Click; btn.FlatStyle = FlatStyle.Flat; btn.FlatAppearance.BorderSize = 0; if (control.Thicknes == size) { btn.BackColor = Style.Default.Selection; } } hasRuler = false; hasCompass = false; foreach (var obj in control.ScreenObjects) { if (obj is Ruler) { hasRuler = true; } if (obj is Compass) { hasCompass = true; } } if (hasRuler) { btnRuler.BackColor = Style.Default.MenuContrast; } if (hasCompass) { btnCompass.BackColor = Style.Default.MenuContrast; } this.Dock = DockStyle.Right; }