Skip to content

Commit

Permalink
Added menu item for stacking
Browse files Browse the repository at this point in the history
Fix for stack not shown if icon was clicked
  • Loading branch information
lanthale committed Nov 18, 2023
1 parent 39a68a1 commit eedf320
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
16 changes: 14 additions & 2 deletions PhotoSlide/src/main/java/org/photoslide/MainViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,13 @@ public class MainViewController implements Initializable {
private EditorMediaViewController editorMediaViewPaneController;
@FXML
private EditorToolsController editorToolsPaneController;
@FXML
private BookmarkBoardController bookmarksController;
@FXML
private SearchToolsController searchtools;
private SearchToolsDialog searchDialog;
private PrintDialog printDialog;
private Properties bookmarks;
private BookmarkBoardController bookmarksController;
private Properties bookmarks;
private BMBIcon bmbIcon;
@FXML
private Button showProcessButton;
Expand Down Expand Up @@ -1228,4 +1230,14 @@ private void showBackgroundProcessListMenu(ActionEvent event) {
.add(getClass().getResource("/org/photoslide/css/PopOver.css").toExternalForm());
}

@FXML
private void showMediaStackAction(ActionEvent event) {
MediaFile item = lighttablePaneController.getFactory().getSelectedMediaItem();
if (item != null) {
if (item.isStacked()) {
lighttablePaneController.getFactory().handleStackButtonAction(item.getStackName(), lighttablePaneController.getFactory().getSelectedCell());
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,19 @@ public void handleGridCellSelection(Event t) throws MalformedURLException {
lightController.getFilenameLabel().setText(name);
});
return;
}
if (t.getTarget().getClass().equals(FontIcon.class)) {
String code = ((FontIcon) t.getTarget()).getIconLiteral();
if (code.equalsIgnoreCase("ti-view-grid")) {
}
if (t.getTarget().getClass().equals(StackPane.class)) {
Node target = Utility.pick((StackPane) t.getTarget(), ((MouseEvent) t).getSceneX(), ((MouseEvent) t).getSceneY());
if (target.getClass().equals(FontIcon.class)) {
handleStackButtonAction(((MediaGridCell) t.getSource()).getItem().getStackName(), (MediaGridCell) t.getSource());
if (lightController.getImageView().getImage() != null) {
if (lightController.getImageView().getImage() != null) {
if (lightController.getImageView().getImage().getUrl().equalsIgnoreCase(((MediaGridCell) t.getSource()).getItem().getImageUrl().toString())) {
return;
}
}
}
}
t.consume();
}
if (((MediaGridCell) t.getSource()).getItem().isStacked()) {
lightController.getStackButton().setText("Unstack");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public final void setMedia(MediaFile item) {
}
setRatingNode(item.getRatingProperty().get());
setBookmarked(item.isBookmarked());
setStacked(item.isStacked(), item.getStackPos());
setStacked(item.isStacked(), item.getStackPos());
if (item.deletedProperty().getValue() == true) {
setDeletedNode();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<?import javafx.scene.text.Font?>
<?import org.kordamp.ikonli.javafx.FontIcon?>

<VBox prefHeight="750.0" prefWidth="1280.0" stylesheets="@../css/MainView.css" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.photoslide.MainViewController">
<VBox prefHeight="750.0" prefWidth="1280.0" stylesheets="@../css/MainView.css" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.photoslide.MainViewController">
<children>
<MenuBar fx:id="menuBar" VBox.vgrow="NEVER">
<menus>
Expand Down Expand Up @@ -174,6 +174,7 @@
</graphic>
</MenuItem>
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" onAction="#showMediaStackAction" text="Show media stack" />
<MenuItem fx:id="stackMenu" mnemonicParsing="false" onAction="#stackMenuAction" text="Stack media files">
<accelerator>
<KeyCodeCombination alt="UP" code="S" control="UP" meta="UP" shift="UP" shortcut="DOWN" />
Expand Down

0 comments on commit eedf320

Please sign in to comment.