File: GeneralShellPanel.boo

package info (click to toggle)
monodevelop-boo 2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 528 kB
  • ctags: 57
  • sloc: makefile: 246; xml: 193; sh: 160
file content (123 lines) | stat: -rw-r--r-- 5,101 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#region license
// Copyright (c) 2005, Peter Johanson (latexer@gentoo.org)
// All rights reserved.
//
// BooBinding is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// BooBinding is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with BooBinding; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#endregion

namespace BooBinding.Gui.OptionPanels

import System
import Gtk

import MonoDevelop.Core

import BooBinding.Properties

public class GeneralShellPanel(MonoDevelop.Ide.Gui.Dialogs.OptionsPanel):
	private generalOptionsLabel = Gtk.Label ()
	private autoIndentCheckButton = Gtk.CheckButton ()
	private resetClearsScrollbackCheckButton = Gtk.CheckButton ()
	private resetClearsHistoryCheckButton = Gtk.CheckButton ()
	private loadAssemblyCheckButton = Gtk.CheckButton ()

	private fontOptionsLabel = Gtk.Label ()
	private fontButton = FontButton ()
	private defaultMonoRadio as RadioButton
	private customFontRadio as RadioButton

	protected virtual ShellProperties as ShellProperties:
		get:
			pass

	private def InitializeComponent() as void:
		generalOptionsLabel.Markup = String.Format ("<b>{0}</b>", GettextCatalog.GetString ("General Options"))

		autoIndentCheckButton.Label = GettextCatalog.GetString ("Automatically indent new lines in code blocks")
		resetClearsScrollbackCheckButton.Label = GettextCatalog.GetString ("Shell reset clears scollback")
		resetClearsHistoryCheckButton.Label = GettextCatalog.GetString ("Shell reset clears command history")
		loadAssemblyCheckButton.Label = GettextCatalog.GetString ("Load project assemblies after building them (Causes shell reset)")
		fontOptionsLabel.Markup = String.Format ("<b>{0}</b>", GettextCatalog.GetString ("Font"))
		defaultMonoRadio = RadioButton (GettextCatalog.GetString ("Use default monospace font"))
		customFontRadio = RadioButton (defaultMonoRadio, GettextCatalog.GetString ("Use custom font:"))

		defaultMonoRadio.Toggled += ItemToggled
		customFontRadio.Toggled += ItemToggled


	public override def CreatePanelWidget( ) as Widget:
		InitializeComponent ()
		vbox = VBox ()
		hboxTmp = HBox()
		hboxTmp.PackStart (generalOptionsLabel, false, false, 0)
		vbox.PackStart (hboxTmp, false, false, 12)
		hboxTmp = HBox()
		hboxTmp.PackStart (autoIndentCheckButton, false, false, 6)
		vbox.PackStart (hboxTmp, false, false, 0)
		hboxTmp = HBox()
		hboxTmp.PackStart (resetClearsScrollbackCheckButton, false, false, 6)
		vbox.PackStart (hboxTmp, false, false, 0)
		hboxTmp = HBox()
		hboxTmp.PackStart (resetClearsHistoryCheckButton, false, false, 6)
		vbox.PackStart (hboxTmp, false, false, 0)
		hboxTmp = HBox()
		hboxTmp.PackStart (loadAssemblyCheckButton, false, false, 6)
		vbox.PackStart (hboxTmp, false, false, 0)
		hboxTmp = HBox()
		hboxTmp.PackStart (fontOptionsLabel, false, false, 0)
		vbox.PackStart (hboxTmp, false, false, 12)
		hboxTmp = HBox()
		hboxTmp.PackStart(defaultMonoRadio, false, false, 6)
		vbox.PackStart (hboxTmp, false, false, 0)
		hboxTmp = HBox()
		hboxTmp.PackStart (customFontRadio, false, false, 6)
		hboxTmp.PackStart (fontButton, false, false, 0)
		vbox.PackStart (hboxTmp, false, false, 0)

		s = ShellProperties.FontName

		if s == "__default_monospace":
			defaultMonoRadio.Active = true
		else:
			fontButton.FontName = s
			customFontRadio.Active = true

		fontButton.Sensitive = customFontRadio.Active
		autoIndentCheckButton.Active = ShellProperties.AutoIndentBlocks
		resetClearsScrollbackCheckButton.Active = ShellProperties.ResetClearsScrollback
		resetClearsHistoryCheckButton.Active = ShellProperties.ResetClearsHistory
		loadAssemblyCheckButton.Active =  ShellProperties.LoadAssemblyAfterBuild
		vbox.ShowAll ()
		return vbox


	public override def ApplyChanges () as void:
		if customFontRadio.Active:
			ShellProperties.FontName =  fontButton.FontName
		elif defaultMonoRadio.Active:
			ShellProperties.FontName = "__default_monospace"

		if ShellProperties.AutoIndentBlocks != autoIndentCheckButton.Active:
			ShellProperties.AutoIndentBlocks = autoIndentCheckButton.Active

		if ShellProperties.ResetClearsScrollback != resetClearsScrollbackCheckButton.Active:
			ShellProperties.ResetClearsScrollback = resetClearsScrollbackCheckButton.Active
		if ShellProperties.ResetClearsHistory != resetClearsHistoryCheckButton.Active:
			ShellProperties.ResetClearsHistory = resetClearsHistoryCheckButton.Active
		if ShellProperties.LoadAssemblyAfterBuild != loadAssemblyCheckButton.Active:
			ShellProperties.LoadAssemblyAfterBuild = loadAssemblyCheckButton.Active
	
	private def ItemToggled (o, args as EventArgs):
		fontButton.Sensitive = customFontRadio.Active