public override void OnGLPaint(C2DGraphics gr) { base.OnGLPaint(gr); if ((Text == null) || (Text.Length == 0)) return; if (mGLFontCache == null) { mGLFontCache = gr.GetFont(mGLFont); if (mGLFontCache == null) return; } gr.SetColor(Style.ForeColor); int dlen = mGLFontCache.DispLength(Text); int x = (Width - dlen) / 2; if (mTextAlign == ContentAlignment.MiddleLeft) { x = 0; } else if (mTextAlign == ContentAlignment.MiddleRight) { x = Width - dlen; } int y = (Height - mGLFontCache.height) / 2; gr.Text(mGLFontCache, x, y, Text); }
public ctl3DView() { InitializeComponent(); //Visible = false; //SetupSceneTree(); m_modelAnimTmr = null; m_camera = new GLCamera(); m_axisCam = new GLCamera(); ResetCameraView(); m_isectnormal = new Engine3D.Vector3d(); mainViewSplitContainer.Panel1Collapsed = true; UVDLPApp.Instance().m_undoer.AsociateUndoButton(buttUndo); UVDLPApp.Instance().m_undoer.AsociateRedoButton(buttRedo); //glControl1. = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8); gr2d = UVDLPApp.Instance().m_2d_graphics; ctlBgndList = new List<ctlBgnd>(); guiconf = UVDLPApp.Instance().m_gui_config; guiconf.TopLevelControl = mainViewSplitContainer.Panel2; UpdateButtonList(); //guiconf.LoadConfiguration(global::UV_DLP_3D_Printer.Properties.Resources.GuiConfig); RearrangeGui(); // toplevel controls must point to this glControl1.PaintCallback += new ctlGL.delPaint(DisplayFunc); m_sliceTex = -1; RegisterCallbacks(); UVDLPApp.Instance().m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv); UVDLPApp.Instance().AppEvent += new AppEventDelegate(AppEventDel); }
public ctl3DView() { InitializeComponent(); //Visible = false; //SetupSceneTree(); m_modelAnimTmr = null; m_camera = new GLCamera(); m_axisCam = new GLCamera(); ResetCameraView(); m_isectnormal = new Engine3D.Vector3d(); mainViewSplitContainer.Panel1Collapsed = true; UVDLPApp.Instance().m_undoer.AsociateUndoButton(buttUndo); UVDLPApp.Instance().m_undoer.AsociateRedoButton(buttRedo); //glControl1. = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8); gr2d = UVDLPApp.Instance().m_2d_graphics; ctlBgndList = new List<ctlBgnd>(); guiconf = UVDLPApp.Instance().m_gui_config; // set from the main program GUIConfig guiconf.TopLevelControl = mainViewSplitContainer.Panel2; UpdateButtonList(); RearrangeGui(); // once the GUIConfig is loaded from the plugins and from the main GUIConfig, the screen is re-arranged // toplevel controls must point to this glControl1.PaintCallback += new ctlGL.delPaint(DisplayFunc); m_sliceTex = -1; RegisterCallbacks(); UVDLPApp.Instance().m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv); UVDLPApp.Instance().AppEvent += new AppEventDelegate(AppEventDel); }
public ctl3DView() { InitializeComponent(); //SetupSceneTree(); m_modelAnimTmr = null; m_camera = new GLCamera(); ResetCameraView(); m_isectnormal = new Engine3D.Vector3d(); ctlViewOptions.TreeViewHolder = mainViewSplitContainer; ctlViewOptions.LayerNumberScroll = numLayer; ctlViewOptions.ObjectInfoPanel = objectInfoPanel; ctlViewOptions.SceneControl = ctlScene1; mainViewSplitContainer.Panel1Collapsed = true; UVDLPApp.Instance().m_undoer.AsociateUndoButton(buttUndo); UVDLPApp.Instance().m_undoer.AsociateRedoButton(buttRedo); //glControl1. = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8); gr2d = UVDLPApp.Instance().m_2d_graphics; ctlBgndList = new List<ctlBgnd>(); guiconf = UVDLPApp.Instance().m_gui_config; guiconf.TopLevelControl = mainViewSplitContainer.Panel2; UpdateButtonList(); guiconf.LoadConfiguration(global::UV_DLP_3D_Printer.Properties.Resources.GuiConfig); RearrangeGui(); ctlObjScale.c3d = this; ctlObjRotate.c3d = this; ctlObjMove.c3d = this; ctlSupport.c3d = this; objectInfoPanel.c3d = this; ctlViewOptions.c3d = this; ctlMeshTools1.c3d = this; ctlScene1.c3d = this; /*ctlImageButton imbtn = new ctlImageButton(); imbtn.BackColor = System.Drawing.Color.Navy; imbtn.CheckImage = null; imbtn.Image = global::UV_DLP_3D_Printer.Properties.Resources.homeButt; imbtn.Location = new System.Drawing.Point(200, 200); imbtn.Name = "buttGlHome"; imbtn.Size = new System.Drawing.Size(48, 48); imbtn.TabIndex = 16; imbtn.Visible = true; mainViewSplitContainer.Panel2.Controls.Add(imbtn); imbtn.BringToFront();*/ //buttGlHome.GLVisible = true; //buttGlHome.BackColor = Color.Transparent; //buttGlHome.FixStyle(); //buttGlHome.BackColor = Color.FromArgb(60,0,0,0); m_sliceTex = -1; }
public override void Show(C2DGraphics g2d, int w, int h) { if (!visible) return; int iw = 0, ih = 0; g2d.GetImageDim(imgname, ref iw, ref ih); int px = GuiConfig.GetPosition(0, w, iw, x, docking[1]); int py = GuiConfig.GetPosition(0, h, ih, y, docking[0]); g2d.SetColor(color); g2d.Image(imgname, px, py); }
public override void OnGLPaint(C2DGraphics gr) { base.OnGLPaint(gr); if (mGLImageCach == null) { mGLImageCach = gr.GetImage(mGLImage); if (mGLImageCach == null) return; gr.SetColor(Style.ForeColor); gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height); } }
public override void Show(C2DGraphics g2d, int w, int h) { int px, py, pw, ph; switch (docking) { case "t": px = 0; py = 0; pw = w; ph = bw; break; case "b": px = 0; py = h - bw; pw = w; ph = bw; break; case "l": px = 0; py = 0; pw = bw; ph = h; break; case "r": px = w - bw; py = 0; pw = bw; ph = h; break; default: px = 0; py = 0; pw = w; ph = h; break; } g2d.GradientRect(px, py, pw, ph, coltl, coltr, colbl, colbr); }
public ctl3DView() { InitializeComponent(); //SetupSceneTree(); m_modelAnimTmr = null; m_camera = new GLCamera(); ResetCameraView(); ctlViewOptions.TreeViewHolder = mainViewSplitContainer; ctlViewOptions.LayerNumberScroll = numLayer; ctlViewOptions.ObjectInfoPanel = objectInfoPanel; ctlViewOptions.SceneControl = ctlScene1; mainViewSplitContainer.Panel1Collapsed = true; UVDLPApp.Instance().m_undoer.AsociateUndoButton(buttUndo); UVDLPApp.Instance().m_undoer.AsociateRedoButton(buttRedo); //glControl1. = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8); gr2d = new C2DGraphics(); ctlBgndList = new List<ctlBgnd>(); guiconf = new GuiConfig(); UpdateButtonList(); guiconf.LoadConfiguration(global::UV_DLP_3D_Printer.Properties.Resources.GuiConfig); guiconf.LayoutGui(Width, Height); ctlObjScale.c3d = this; ctlObjRotate.c3d = this; ctlObjMove.c3d = this; ctlSupport.c3d = this; objectInfoPanel.c3d = this; ctlViewOptions.c3d = this; ctlMeshTools1.c3d = this; ctlScene1.c3d = this; m_sliceTex = -1; }
public virtual void GLRedraw(C2DGraphics gr, int x, int y) { if (!GLVisible || !Visible) return; gr.SetDrawingRegion(x, y, Width, Height); OnGLBackgroundPaint(gr); OnGLPaint(gr); foreach (Control subctl in Controls) { if (subctl.GetType().IsSubclassOf(typeof(ctlUserPanel))) { ((ctlUserPanel)subctl).GLRedraw(gr, x + subctl.Location.X, y + subctl.Location.Y); } } }
public abstract void Show(C2DGraphics g2d, int w, int h);
public override void OnGLPaint(C2DGraphics gr) { base.OnGLPaint(gr); if (mGLImageCach == null) { mGLImageCach = gr.GetImage(mGLImage); if (mGLImageCach == null) return; mSubImgWidth = mGLImageCach.w / Style.SubImgCount; } GuiControlStyle stl = Style; if (stl.SubImgCount == 4) GLPaint4(gr); if (stl.SubImgCount == 1) GLPaint1(gr, stl); C2DImage cimg = stl.CheckedImageCach; if (Enabled && (cimg != null)) { int chimgw = cimg.w / 2; int posx = Checked ? chimgw : 0; gr.SetColor(stl.CheckedColor); gr.Image(cimg, posx, 0, chimgw, cimg.h, 0, 0, Width, Height); } }
void GLPaint1(C2DGraphics gr, GuiControlStyle stl)
public virtual void OnGLBackgroundPaint(C2DGraphics gr) { if (mGLBackgroundImage != null) { gr.Panel9(mGLBackgroundImage, 0, 0, Width, Height); return; } gr.Rectangle(0, 0, Width, Height, Style.BackColor); }
public virtual void OnGLPaint(C2DGraphics gr) { }
void GLPaint1(C2DGraphics gr, ButtonStyle stl) { if (Enabled == false) { gr.SetColor(stl.DisabledColor); } else { switch (mCtlState) { case CtlState.Hover: if (Checked) gr.SetColor(stl.CheckedColor); else gr.SetColor(stl.HoverColor); break; case CtlState.Normal: if (Checked) gr.SetColor(stl.CheckedColor); else gr.SetColor(stl.ForeColor); break; case CtlState.Pressed: gr.SetColor(stl.PressedColor); break; } } if (mCtlState == CtlState.Hover) { float scx = (float)Width / 16f; float scy = (float)Height / 16f; gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, -scx, -scy, Width + 2f * scx, Height + 2f * scy); } else { gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height); } }
public void DrawBackground(C2DGraphics g2d, int w, int h) { Draw(BgndDecorList, g2d, w, h); }
void Draw(List<DecorItem> dlist, C2DGraphics g2d, int w, int h) { foreach (DecorItem di in dlist) { di.Show(g2d, w, h); } }
void GLPaint1(C2DGraphics gr, GuiControlStyle stl) { gr.SetColor(GetPaintColor(stl)); float scale = 1; if (mCtlState == CtlState.Hover) scale = (float)stl.HoverSize / 100f; if (mCtlState == CtlState.Pressed) scale = (float)stl.PressedSize / 100f; if ((scale < 0.999f) || (scale > 1.001f)) { float w = (float)Width * scale; float h = (float)Height * scale; float scx = ((float)Width - w) / 2f; float scy = ((float)Height - h) / 2f; gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, scx, scy, w, h); } else { gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height); } }
void GLPaint4(C2DGraphics gr) { int index = (int)mCtlState; if (Enabled == false) index = 3; if (mGLImageCach != null) { gr.SetColor(Color.White); mSrcrc.X = mSubImgWidth * index; gr.Image(mGLImageCach, mSubImgWidth * index, 0, mSubImgWidth, mGLImageCach.h, 0, 0, Width, Height); /*if (Enabled && (mCheckImage != null)) { mCheckrc.X = Checked ? mSubChkImgWidth : 0; gr.DrawImage(mCheckImage, mDstrc, mCheckrc, GraphicsUnit.Pixel); }*/ } }
public void DrawForeground(C2DGraphics g2d, int w, int h) { Draw(FgndDecorList, g2d, w, h); }
public virtual void GLRedraw(C2DGraphics gr) { GLRedraw(gr, Location.X, Location.Y); }
private UVDLPApp() { m_supportmode = eSupportEditMode.eNone; SceneFileName = ""; m_callbackhandler = new CallbackHandler(); m_appconfig = new AppConfig(); m_printerinfo = new MachineConfig(); m_buildparms = new SliceBuildConfig(); m_deviceinterface = new DeviceInterface(); m_buildmgr = new BuildManager(); m_slicer = new Slicer(); m_slicer.m_slicemethod = Slicer.eSliceMethod.eNormalCount;// configure the slicer to user the new normal count - Thanks Shai!!! m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv); //m_dispmgr = DisplayManager.Instance(); // initialize the singleton for early event app binding //m_flexslice = new FlexSlice(); m_gcode = new GCodeFile(""); // create a blank gcode to start with m_supportconfig = new SupportConfig(); m_supportgenerator = new SupportGenerator(); m_supportgenerator.SupportEvent+= new SupportGeneratorEvent(SupEvent); CSG.Instance().CSGEvent += new CSG.CSGEventDel(CSGEvent); m_proj_cmd_lst = new prjcmdlst(); m_plugins = new List<PluginEntry>(); // list of user plug-ins m_pluginstates = PluginStates.Instance(); // initialize the plugin state singleton m_undoer = new Undoer(); m_2d_graphics = new C2DGraphics(); m_gui_config = new GuiConfigManager(); m_AuxBuildCmds = AuxBuildCmds.Instance(); // make sure the singleton doesn't go away... m_sequencemanager = SequenceManager.Instance(); m_exporter = new frmExport(); m_exporter.RegisterExporter(new B9JExporter()); }
private UVDLPApp() { m_callbackhandler = new CallbackHandler(); m_appconfig = new AppConfig(); m_printerinfo = new MachineConfig(); m_buildparms = new SliceBuildConfig(); m_deviceinterface = new DeviceInterface(); m_buildmgr = new BuildManager(); m_slicer = new Slicer(); m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv); //m_dispmgr = DisplayManager.Instance(); // initialize the singleton for early event app binding //m_flexslice = new FlexSlice(); m_gcode = new GCodeFile(""); // create a blank gcode to start with m_supportconfig = new SupportConfig(); m_supportgenerator = new SupportGenerator(); m_supportgenerator.SupportEvent+= new SupportGeneratorEvent(SupEvent); CSG.Instance().CSGEvent += new CSG.CSGEventDel(CSGEvent); m_proj_cmd_lst = new prjcmdlst(); m_plugins = new List<PluginEntry>(); // list of user plug-ins m_undoer = new Undoer(); m_2d_graphics = new C2DGraphics(); m_gui_config = new GuiConfig(); }