Changeset 1153 in josm for trunk/src/org


Ignore:
Timestamp:
2008-12-22T14:02:32+01:00 (15 years ago)
Author:
stoecker
Message:

properly seperate command and displays in left menu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r997 r1153  
    5050        /**
    5151         * The toolbar with the action icons. To add new toggle dialog actions, use addToggleDialog
    52          * instead of adding directly to this list.
     52         * instead of adding directly to this list. To add a new mode use addMapMode.
    5353         */
    5454        public JToolBar toolBarActions = new JToolBar(JToolBar.VERTICAL);
     55        public JToolBar toolBarToggle = new JToolBar(JToolBar.VERTICAL);
    5556        /**
    5657         * The status line below the map
     
    8283                // toolbar
    8384                toolBarActions.setFloatable(false);
    84                 toolBarActions.add(new IconToggleButton(new ZoomAction(this)));
    85                 toolBarActions.add(new IconToggleButton(new SelectAction(this)));
    86                 toolBarActions.add(new IconToggleButton(new DrawAction(this)));
    87                 toolBarActions.add(new IconToggleButton(new DeleteAction(this)));
    88                 toolBarActions.add(new IconToggleButton(new ExtrudeAction(this)));
    89                
    90                 for (Component c : toolBarActions.getComponents())
    91                         toolGroup.add((AbstractButton)c);
     85                addMapMode(new IconToggleButton(new ZoomAction(this)));
     86                addMapMode(new IconToggleButton(new SelectAction(this)));
     87                addMapMode(new IconToggleButton(new DrawAction(this)));
     88                addMapMode(new IconToggleButton(new DeleteAction(this)));
     89                addMapMode(new IconToggleButton(new ExtrudeAction(this)));
     90
    9291                toolGroup.setSelected(((AbstractButton)toolBarActions.getComponent(0)).getModel(), true);
    93                
    94                 toolBarActions.addSeparator();
    95                
     92
    9693                add(toggleDialogs, BorderLayout.EAST);
    9794                toggleDialogs.setLayout(new BoxLayout(toggleDialogs, BoxLayout.Y_AXIS));
    9895
     96                toolBarToggle.setFloatable(false);
    9997                addToggleDialog(new LayerListDialog(this));
    10098                addToggleDialog(new PropertiesDialog(this));
     
    118116                        if (toolBarActions.getComponent(i) instanceof Destroyable)
    119117                                ((Destroyable)toolBarActions).destroy();
     118                for (int i = 0; i < toolBarToggle.getComponentCount(); ++i)
     119                        if (toolBarToggle.getComponent(i) instanceof Destroyable)
     120                                ((Destroyable)toolBarToggle).destroy();
    120121               
    121122                // remove menu entries
     
    148149                dlg.action.button = button;
    149150                dlg.parent = toggleDialogs;
    150                 toolBarActions.add(button);
     151                toolBarToggle.add(button);
    151152                toggleDialogs.add(dlg);
    152153        }
    153154
     155        public void addMapMode(IconToggleButton b) {
     156                toolBarActions.add(b);
     157                toolGroup.add((AbstractButton)b);
     158        }
    154159
    155160        /**
     
    187192        public void fillPanel(Container panel) {
    188193                panel.add(this, BorderLayout.CENTER);
    189                 panel.add(toolBarActions, BorderLayout.WEST);
     194                JToolBar jb = new JToolBar(JToolBar.VERTICAL);
     195                jb.setFloatable(false);
     196                jb.add(toolBarActions);
     197                jb.addSeparator();
     198                jb.add(toolBarToggle);
     199                panel.add(jb, BorderLayout.WEST);
    190200                if (statusLine != null)
    191201                        panel.add(statusLine, BorderLayout.SOUTH);
Note: See TracChangeset for help on using the changeset viewer.