Example #1
0
		public EditorTab NewEditorTab () 
		{
			EditorTab tab = new EditorTab();		
			editorTabs.Add(tab);
			
			currentEditorTab = tab;

			// top pane - sql editor

			SqlEditorSharp editor;
			editor = new SqlEditorSharp ();
			editor.Tab = tab;
			editor.UseSyntaxHiLighting = false;
			editor.View.Show ();
			editor.View.KeyPressEvent +=
				new Gtk.KeyPressEventHandler(OnKeyPressEventKey);

			lastUnknownFile ++;
			string unknownFile = "Unknown" + 
				lastUnknownFile.ToString() + ".sql";
			Label label = new Label(unknownFile);
			label.Show();

			// bottom pane - output results
			Notebook resultsNotebook = new Notebook();
			tab.resultsNotebook = resultsNotebook;
			resultsNotebook.TabPos = PositionType.Bottom;
			resultsNotebook.SwitchPage += new 
				Gtk.SwitchPageHandler(OnResultsNotebookSwitched);
			
			DataGrid grid = CreateOutputResultsDataGrid ();
			grid.View.Selection.Mode = SelectionMode.Multiple;
			tab.grid = grid;
			grid.Show();
			Label label2 = new Label("Grid");
			label2.Show();
			
			ScrolledWindow swin = CreateOutputResultsTextView (tab);
			swin.Show();

			tab.editor = editor;
			tab.label = label;
			tab.filename = "";
			tab.basefilename = unknownFile;

			Label label3 = new Label("Log");
			label3.Show();

			// finish the notebooks

			tab.frame = new Frame();
			tab.frame.ShadowType = ShadowType.None;
			tab.frame.Add (grid);
			tab.GridPage = resultsNotebook.AppendPage(tab.frame, label2);
			tab.LogPage = resultsNotebook.AppendPage(swin, label3);

			resultsNotebook.ShowAll ();
			resultsNotebook.ResizeChildren ();

			if (outputResults == OutputResults.TextView)
				resultsNotebook.CurrentPage = 1;
			else if (outputResults == OutputResults.DataGrid)
				resultsNotebook.CurrentPage = 0;

			tab.Add1 (editor);
			tab.Add2 (resultsNotebook);

			sourceFileNotebook.AppendPage(tab, label);

			sourceFileNotebook.ShowAll ();
			sourceFileNotebook.ResizeChildren ();

			sourceFileNotebook.CurrentPage = -1;

			tab.page = sourceFileNotebook.CurrentPage;
			UpdateTitleBar(tab);

			SetFocusToEditor ();

			return tab;
		}