Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong icon size #4992

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
eb8f81f
Added handover dialogservice
calixtus May 19, 2019
c79ce54
Undone previous
calixtus May 19, 2019
34bef06
Refactor Constructors, handing over dialogService
calixtus May 19, 2019
a363f5c
Reword Identifier
calixtus May 20, 2019
12c14ab
Reformat for codestyle
calixtus May 20, 2019
37b5a68
Merge remote-tracking branch 'upstream/master' into fix-prefs-extp-se…
calixtus May 20, 2019
c456701
Refactor Constructors
calixtus May 20, 2019
f8dcd0c
Delete superfluous import for checkstyle
calixtus May 20, 2019
d689d44
Reformat whitespace
calixtus May 20, 2019
be06f58
Refactor Constructors
calixtus May 21, 2019
ee82c45
Refactor Cleanup
calixtus May 21, 2019
95f8668
Added Submenu to change external push-app
calixtus May 22, 2019
66a8661
Merge remote-tracking branch 'upstream/master' into menu_select_push_app
calixtus May 22, 2019
84b74e7
Rewording, Respacing and Optimizing
calixtus May 22, 2019
25164b6
Rewording Confusing PushApplications to PushToApplicationsManager
calixtus May 22, 2019
5939247
Refactoring and unifying PtAAction with ToolbarButton
calixtus May 22, 2019
960dac3
Refactor simplified
calixtus May 22, 2019
0d36d48
Reword l10n
calixtus May 22, 2019
bed836a
Refactor for checks
calixtus May 22, 2019
ab50ac9
Added eye-candy
calixtus May 22, 2019
c02ec73
Added eye-candy
calixtus May 22, 2019
cab5cad
Changelog
calixtus May 22, 2019
a050e9a
whitespaces
calixtus May 22, 2019
015f3e0
Refactor fixing wrong icon size
calixtus May 22, 2019
487c86e
Added Submenu to change external push-app
calixtus May 22, 2019
6e1c9f9
Rewording, Respacing and Optimizing
calixtus May 22, 2019
d41b8a9
Rewording Confusing PushApplications to PushToApplicationsManager
calixtus May 22, 2019
28fb91c
Refactoring and unifying PtAAction with ToolbarButton
calixtus May 22, 2019
5756c67
Refactor simplified
calixtus May 22, 2019
d374582
Reword l10n
calixtus May 22, 2019
4dc8172
Refactor for checks
calixtus May 22, 2019
4c6eb2f
Added eye-candy
calixtus May 22, 2019
444f17f
Added eye-candy
calixtus May 22, 2019
a2ae21c
Changelog
calixtus May 22, 2019
b34a8f5
whitespaces
calixtus May 22, 2019
145fb5d
Refactor fixing wrong icon size
calixtus May 22, 2019
6e4bc1f
Merge branch 'fix-icon-size' of https://github.com/calixtus/jabref in…
calixtus May 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- The Medline fetcher now normalizes the author names according to the BibTeX-Standard [#4345](https://github.com/JabRef/jabref/issues/4345)
- We added an option on the Linked File Viewer to rename the attached file of an entry directly on the JabRef. [#4844](https://github.com/JabRef/jabref/issues/4844)
- We added an option in the preference dialog box that allows user to enable helpful tooltips.[#3599](https://github.com/JabRef/jabref/issues/3599)
- We moved the dropdown menu for selecting the push-application from the toolbar into the tools menu.[#674](https://github.com/JabRef/jabref/issues/674)


### Fixed
Expand Down
45 changes: 37 additions & 8 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
import javafx.scene.control.ButtonType;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.RadioMenuItem;
import javafx.scene.control.Separator;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.control.SplitPane;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextInputControl;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.ToolBar;
import javafx.scene.control.Tooltip;
import javafx.scene.input.DataFormat;
Expand Down Expand Up @@ -95,7 +98,9 @@
import org.jabref.gui.metadata.PreambleEditor;
import org.jabref.gui.preferences.ShowPreferencesAction;
import org.jabref.gui.protectedterms.ManageProtectedTermsAction;
import org.jabref.gui.push.PushToApplication;
import org.jabref.gui.push.PushToApplicationAction;
import org.jabref.gui.push.PushToApplicationMenuAction;
import org.jabref.gui.push.PushToApplicationsManager;
import org.jabref.gui.search.GlobalSearchBar;
import org.jabref.gui.shared.ConnectToSharedDatabaseCommand;
Expand Down Expand Up @@ -154,7 +159,7 @@ public class JabRefFrame extends BorderPane {
private final CountingUndoManager undoManager;
private SidePaneManager sidePaneManager;
private TabPane tabbedPane;
private PushToApplicationsManager pushApplications;
private PushToApplicationsManager pushToApplicationsManager;
private final DialogService dialogService;
private SidePane sidePane;

Expand Down Expand Up @@ -449,7 +454,7 @@ public boolean quit() {
private void initLayout() {
setProgressBarVisible(false);

pushApplications = new PushToApplicationsManager(this.getDialogService());
pushToApplicationsManager = new PushToApplicationsManager(dialogService, stateManager);

BorderPane head = new BorderPane();
head.setTop(createMenu());
Expand Down Expand Up @@ -520,7 +525,10 @@ private Node createToolbar() {
leftSide.prefWidthProperty().bind(sidePane.widthProperty());
leftSide.maxWidthProperty().bind(sidePane.widthProperty());

PushToApplicationAction pushToApplicationAction = new PushToApplicationAction(stateManager, this.getPushApplications(), this.getDialogService());
final PushToApplicationAction pushToApplicationAction = getPushToApplicationsManager().getPushToApplicationAction();
final Button pushToApplicationButton = factory.createIconButton(pushToApplicationAction.getActionInformation(), pushToApplicationAction);
pushToApplicationsManager.setToolBarButton(pushToApplicationButton);

HBox rightSide = new HBox(
factory.createIconButton(StandardActions.NEW_ARTICLE, new NewEntryAction(this, BiblatexEntryTypes.ARTICLE, dialogService, Globals.prefs, stateManager)),
factory.createIconButton(StandardActions.DELETE_ENTRY, new OldDatabaseCommandWrapper(Actions.DELETE, this, stateManager)),
Expand All @@ -531,7 +539,7 @@ private Node createToolbar() {
factory.createIconButton(StandardActions.COPY, new OldDatabaseCommandWrapper(Actions.COPY, this, stateManager)),
factory.createIconButton(StandardActions.PASTE, new OldDatabaseCommandWrapper(Actions.PASTE, this, stateManager)),
new Separator(Orientation.VERTICAL),
factory.createIconButton(pushToApplicationAction.getActionInformation(), pushToApplicationAction),
pushToApplicationButton,
factory.createIconButton(StandardActions.GENERATE_CITE_KEYS, new OldDatabaseCommandWrapper(Actions.MAKE_KEY, this, stateManager)),
factory.createIconButton(StandardActions.CLEANUP_ENTRIES, new OldDatabaseCommandWrapper(Actions.CLEANUP, this, stateManager)),
new Separator(Orientation.VERTICAL),
Expand Down Expand Up @@ -759,7 +767,27 @@ private MenuBar createMenu() {
factory.createMenuItem(StandardActions.SET_FILE_LINKS, new AutoLinkFilesAction(this, prefs, stateManager, undoManager))
);

final PushToApplicationAction pushToApplicationAction = new PushToApplicationAction(stateManager, this.getPushApplications(), this.getDialogService());
final PushToApplicationAction pushToApplicationAction = pushToApplicationsManager.getPushToApplicationAction();
final MenuItem pushToApplicationMenuItem = factory.createMenuItem(pushToApplicationAction.getActionInformation(), pushToApplicationAction);
pushToApplicationsManager.setMenuItem(pushToApplicationMenuItem);

final Menu pushApplicationsMenu = factory.createSubMenu(StandardActions.SELECT_PUSH_APPLICATION);
final ToggleGroup pushToToggleGroup = new ToggleGroup();
RadioMenuItem pushToApplication;
PushToApplicationMenuAction pushToApplicationMenuAction;
final String activePushToApplication = Globals.prefs.get(JabRefPreferences.PUSH_TO_APPLICATION);

for (PushToApplication application : pushToApplicationsManager.getApplications()) {
pushToApplicationMenuAction = new PushToApplicationMenuAction(application, pushToApplicationAction, pushToApplicationsManager);
pushToApplication = factory.createRadioMenuItem(
pushToApplicationMenuAction.getActionInformation(),
pushToApplicationMenuAction,
application.getApplicationName().equals(activePushToApplication));

pushApplicationsMenu.getItems().add(pushToApplication);
pushToApplication.setToggleGroup(pushToToggleGroup);
}

tools.getItems().addAll(
factory.createMenuItem(StandardActions.NEW_SUB_LIBRARY_FROM_AUX, new NewSubLibraryAction(this, stateManager)),
factory.createMenuItem(StandardActions.FIND_UNLINKED_FILES, new FindUnlinkedFilesAction(this, stateManager)),
Expand All @@ -776,7 +804,8 @@ private MenuBar createMenu() {
factory.createMenuItem(StandardActions.GENERATE_CITE_KEYS, new OldDatabaseCommandWrapper(Actions.MAKE_KEY, this, stateManager)),
factory.createMenuItem(StandardActions.REPLACE_ALL, new OldDatabaseCommandWrapper(Actions.REPLACE_ALL, this, stateManager)),
factory.createMenuItem(StandardActions.SEND_AS_EMAIL, new OldDatabaseCommandWrapper(Actions.SEND_AS_EMAIL, this, stateManager)),
factory.createMenuItem(pushToApplicationAction.getActionInformation(), pushToApplicationAction),
pushApplicationsMenu,
pushToApplicationMenuItem,

factory.createSubMenu(StandardActions.ABBREVIATE,
factory.createMenuItem(StandardActions.ABBREVIATE_ISO, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_ISO, this, stateManager)),
Expand Down Expand Up @@ -1192,8 +1221,8 @@ public SidePaneManager getSidePaneManager() {
return sidePaneManager;
}

public PushToApplicationsManager getPushApplications() {
return pushApplications;
public PushToApplicationsManager getPushToApplicationsManager() {
return pushToApplicationsManager;
}

public GlobalSearchBar getGlobalSearchBar() {
Expand Down
18 changes: 11 additions & 7 deletions src/main/java/org/jabref/gui/actions/ActionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import java.lang.reflect.Method;
import java.util.Objects;

import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBase;
import javafx.scene.control.CheckMenuItem;
import javafx.scene.control.Label;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.RadioMenuItem;
import javafx.scene.control.Tooltip;

import org.jabref.gui.keyboard.KeyBindingRepository;
Expand Down Expand Up @@ -113,6 +113,14 @@ public CheckMenuItem createCheckMenuItem(Action action, Command command, boolean
return checkMenuItem;
}

public RadioMenuItem createRadioMenuItem(Action action, Command command, boolean selected) {
RadioMenuItem radioMenuItem = ActionUtils.createRadioMenuItem(new JabRefAction(action, command, keyBindingRepository));
radioMenuItem.setSelected(selected);
setGraphic(radioMenuItem, action);

return radioMenuItem;
}

public Menu createMenu(Action action) {
Menu menu = ActionUtils.createMenu(new JabRefAction(action, keyBindingRepository));

Expand Down Expand Up @@ -148,13 +156,9 @@ public ButtonBase configureIconButton(Action action, Command command, ButtonBase
button.getStyleClass().add("icon-button");

// For some reason the graphic is not set correctly, so let's fix this
// ToDO: Find a way to reuse JabRefIconView
button.graphicProperty().unbind();
action.getIcon().ifPresent(icon -> {
// ToDO: Find a way to reuse JabRefIconView
Node graphicNode = icon.getGraphicNode();
graphicNode.setStyle(String.format("-fx-font-family: %s; -fx-font-size: %s;", icon.fontFamily(), "1em"));
button.setGraphic(graphicNode);
});
action.getIcon().ifPresent(icon -> button.setGraphic(icon.getGraphicNode()));

return button;
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public enum StandardActions implements Action {
OPEN_CONSOLE(Localization.lang("Open terminal here"), Localization.lang("Open terminal here"), IconTheme.JabRefIcons.CONSOLE, KeyBinding.OPEN_CONSOLE),
COPY_LINKED_FILES(Localization.lang("Copy linked files to folder...")),
COPY_DOI(Localization.lang("Copy DOI url")),
SELECT_PUSH_APPLICATION(Localization.lang("Select external application")),
ABBREVIATE(Localization.lang("Abbreviate journal names")),
ABBREVIATE_ISO("ISO", Localization.lang("Abbreviate journal names of the selected entries (ISO abbreviation)"), KeyBinding.ABBREVIATE),
ABBREVIATE_MEDLINE("MEDLINE", Localization.lang("Abbreviate journal names of the selected entries (MEDLINE abbreviation)")),
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/org/jabref/gui/entryeditor/EntryEditor.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
<Tooltip text="%Change entry type"/>
</tooltip>
</Button>
<Button fx:id="generateCiteKeyButton" styleClass="narrow"/>
<Button styleClass="icon-button,narrow" onAction="#generateCiteKeyButton">
<graphic>
<JabRefIconView glyph="MAKE_KEY"/>
</graphic>
<tooltip>
<Tooltip text="%Generate BibTeX key"/>
</tooltip>
</Button>
<Button fx:id="fetcherButton" styleClass="icon-button,narrow">
<graphic>
<JabRefIconView glyph="REFRESH"/>
Expand Down
16 changes: 6 additions & 10 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import org.jabref.gui.BasePanel;
import org.jabref.gui.DialogService;
import org.jabref.gui.GUIGlobals;
import org.jabref.gui.actions.ActionFactory;
import org.jabref.gui.actions.StandardActions;
import org.jabref.gui.bibtexkeypattern.GenerateBibtexKeySingleAction;
import org.jabref.gui.entryeditor.fileannotationtab.FileAnnotationTab;
import org.jabref.gui.externalfiles.ExternalFilesEntryLinker;
Expand Down Expand Up @@ -87,7 +85,6 @@ public class EntryEditor extends BorderPane {
@FXML private Button typeChangeButton;
@FXML private Button fetcherButton;
@FXML private Label typeLabel;
@FXML private Button generateCiteKeyButton;

private final EntryEditorPreferences preferences;
private final DialogService dialogService;
Expand Down Expand Up @@ -261,6 +258,12 @@ private void deleteEntry() {
panel.delete(entry);
}

@FXML
void generateCiteKeyButton() {
GenerateBibtexKeySingleAction action = new GenerateBibtexKeySingleAction(getEntry(), databaseContext, dialogService, preferences, undoManager);
action.execute();
}

@FXML
private void navigateToPreviousEntry() {
panel.selectPreviousEntry();
Expand Down Expand Up @@ -387,13 +390,6 @@ private void setupToolBar() {
fetcherMenu.getItems().add(fetcherMenuItem);
}
fetcherButton.setOnMouseClicked(event -> fetcherMenu.show(fetcherButton, Side.RIGHT, 0, 0));

// Configure cite key button
new ActionFactory(preferences.getKeyBindings())
.configureIconButton(
StandardActions.GENERATE_CITE_KEY,
new GenerateBibtexKeySingleAction(getEntry(), databaseContext, dialogService, preferences, undoManager),
generateCiteKeyButton);
}

private void fetchAndMerge(EntryBasedFetcher fetcher) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/preferences/ExternalTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public ExternalTab(JabRefFrame frame, PreferencesDialog prefsDiag, JabRefPrefere

GridPane butpan = new GridPane();
int index = 0;
for (PushToApplication pushToApplication : frame.getPushApplications().getApplications()) {
for (PushToApplication pushToApplication : frame.getPushToApplicationsManager().getApplications()) {
addSettingsButton(pushToApplication, butpan, index);
index++;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ public Node getBuilder() {
}

private void addSettingsButton(final PushToApplication application, GridPane panel, int index) {
PushToApplicationSettings settings = frame.getPushApplications().getSettings(application);
PushToApplicationSettings settings = frame.getPushToApplicationsManager().getSettings(application);
Button button = new Button(Localization.lang("Settings for %0", application.getApplicationName()));
button.setPrefSize(150, 20);
button.setOnAction(e -> PushToApplicationSettingsDialog.showSettingsDialog(dialogService, settings, index));
Expand Down
18 changes: 15 additions & 3 deletions src/main/java/org/jabref/gui/push/PushToApplicationAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,34 @@
*/
public class PushToApplicationAction extends SimpleCommand {

private final PushToApplication operation;
private PushToApplication operation;
private final StateManager stateManager;
private final DialogService dialogService;

private Action action;

public PushToApplicationAction(StateManager stateManager, PushToApplicationsManager pushToApplicationsManager, DialogService dialogService) {
this.operation = pushToApplicationsManager.getLastUsedApplication(Globals.prefs);
this.operation = pushToApplicationsManager.getActiveApplication(Globals.prefs);
this.stateManager = stateManager;
this.dialogService = dialogService;

this.executable.bind(needsDatabase(stateManager).and(needsEntriesSelected(stateManager)));
this.statusMessage.bind(BindingsHelper.ifThenElse(this.executable, "", Localization.lang("This operation requires one or more entries to be selected.")));

updateAction();
}

public void updateApplication (PushToApplication application) {
this.operation = application;
updateAction();
}

public Action getActionInformation() {
return new Action() {
return action;
}

public void updateAction() {
action = new Action() {
@Override
public Optional<JabRefIcon> getIcon() {
return Optional.of(operation.getIcon());
Expand Down
74 changes: 74 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToApplicationMenuAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package org.jabref.gui.push;

import java.util.Optional;

import javafx.scene.control.Button;
import javafx.scene.control.MenuItem;

import org.jabref.Globals;
import org.jabref.gui.actions.Action;
import org.jabref.gui.actions.ActionFactory;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.preferences.JabRefPreferences;

/**
* An Action class representing the process of invoking a PushToApplicationMenu operation.
*/
public class PushToApplicationMenuAction extends SimpleCommand {

private final PushToApplication application;
private final PushToApplicationAction pushToApplicationAction;

private PushToApplicationsManager manager;

public PushToApplicationMenuAction(PushToApplication pushToApplication, PushToApplicationAction pushToApplicationAction, PushToApplicationsManager manager) {
this.application = pushToApplication;
this.pushToApplicationAction = pushToApplicationAction;
this.manager = manager;
}

public Action getActionInformation() {
return new Action() {

@Override
public Optional<JabRefIcon> getIcon() {
return Optional.of(application.getIcon());
}

@Override
public Optional<KeyBinding> getKeyBinding() {
return Optional.empty();
}

@Override
public String getText() {
return application.getApplicationName();
}

@Override
public String getDescription() {
return "";
}
};
}

@Override
public void execute() {
Globals.prefs.put(JabRefPreferences.PUSH_TO_APPLICATION, application.getApplicationName());
pushToApplicationAction.updateApplication(application);
ActionFactory factory = new ActionFactory(Globals.getKeyPrefs());

MenuItem menuItem = manager.getMenuItem();
Button toolBarButton = manager.getToolBarButton();

if (menuItem != null) {
factory.configureMenuItem(pushToApplicationAction.getActionInformation(), pushToApplicationAction, menuItem);
}

if (toolBarButton != null) {
factory.configureIconButton(pushToApplicationAction.getActionInformation(),pushToApplicationAction, toolBarButton);
}
}
}
Loading