2
* Created on 02-dic-2005
4
* TODO To change the template for this generated file go to
5
* Window - Preferences - Java - Code Style - Code Templates
7
package org.herac.tuxguitar.gui.items.tool;
9
import org.eclipse.swt.SWT;
10
import org.eclipse.swt.widgets.ToolBar;
11
import org.eclipse.swt.widgets.ToolItem;
12
import org.herac.tuxguitar.gui.SystemImages;
13
import org.herac.tuxguitar.gui.TuxGuitar;
14
import org.herac.tuxguitar.gui.actions.edit.RedoAction;
15
import org.herac.tuxguitar.gui.actions.edit.SetMouseModeEditionAction;
16
import org.herac.tuxguitar.gui.actions.edit.SetMouseModeSelectionAction;
17
import org.herac.tuxguitar.gui.actions.edit.SetNaturalKeyAction;
18
import org.herac.tuxguitar.gui.actions.edit.UndoAction;
19
import org.herac.tuxguitar.gui.editors.tab.edit.EditorKit;
20
import org.herac.tuxguitar.gui.items.ToolItems;
24
* TODO To change the template for this generated type comment go to
25
* Window - Preferences - Java - Code Style - Code Templates
27
public class EditToolItems extends ToolItems {
28
public static final String NAME = "edit.items";
29
private ToolBar toolBar;
30
private ToolItem undo;
31
private ToolItem redo;
33
private ToolItem modeSelection;
34
private ToolItem modeEdition;
35
private ToolItem notNaturalKey;
37
public EditToolItems(){
41
public void showItems(ToolBar toolBar){
42
this.toolBar = toolBar;
43
this.undo = new ToolItem(toolBar, SWT.PUSH);
44
this.undo.setImage(SystemImages.EDIT_UNDO);
45
this.undo.addSelectionListener(TuxGuitar.instance().getAction(UndoAction.NAME));
47
this.redo = new ToolItem(toolBar, SWT.PUSH);
48
this.redo.setImage(SystemImages.EDIT_REDO);
49
this.redo.addSelectionListener(TuxGuitar.instance().getAction(RedoAction.NAME));
51
new ToolItem(toolBar, SWT.SEPARATOR);
53
this.modeSelection = new ToolItem(toolBar, SWT.RADIO);
54
this.modeSelection.setImage(SystemImages.EDIT_MODE_SELECTION);
55
this.modeSelection.addSelectionListener(TuxGuitar.instance().getAction(SetMouseModeSelectionAction.NAME));
57
this.modeEdition = new ToolItem(toolBar, SWT.RADIO);
58
this.modeEdition.setImage(SystemImages.EDIT_MODE_EDITION);
59
this.modeEdition.addSelectionListener(TuxGuitar.instance().getAction(SetMouseModeEditionAction.NAME));
61
this.notNaturalKey = new ToolItem(toolBar, SWT.CHECK);
62
this.notNaturalKey.setImage(SystemImages.EDIT_MODE_EDITION_NO_NATURAL);
63
this.notNaturalKey.addSelectionListener(TuxGuitar.instance().getAction(SetNaturalKeyAction.NAME));
65
this.loadProperties();
70
this.undo.setEnabled(getEditor().getUndoManager().canUndo());
71
this.redo.setEnabled(getEditor().getUndoManager().canRedo());
72
this.modeSelection.setSelection(getEditor().getTablature().getEditorKit().getMouseMode() == EditorKit.MOUSE_MODE_SELECTION);
73
this.modeEdition.setSelection(getEditor().getTablature().getEditorKit().getMouseMode() == EditorKit.MOUSE_MODE_EDITION);
74
this.notNaturalKey.setSelection(!getEditor().getTablature().getEditorKit().isNatural());
75
this.notNaturalKey.setEnabled(getEditor().getTablature().getEditorKit().getMouseMode() == EditorKit.MOUSE_MODE_EDITION);
78
public void loadProperties(){
79
this.undo.setToolTipText(TuxGuitar.getProperty("edit.undo"));
80
this.redo.setToolTipText(TuxGuitar.getProperty("edit.redo"));
81
this.modeSelection.setToolTipText(TuxGuitar.getProperty("edit.mouse-mode-selection"));
82
this.modeEdition.setToolTipText(TuxGuitar.getProperty("edit.mouse-mode-edition"));
83
this.notNaturalKey.setToolTipText(TuxGuitar.getProperty("edit.not-natural-key"));