Skip to content

Commit

Permalink
resized combobox
Browse files Browse the repository at this point in the history
  • Loading branch information
derekprovance committed May 10, 2016
1 parent 4eb8243 commit dc5fd38
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
65 changes: 33 additions & 32 deletions freemind/controller/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public class Controller implements MapModuleChangeObserver {

private Mode mMode;
private FreeMindMain frame;
private MainToolBar toolbar;
private MainToolBar northToolbar;
private MainToolBar southToolbar;
private JToolBar filterToolbar;
private JPanel northToolbarPanel;
private JPanel southToolbarPanel;
Expand All @@ -89,7 +90,6 @@ public class Controller implements MapModuleChangeObserver {
private ModesCreator mModescreator = new ModesCreator(this);
private PageFormat pageFormat = null;
private PrinterJob printerJob = null;
private Icon bswatch = new BackgroundSwatch();
private Map fontMap = new HashMap();
private JLabel status;

Expand Down Expand Up @@ -218,33 +218,43 @@ public void init() {
}

private void generateNorthToolBar() {
toolbar = new MainToolBar(this);
northToolbar = new MainToolBar(this);
mFilterController = new FilterController(this);
filterToolbar = mFilterController.getFilterToolbar();

northToolbarPanel = new JPanel(new BorderLayout());
getFrame().getContentPane().add(northToolbarPanel, BorderLayout.NORTH);
northToolbarPanel.add(toolbar, BorderLayout.NORTH);
northToolbarPanel.add(northToolbar, BorderLayout.NORTH);
northToolbarPanel.add(filterToolbar, BorderLayout.SOUTH);
}

private void generateSouthToolBar() {
southToolbar = new MainToolBar(this);

southToolbarPanel = new JPanel(new BorderLayout());
status = new JLabel("!");
status.setPreferredSize(status.getPreferredSize());
status.setText("");
southToolbarPanel.add(status);
initializeStatus();
southToolbar.add(status);
southToolbar.add(createZoomComboBox());
southToolbarPanel.add(southToolbar);
getFrame().getContentPane().add(southToolbarPanel, BorderLayout.SOUTH);
southToolbarPanel.add(createZoomComboBox());

//TODO - investigate if this should be moved to JPanel
//TODO - look into moving this to the MindMapToolbar
}

private void initializeStatus() {
status = new JLabel("!");
status.setPreferredSize(status.getPreferredSize());
status.setText("");
}

private JComboBox createZoomComboBox() {
JComboBox zoom = new JComboBox(this.getZooms());
zoom.setPreferredSize(new Dimension(90,15));
zoom.setSelectedItem("100%");
zoom.setPreferredSize(new Dimension(90, 20));
zoom.setMaximumSize(zoom.getPreferredSize());
zoom.addItem(userDefinedZoom);

// Focus fix.
zoom.setFocusable(false);
zoom.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
Expand Down Expand Up @@ -511,13 +521,13 @@ public void beforeMapModuleChange(MapModule oldMapModule, Mode oldMode, MapModul
}

if (oldModeController.getModeToolBar() != null) {
toolbar.remove(oldModeController.getModeToolBar());
toolbar.activate(true);
northToolbar.remove(oldModeController.getModeToolBar());
northToolbar.activate(true);
}
if (oldModeController.getLeftToolBar() != null) {
getFrame().getContentPane().remove(oldModeController.getLeftToolBar());
}
toolbar.activate(true);
northToolbar.activate(true);
}

public void afterMapModuleChange(MapModule oldMapModule, Mode oldMode, MapModule newMapModule, Mode newMode) {
Expand All @@ -533,9 +543,8 @@ public void afterMapModuleChange(MapModule oldMapModule, Mode oldMode, MapModule
generateTopToolbar(newModeController);
generateLeftToolbar(newModeController);


toolbar.validate();
toolbar.repaint();
northToolbar.validate();
northToolbar.repaint();

MenuBar menuBar = getFrame().getFreeMindMenuBar();
menuBar.updateMenus(newModeController);
Expand Down Expand Up @@ -572,8 +581,8 @@ private ModeController setViewToExistingMap(MapModule newMapModule) {
private void generateTopToolbar(ModeController newModeController) {
JToolBar newToolBar = newModeController.getModeToolBar();
if (newToolBar != null) {
toolbar.activate(false);
toolbar.add(newToolBar, 0);
northToolbar.activate(false);
northToolbar.add(newToolBar, 0);
newToolBar.repaint();
}
}
Expand Down Expand Up @@ -645,14 +654,14 @@ public void setMenubarVisible(boolean visible) {

public void setToolbarVisible(boolean visible) {
toolbarVisible = visible;
toolbar.setVisible(toolbarVisible);
northToolbar.setVisible(toolbarVisible);
}

/**
* @return Returns the main toolbar.
* @return Returns the main northToolbar.
*/
public JToolBar getToolbar() {
return toolbar;
public JToolBar getNorthToolbar() {
return northToolbar;
}

public void setLeftToolbarVisible(boolean visible) {
Expand Down Expand Up @@ -842,7 +851,7 @@ public void setAllActions(boolean enabled) {
page.setEnabled(enabled && isPrintingAllowed);
close.setEnabled(enabled);
moveToRoot.setEnabled(enabled);
toolbar.setAllActions(enabled);
northToolbar.setAllActions(enabled);
showSelectionAsRectangle.setEnabled(enabled);
}

Expand Down Expand Up @@ -1797,12 +1806,4 @@ private void storeOptionSplitPanePosition() {
+ mOptionalSplitPane.getDividerPosition());
}
}

public JPanel getSouthToolbarPanel() {
return southToolbarPanel;
}

public void setSouthToolbarPanel(JPanel southToolbarPanel) {
this.southToolbarPanel = southToolbarPanel;
}
}
2 changes: 0 additions & 2 deletions freemind/modes/mindmapmode/MindMapToolBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ public void update(StructuredMenuHolder holder) {
label.setToolTipText(Resources.getInstance().getText("mindmapmode_toolbar_font_color"));
add(colorCombo);
add(Box.createHorizontalGlue());
addIcon("images/page-zoom.png");
// add(zoom);

// button tool bar.
iconToolBar.removeAll();
Expand Down

0 comments on commit dc5fd38

Please sign in to comment.