예제 #1
0
        public TemplateSelector(NuGenEventHandler handler, NuGenPopupMenu parent):base(handler, parent)
		{
            this.templ = handler.GetTemplates();
			selectListen = handler.GetTemplListener();
			
			// setUndecorated(true);
			System.Windows.Forms.ContainerControl temp_Container;
			temp_Container = new System.Windows.Forms.ContainerControl();
			temp_Container.Parent = this;
			// temp_Container.setWindowDecorationStyle(JRootPane.NONE);
			//UPGRADE_TODO: Method 'java.awt.Component.setSize' was converted to 'System.Windows.Forms.Control.Size' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetSize_int_int'"
			Size = new System.Drawing.Size(WIDTH + 10, HEIGHT + 5);
			
			content = new TemplateBorder();
			content.Dock = System.Windows.Forms.DockStyle.Fill;
			Controls.Add(content);
			
			System.Drawing.Color bckgr = BackColor;
			//UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getRed' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
			//UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getGreen' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
			//UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getBlue' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
            System.Drawing.Color shade1 = Color.WhiteSmoke;// System.Drawing.Color.FromArgb(System.Math.Max((int)bckgr.R - 8, 0), System.Math.Max((int)bckgr.G - 8, 0), (int)bckgr.B);
			//UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getRed' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
			//UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getGreen' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
			//UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getBlue' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
			System.Drawing.Color shade2 = System.Drawing.Color.FromArgb(System.Math.Max((int) bckgr.R - 16, 0), System.Math.Max((int) bckgr.G - 16, 0), (int) bckgr.B);
			
			for (int n = 0; n < NUM_WIDGETS; n++)
				if (n < templ.NumTemplates())
				{
					pics[n] = new EditorPane(MOL_WIDTH, MOL_HEIGHT, true);
					pics[n].SetEditable(false);
					pics[n].BackColor = shade1;
					pics[n].Replace(templ.GetTemplate(n));
					pics[n].ScaleToFit();
					//UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
					content.Controls.Add(pics[n]);
					//UPGRADE_TODO: Method 'java.awt.Component.setLocation' was converted to 'System.Windows.Forms.Control.Location' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetLocation_int_int'"
					pics[n].Location = new System.Drawing.Point(FRAME_SIZE + MOL_WIDTH * (n % MOL_COL) + 5, FRAME_SIZE + MOL_HEIGHT * (n / MOL_COL) + 5);
					pics[n].SetToolCursor();
					pics[n].SetMolSelectListener((MolSelectListener)this);
				}
			//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
			numPages = (int) System.Math.Ceiling(templ.NumTemplates() / (double) NUM_WIDGETS);

            content.BackColor = Color.DimGray;

            this.Size = new Size(content.Size.Width, content.Size.Height - 10);
            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;
			
			// addWindowFocusListener(this);
		}
예제 #2
0
        public void Init(System.String LoadFN, bool StreamMode)
        {
			streamMode = StreamMode;
			
			// application
			
//			Closing += new System.ComponentModel.CancelEventHandler(this.MainWindow_Closing_DISPOSE_ON_CLOSE);
			// JFrame.setDefaultLookAndFeelDecorated(false);
			
			//UPGRADE_ISSUE: Constructor 'javax.swing.Image.Image' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingImageIconImageIcon_javanetURL'"
			//GetType();
			//UPGRADE_TODO: Method 'java.lang.Class.getResource' was converted to 'System.Uri' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangClassgetResource_javalangString'"
            
            mainIcon = new Bitmap(Utility.GetFullPath("images\\MainIcon.png"));
			//Icon = System.Drawing.Icon.FromHandle(((System.Drawing.Bitmap) mainIcon).GetHicon());
			//UPGRADE_ISSUE: Constructor 'javax.swing.Image.Image' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingImageIconImageIcon_javanetURL'"
			GetType();
			//UPGRADE_TODO: Method 'java.lang.Class.getResource' was converted to 'System.Uri' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangClassgetResource_javalangString'"
            mainLogo = new Bitmap(Utility.GetFullPath("/images/MainLogo.png"));


            templ = new Templates();
			
			// toolbar

			ImageList temp_ImageList;
			temp_ImageList = new System.Windows.Forms.ImageList();
			// temp_ToolBar = new System.Windows.Forms.ToolBar();
            toolButtons = new Button[TOOL_COUNT];
			//UPGRADE_TODO: Class 'javax.swing.Image' was converted to 'System.Drawing.Image' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingImageIcon'"
			toolIcons = new System.Drawing.Image[TOOL_COUNT];
			//UPGRADE_TODO: Class 'javax.swing.ButtonGroup' was converted to 'System.Collections.IList' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
			toolGroup = new ArrayList();
			for (int n = 0; n < TOOL_COUNT; n++)
			{
				//UPGRADE_TODO: Method 'java.lang.Class.getResource' was converted to 'System.Uri' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangClassgetResource_javalangString'"
				toolIcons[n] = new Bitmap(Utility.GetFullPath("/images/" + IMAGE_TOOL[n] + ".png"));
				if (ACTIVE_TOOL[n])
				{
                    toolButtons[n] = new Button();
                    toolButtons[n].Image = toolIcons[n]; 
					toolGroup.Add((System.Object) toolButtons[n]);
					System.Windows.Forms.ToolBarButton temp_ToolBarButton;
					//UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
					// tools.Items.Add(toolButtons[n]);
                    SupportClass.CommandManager.CheckCommand(toolButtons[n]);
                    SupportClass.ToolTipSupport.setToolTipText(toolButtons[n], TOOL_TIPS[n]);
				}
				/*else {toolButtons[n]=new JButton(toolIcons[n]);
				tools.Add(toolButtons[n]);
				toolButtons[n].addActionListener(this);}*/
			}
			//UPGRADE_TODO: Method 'javax.swing.AbstractButton.getModel' was converted to 'ToolStripButtonBase' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
			SupportClass.ButtonGroupSupport.SetSelected(toolGroup, toolButtons[TOOL_CURSOR], true);
			
			toolButtons[TOOL_SETATOM].MouseDown += new System.Windows.Forms.MouseEventHandler(mouseDown);
			toolButtons[TOOL_SETATOM].MouseDown += new System.Windows.Forms.MouseEventHandler(this.mousePressed);
			toolButtons[TOOL_SETATOM].KeyDown += new System.Windows.Forms.KeyEventHandler(keyDown);
			toolButtons[TOOL_SETATOM].KeyDown += new System.Windows.Forms.KeyEventHandler(this.keyPressed);
			toolButtons[TOOL_SETATOM].KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.keyTyped);
			toolButtons[TOOL_TEMPLATE].MouseDown += new System.Windows.Forms.MouseEventHandler(mouseDown);
			toolButtons[TOOL_TEMPLATE].MouseDown += new System.Windows.Forms.MouseEventHandler(this.mousePressed);
			
			SelectElement("C");
			
			// menus
			
			System.Windows.Forms.MainMenu menubar = new System.Windows.Forms.MainMenu();
			
			System.Windows.Forms.MenuItem menufile = new System.Windows.Forms.MenuItem("&File");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			// menufile.setMnemonic((int) System.Windows.Forms.Keys.F);
			menufile.MenuItems.Add(MenuItem("New", (int) System.Windows.Forms.Keys.N, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('N' | (int) System.Windows.Forms.Keys.Control))));
			menufile.MenuItems.Add(MenuItem("New Window", (int) System.Windows.Forms.Keys.W, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('N' | (int) System.Windows.Forms.Keys.Control + (int) System.Windows.Forms.Keys.Shift))));
			menufile.MenuItems.Add(MenuItem("Open", (int) System.Windows.Forms.Keys.O, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('O' | (int) System.Windows.Forms.Keys.Control))));
			if (!streamMode)
				menufile.MenuItems.Add(MenuItem("Save", (int) System.Windows.Forms.Keys.S, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('S' | (int) System.Windows.Forms.Keys.Control))));
			menufile.MenuItems.Add(MenuItem("Save As", (int) System.Windows.Forms.Keys.A));
			System.Windows.Forms.MenuItem menuexport = new System.Windows.Forms.MenuItem("&Export");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			// menuexport.setMnemonic((int) System.Windows.Forms.Keys.X);
			menuexport.MenuItems.Add(MenuItem("as MDL MOL", (int) System.Windows.Forms.Keys.M, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('M' | (int) System.Windows.Forms.Keys.Control + (int) System.Windows.Forms.Keys.Shift))));
			menuexport.MenuItems.Add(MenuItem("as CML XML", (int) System.Windows.Forms.Keys.X, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('X' | (int) System.Windows.Forms.Keys.Control + (int) System.Windows.Forms.Keys.Shift))));
			menufile.MenuItems.Add(menuexport);
			menufile.MenuItems.Add(new System.Windows.Forms.MenuItem("-"));
			if (!streamMode)
				menufile.MenuItems.Add(MenuItem("Quit", (int) System.Windows.Forms.Keys.Q, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('Q' | (int) System.Windows.Forms.Keys.Control))));
			else
				menufile.MenuItems.Add(MenuItem("Save & Quit", (int) System.Windows.Forms.Keys.Q, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('Q' | (int) System.Windows.Forms.Keys.Control))));
			
			System.Windows.Forms.MenuItem menuedit = new System.Windows.Forms.MenuItem("&Edit");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			// menuedit.setMnemonic((int) System.Windows.Forms.Keys.E);
			menuedit.MenuItems.Add(MenuItem("Edit...", (int) System.Windows.Forms.Keys.E, toolIcons[TOOL_DIALOG], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) (' ' | (int) System.Windows.Forms.Keys.Control))));
			menuedit.MenuItems.Add(MenuItem("Undo", (int) System.Windows.Forms.Keys.U, toolIcons[TOOL_UNDO], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('Z' | (int) System.Windows.Forms.Keys.Control))));
			menuedit.MenuItems.Add(MenuItem("Redo", (int) System.Windows.Forms.Keys.R, toolIcons[TOOL_REDO], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('Z' | (int) System.Windows.Forms.Keys.Control + (int) System.Windows.Forms.Keys.Shift))));
			menuedit.MenuItems.Add(MenuItem("Cut", (int) System.Windows.Forms.Keys.X, toolIcons[TOOL_CUT], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('X' | (int) System.Windows.Forms.Keys.Control))));
			menuedit.MenuItems.Add(MenuItem("Copy", (int) System.Windows.Forms.Keys.C, toolIcons[TOOL_COPY], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('C' | (int) System.Windows.Forms.Keys.Control))));
			menuedit.MenuItems.Add(MenuItem("Paste", (int) System.Windows.Forms.Keys.V, toolIcons[TOOL_PASTE], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('V' | (int) System.Windows.Forms.Keys.Control))));
			menuedit.MenuItems.Add(new System.Windows.Forms.MenuItem("-"));
			menuedit.MenuItems.Add(MenuItem("Select All", (int) System.Windows.Forms.Keys.S, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('A' | (int) System.Windows.Forms.Keys.Control))));
			menuedit.MenuItems.Add(MenuItem("Next Atom", (int) System.Windows.Forms.Keys.N, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('E' | (int) System.Windows.Forms.Keys.Control))));
			menuedit.MenuItems.Add(MenuItem("Previous Atom", (int) System.Windows.Forms.Keys.P, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('E' | (int) System.Windows.Forms.Keys.Control + (int) System.Windows.Forms.Keys.Shift))));
			menuedit.MenuItems.Add(MenuItem("Next Group", (int) System.Windows.Forms.Keys.G, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('G' | (int) System.Windows.Forms.Keys.Control))));
			menuedit.MenuItems.Add(MenuItem("Previous Group", (int) System.Windows.Forms.Keys.R, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('G' | (int) System.Windows.Forms.Keys.Control + (int) System.Windows.Forms.Keys.Shift))));
			menuedit.MenuItems.Add(new System.Windows.Forms.MenuItem("-"));
			menuedit.MenuItems.Add(MenuItem("Flip Horizontal", (int) System.Windows.Forms.Keys.H, null, null));
			menuedit.MenuItems.Add(MenuItem("Flip Vertical", (int) System.Windows.Forms.Keys.V, null, null));
			menuedit.MenuItems.Add(MenuItem("Rotate +45°", (int) System.Windows.Forms.Keys.D4, null, null));
			menuedit.MenuItems.Add(MenuItem("Rotate -45°", (int) System.Windows.Forms.Keys.D5, null, null));
			menuedit.MenuItems.Add(MenuItem("Rotate +90°", (int) System.Windows.Forms.Keys.D9, null, null));
			menuedit.MenuItems.Add(MenuItem("Rotate -90°", (int) System.Windows.Forms.Keys.D0, null, null));
			menuedit.MenuItems.Add(new System.Windows.Forms.MenuItem("-"));
			menuedit.MenuItems.Add(MenuItem("Add Temporary Template", (int) System.Windows.Forms.Keys.T, null, null));
			menuedit.MenuItems.Add(MenuItem("Normalise Bond Lengths", (int) System.Windows.Forms.Keys.N, null, null));
			
			System.Windows.Forms.MenuItem menuview = new System.Windows.Forms.MenuItem("&View");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			// menuview.setMnemonic((int) System.Windows.Forms.Keys.V);
			menuview.MenuItems.Add(MenuItem("Zoom Full", (int) System.Windows.Forms.Keys.F, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('0' | (int) System.Windows.Forms.Keys.Control))));
			menuview.MenuItems.Add(MenuItem("Zoom In", (int) System.Windows.Forms.Keys.I, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('=' | (int) System.Windows.Forms.Keys.Control))));
			menuview.MenuItems.Add(MenuItem("Zoom Out", (int) System.Windows.Forms.Keys.O, null, new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('-' | (int) System.Windows.Forms.Keys.Control))));
			menuview.MenuItems.Add(new System.Windows.Forms.MenuItem("-"));
			//UPGRADE_TODO: Class 'javax.swing.ButtonGroup' was converted to 'System.Collections.IList' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
			System.Collections.IList showBG = new ArrayList();
			menuview.MenuItems.Add(RadioMenuItem("Show Elements", (int) System.Windows.Forms.Keys.E, true, showBG));
			menuview.MenuItems.Add(RadioMenuItem("Show All Elements", (int) System.Windows.Forms.Keys.A, false, showBG));
			menuview.MenuItems.Add(RadioMenuItem("Show Indices", (int) System.Windows.Forms.Keys.I, false, showBG));
			menuview.MenuItems.Add(RadioMenuItem("Show Ring ID", (int) System.Windows.Forms.Keys.R, false, showBG));
			menuview.MenuItems.Add(RadioMenuItem("Show CIP Priority", (int) System.Windows.Forms.Keys.C, false, showBG));
			
			System.Windows.Forms.MenuItem menutool = new System.Windows.Forms.MenuItem("&Tool");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			// menutool.setMnemonic((int) System.Windows.Forms.Keys.T);
			menutool.MenuItems.Add(MenuItem("Cursor", (int) System.Windows.Forms.Keys.C, toolIcons[TOOL_CURSOR], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ((int) System.Windows.Forms.Keys.Escape | 0))));
			menutool.MenuItems.Add(MenuItem("Rotator", (int) System.Windows.Forms.Keys.R, toolIcons[TOOL_ROTATOR], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('R' | (int) System.Windows.Forms.Keys.Control))));
			menutool.MenuItems.Add(MenuItem("Erasor", (int) System.Windows.Forms.Keys.E, toolIcons[TOOL_ERASOR], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('D' | (int) System.Windows.Forms.Keys.Control))));
			menutool.MenuItems.Add(MenuItem("Edit Atom", (int) System.Windows.Forms.Keys.A, toolIcons[TOOL_EDIT], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) (',' | (int) System.Windows.Forms.Keys.Control))));
			//UPGRADE_ISSUE: Constructor 'javax.swing.Image.Image' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingImageIconImageIcon_javanetURL'"
			GetType();
			//UPGRADE_TODO: Method 'java.lang.Class.getResource' was converted to 'System.Uri' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangClassgetResource_javalangString'"
			menutool.MenuItems.Add(MenuItem("Set Atom", (int) System.Windows.Forms.Keys.S, new Bitmap(Utility.GetFullPath("/images/ASelMenu.png")), new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('.' | (int) System.Windows.Forms.Keys.Control))));
			menutool.MenuItems.Add(MenuItem("Single Bond", (int) System.Windows.Forms.Keys.D1, toolIcons[TOOL_SINGLE], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('1' | (int) System.Windows.Forms.Keys.Control))));
			menutool.MenuItems.Add(MenuItem("Double Bond", (int) System.Windows.Forms.Keys.D2, toolIcons[TOOL_DOUBLE], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('2' | (int) System.Windows.Forms.Keys.Control))));
			menutool.MenuItems.Add(MenuItem("Triple Bond", (int) System.Windows.Forms.Keys.D3, toolIcons[TOOL_TRIPLE], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('3' | (int) System.Windows.Forms.Keys.Control))));
			menutool.MenuItems.Add(MenuItem("Zero Bond", (int) System.Windows.Forms.Keys.D0, toolIcons[TOOL_ZERO], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('0' | (int) System.Windows.Forms.Keys.Control))));
			menutool.MenuItems.Add(MenuItem("Inclined Bond", (int) System.Windows.Forms.Keys.I, toolIcons[TOOL_INCLINED]));
			menutool.MenuItems.Add(MenuItem("Declined Bond", (int) System.Windows.Forms.Keys.D, toolIcons[TOOL_DECLINED]));
			menutool.MenuItems.Add(MenuItem("Unknown Bond", (int) System.Windows.Forms.Keys.U, toolIcons[TOOL_UNKNOWN]));
			menutool.MenuItems.Add(MenuItem("Charge", (int) System.Windows.Forms.Keys.H, toolIcons[TOOL_CHARGE], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('H' | (int) System.Windows.Forms.Keys.Control))));
			menutool.MenuItems.Add(MenuItem("Template Tool", (int) System.Windows.Forms.Keys.T, toolIcons[TOOL_TEMPLATE], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('T' | (int) System.Windows.Forms.Keys.Control))));
			menutool.MenuItems.Add(MenuItem("Select Template", (int) System.Windows.Forms.Keys.T, toolIcons[TOOL_TEMPLATE], new System.Windows.Forms.KeyEventArgs((System.Windows.Forms.Keys) ('T' | (int) System.Windows.Forms.Keys.Control + (int) System.Windows.Forms.Keys.Shift))));
			System.Windows.Forms.MenuItem menuhydr = new System.Windows.Forms.MenuItem("H&ydrogen");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			// menuhydr.setMnemonic((int) System.Windows.Forms.Keys.Y);
			chkShowHydr = new System.Windows.Forms.MenuItem("Show H&ydrogen");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			// chkShowHydr.setMnemonic((int) System.Windows.Forms.Keys.Y);
			chkShowHydr.Checked = true;
			chkShowHydr.Click += new System.EventHandler(this.actionPerformed);
			SupportClass.CommandManager.CheckCommand(chkShowHydr);
			menuhydr.MenuItems.Add(chkShowHydr);
			menuhydr.MenuItems.Add(MenuItem("Set Explicit", (int) System.Windows.Forms.Keys.E));
			menuhydr.MenuItems.Add(MenuItem("Clear Explicit", (int) System.Windows.Forms.Keys.X));
			menuhydr.MenuItems.Add(MenuItem("Zero Explicit", (int) System.Windows.Forms.Keys.Z));
			menuhydr.MenuItems.Add(MenuItem("Create Actual", (int) System.Windows.Forms.Keys.C));
			menuhydr.MenuItems.Add(MenuItem("Delete Actual", (int) System.Windows.Forms.Keys.D));
			
			System.Windows.Forms.MenuItem menuster = new System.Windows.Forms.MenuItem("&Stereochemistry");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			//menuster.setMnemonic((int) System.Windows.Forms.Keys.S);
			chkShowSter = new System.Windows.Forms.MenuItem("Show Stereo&labels");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			// chkShowSter.setMnemonic((int) System.Windows.Forms.Keys.L);
			chkShowSter.Checked = false;
			chkShowSter.Click += new System.EventHandler(this.actionPerformed);
			SupportClass.CommandManager.CheckCommand(chkShowSter);
			menuster.MenuItems.Add(chkShowSter);
			menuster.MenuItems.Add(MenuItem("Invert Stereochemistry", (int) System.Windows.Forms.Keys.I));
			menuster.MenuItems.Add(MenuItem("Set R/Z", (int) System.Windows.Forms.Keys.R));
			menuster.MenuItems.Add(MenuItem("Set S/E", (int) System.Windows.Forms.Keys.S));
			menuster.MenuItems.Add(MenuItem("Cycle Wedges", (int) System.Windows.Forms.Keys.C));
			menuster.MenuItems.Add(MenuItem("Remove Wedges", (int) System.Windows.Forms.Keys.W));
			
			System.Windows.Forms.MenuItem menuhelp = new System.Windows.Forms.MenuItem("&Help");
			//UPGRADE_ISSUE: Method 'javax.swing.AbstractButton.setMnemonic' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingAbstractButtonsetMnemonic_int'"
			// menuhelp.setMnemonic((int) System.Windows.Forms.Keys.H);
			menuhelp.MenuItems.Add(MenuItem("About", (int) System.Windows.Forms.Keys.A));
			
			menubar.MenuItems.Add(menufile);
			menubar.MenuItems.Add(menuedit);
			menubar.MenuItems.Add(menuview);
			menubar.MenuItems.Add(menutool);
			menubar.MenuItems.Add(menuhydr);
			menubar.MenuItems.Add(menuster);
			//UPGRADE_ISSUE: Method 'javax.swing.Box.createHorizontalGlue' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingBox'"
			//UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
            // TODO: Figure out what horizontal glue is and find equiv
            //System.Windows.Forms.Control temp_Control;
            //temp_Control = Box.createHorizontalGlue();
            //menubar.Controls.Add(temp_Control);
			menubar.MenuItems.Add(menuhelp);
			
			// molecule
			
			editor = new EditorPane(this.Width, this.Height, false);
            editor.SetMolSelectListener((MolSelectListener)this); 
            
			//UPGRADE_TODO: Class 'javax.swing.JScrollPane' was converted to 'System.Windows.Forms.ScrollableControl' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
			//UPGRADE_TODO: Constructor 'javax.swing.JScrollPane.JScrollPane' was converted to 'System.Windows.Forms.ScrollableControl.ScrollableControl' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJScrollPaneJScrollPane_javaawtComponent'"
			System.Windows.Forms.ScrollableControl temp_scrollablecontrol;
			temp_scrollablecontrol = new System.Windows.Forms.ScrollableControl();
			temp_scrollablecontrol.AutoScroll = true;
			temp_scrollablecontrol.Controls.Add(editor);
			System.Windows.Forms.ScrollableControl scroll = temp_scrollablecontrol;
			
			// overall layout
			
			//UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'"
			//UPGRADE_ISSUE: Method 'java.awt.Container.setLayout' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaawtContainersetLayout_javaawtLayoutManager'"
			//UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaawtBorderLayout'"
			/*
			((System.Windows.Forms.ContainerControl) this).setLayout(new BorderLayout());*/
			//UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'"
			//UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent_javalangObject'"
			((System.Windows.Forms.ContainerControl) this).Controls.Add(scroll);
			scroll.Dock = System.Windows.Forms.DockStyle.Fill;
			scroll.BringToFront();
			//UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'"
			//UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent_javalangObject'"
			// ((System.Windows.Forms.ContainerControl) this).Controls.Add(menubar);
			// menubar.Dock = System.Windows.Forms.DockStyle.Top;
			// menubar.SendToBack();
			//UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'"
			//UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent_javalangObject'"
			//UPGRADE_ISSUE: Method 'java.awt.Window.pack' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaawtWindowpack'"
// 			pack();
			
			editor.Focus();
			
			editor.SetToolCursor();
			
			if (LoadFN != null)
			{
				try
				{
					//UPGRADE_TODO: Constructor 'java.io.FileInputStream.FileInputStream' was converted to 'System.IO.FileStream.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioFileInputStreamFileInputStream_javalangString'"
					System.IO.FileStream istr = new System.IO.FileStream(LoadFN, System.IO.FileMode.Open, System.IO.FileAccess.Read);
					Molecule frag = MoleculeStream.ReadUnknown(istr);
					editor.AddArbitraryFragment(frag);
					istr.Close();
				}
				catch (System.IO.IOException e)
				{
					//UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
					SupportClass.OptionPaneSupport.ShowMessageDialog(null, e.ToString(), "Open Failed", (int) System.Windows.Forms.MessageBoxIcon.Error);
					return ;
				}
				
				SetFilename(LoadFN);
				editor.NotifySaved();
			}
			if (streamMode)
				ReadStream();
			
			KeyDown += new System.Windows.Forms.KeyEventHandler(this.keyPressed);
			KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.keyTyped);
			editor.KeyDown += new System.Windows.Forms.KeyEventHandler(this.keyPressed);
			editor.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.keyTyped);
		}
예제 #3
0
 public MainWindow()
 {
     templ = new Templates();
     this.menu = new NuGenMainPopupMenu(this, null);
     editor = new EditorPane(this.Width, this.Height, true);
     InitializeComponent();
     SetupButtonList();
 }