20 package net.sf.gridarta.maincontrol;
22 import java.awt.BorderLayout;
23 import java.awt.Container;
24 import java.awt.Frame;
26 import java.io.IOException;
27 import java.util.MissingResourceException;
28 import java.util.ResourceBundle;
29 import java.util.prefs.Preferences;
30 import javax.swing.Action;
31 import javax.swing.ImageIcon;
32 import javax.swing.JFrame;
33 import javax.swing.JMenu;
34 import javax.swing.JMenuBar;
211 import net.
sf.japi.swing.action.ActionBuilder;
212 import net.
sf.japi.swing.action.ActionBuilderFactory;
213 import net.
sf.japi.swing.tod.TipOfTheDayManager;
214 import net.
sf.japi.util.ThrowableHandler;
215 import org.apache.log4j.Category;
216 import org.apache.log4j.Logger;
217 import org.jetbrains.annotations.NotNull;
218 import org.jetbrains.annotations.Nullable;
231 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
311 final NamedFilter defaultNamedFilterList =
new NamedFilter(projectModel.getGameObjectMatchers().getFilters());
314 final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, projectModel.getGameObjectParser(), projectModel.getFaceObjectProviders(), resourceIcons, projectModel.getSmoothFaces());
315 final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, projectModel.getPathManager());
316 scriptExtension = editorFactory.getScriptExtension();
325 final String spellFile = editorFactory.getSpellFile();
329 final StatusBar<G, A, R> statusBar =
new StatusBar<>(projectModel.getMapManager(), mapViewManager, projectModel.getArchetypeSet(), projectModel.getFaceObjects());
338 final CFTreasureListTree treasureListTree =
new CFTreasureListTree(projectModel.getTreasureTree(), parent, projectModel.getArchetypeSet(), projectModel.getFaceObjectProviders(), resourceIcons);
342 final GameObjectMatcher floorMatcher = projectModel.getGameObjectMatchers().getMatcher(
"system_floor",
"floor");
343 final GameObjectMatcher wallMatcher = projectModel.getGameObjectMatchers().getMatcher(
"system_wall",
"wall");
344 final ErrorViewCollector gameObjectMatchersErrorViewCollector =
new ErrorViewCollector(errorView,
new File(projectModel.getProjectSettings().getConfigurationDirectory(),
"GameObjectMatchers.xml"));
345 final GameObjectMatcher belowFloorMatcher = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector,
"system_below_floor",
"below_floor");
346 final GameObjectMatcher systemObjectMatcher = projectModel.getGameObjectMatchers().getMatcher(
"system_system_object");
348 final CopyBuffer<G, A, R> copyBuffer =
new CopyBuffer<>(mapViewSettings, projectModel.getGameObjectFactory(), projectModel.getMapArchObjectFactory(), projectModel.getMapModelFactory(), insertionModeSet);
355 final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory =
new GameObjectAttributesDialogFactory<>(projectModel.getArchetypeTypeSet(), parent, treasureListTree, projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectModel.getProjectSettings(), editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), projectModel.getFaceObjects(), projectModel.getGameObjectSpells(), projectModel.getNumberSpells(), editorFactory.getUndefinedSpellIndex(), projectModel.getTreasureTree(), noFaceSquareIcon, unknownSquareIcon, textAreaDefaults, projectModel.getMapManager());
358 final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, projectModel.getGameObjectFactory(), scriptedEventEditor, projectModel.getArchetypeSet());
359 final ScriptArchEditor<G, A, R> scriptArchEditor =
new ScriptArchEditor<>(scriptedEventFactory, editorFactory.getScriptExtension(), editorFactory.getScriptName(), scriptArchUtils, editorFactory.getScriptFileFilter(), projectModel.getProjectSettings(), projectModel.getMapManager(), projectModel.getPathManager(),
scriptEditControl);
360 final ScriptArchDataUtils<G, A, R> scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor);
361 final GameObjectMatcher monsterMatcherTmp = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector,
"system_monster",
"monster");
363 final GameObjectMatcher exitGameObjectMatcherTmp = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector,
"system_exit",
"exit");
364 final GameObjectMatcher exitGameObjectMatcher = exitGameObjectMatcherTmp == null ?
new TypeNrsGameObjectMatcher() : exitGameObjectMatcherTmp;
366 final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(projectModel.getProjectSettings(), projectModel.getMapManager());
370 final File scriptsFile =
new File(projectModel.getProjectSettings().getMapsDirectory(), editorFactory.getScriptsDir());
371 updaterManager =
new UpdaterManager(exiter, projectModel.getMapManager(), parent, editorFactory.getGridartaJarFilename());
373 final EditorAction undoControl =
new UndoControl<>(projectModel.getMapManager(), projectModel.getGameObjectFactory(), projectModel.getGameObjectMatchers());
375 final Action displayGameObjectNamesAction = editorActionManager.createAction(
"displayGameObjectNames",
"Archetype Chooser",
new DisplayGameObjectNamesAction<>(projectModel.getArchetypeChooserModel(), displayModeArchetypeNames));
376 final Action displayIconsOnlyAction = editorActionManager.createAction(
"displayIconsOnly",
"Archetype Chooser",
new DisplayIconsOnlyAction<>(projectModel.getArchetypeChooserModel(), displayModeIconsOnly));
377 final Action displayArchetypeNamesAction = editorActionManager.createAction(
"displayArchetypeNames",
"Archetype Chooser",
new DisplayArchetypeNamesAction<>(projectModel.getArchetypeChooserModel(), displayModeGameObjectNames));
378 final ArchetypeChooserView<G, A, R> archetypeChooserView =
new ArchetypeChooserView<>(editorFactory.isCreateDirectionPane(), projectModel.getArchetypeChooserModel(), projectModel.getFaceObjectProviders(), displayGameObjectNamesAction, displayArchetypeNamesAction, displayIconsOnlyAction, displayModeGameObjectNames, displayModeArchetypeNames, displayModeIconsOnly);
380 mapViewsManager =
new MapViewsManager<>(mapViewSettings, mapViewFactory, projectModel.getMapManager(), projectModel.getPickmapManager(), projectModel.getPathManager());
381 newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, projectModel.getMapArchObjectFactory(), pickmapChooserView, parent);
382 fileControl =
new DefaultFileControl<>(projectModel.getProjectSettings(), volatileSettings, mapImageCache, projectModel.getMapManager(),
mapViewsManager, parent,
GuiFileFilters.
MAP_FILE_FILTER, editorFactory.getScriptFileFilter(),
newMapDialogFactory,
scriptExtension,
scriptEditControl, projectModel.getPathManager());
383 mapViewsManager.setFileControl(fileControl);
384 final PickmapChooserControl<G, A, R> pickmapChooserControl =
new PickmapChooserControl<>(pickmapChooserModel, pickmapSettings,
newMapDialogFactory, mapFolderTree, projectModel.getMapManager(), parent,
mapViewsManager,
fileControl, pickmapChooserView);
386 newMapDialogFactory.setObjectChooser(objectChooser);
389 final MapActions<G, A, R> mapActions =
new MapActions<>(parent, projectModel.getMapManager(), mapViewManager, exitMatcher,
GuiFileFilters.
MAP_FILE_FILTER, selectedSquareModel, editorFactory.isAllowRandomMapParameters(), mapPropertiesDialogFactory, mapViewSettings,
mapViewsManager, enterMap, projectModel.getProjectSettings());
394 final MapMenu mapMenu = bookmarksMapMenuPreferences.getMapMenu();
398 final ToolPalette<G, A, R> toolPalette =
new ToolPalette<>(mapViewSettings, selectedSquareModel, objectChooser, pickmapSettings, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet);
403 final PluginController<G, A, R> pluginControl =
new PluginController<>(filterControl, projectModel.getPluginModel(), projectModel.newPluginParameters(rendererFactory), parent, pluginParameterViewFactory, scriptsFile, resourceIcons);
404 final EditorAction mainActions =
new MainActions<>(findDialogManager, replaceDialogManager,
mainViewFrame, mapViewSettings, projectModel.getArchetypeSet(), copyBuffer, objectChooser, projectModel.getMapManager(), insertionModeSet);
406 final Action moveSquareDownAction = editorActionManager.createAction(
"moveSquareDown",
"Selected Square View",
new MoveSquareDownAction<>(selectedSquareModel, projectModel.getMapManager()));
407 final Action moveSquareUpAction = editorActionManager.createAction(
"moveSquareUp",
"Selected Square View",
new MoveSquareUpAction<>(selectedSquareModel, projectModel.getMapManager()));
408 final Action moveSquareBottomAction = editorActionManager.createAction(
"moveSquareBottom",
"Selected Square View",
new MoveSquareBottomAction<>(selectedSquareModel, projectModel.getMapManager()));
409 final Action moveSquareEnvAction = editorActionManager.createAction(
"moveSquareEnv",
"Selected Square View",
new MoveSquareEnvAction<>(selectedSquareModel, projectModel.getMapManager()));
410 final Action moveSquareInvAction = editorActionManager.createAction(
"moveSquareInv",
"Selected Square View",
new MoveSquareInvAction<>(selectedSquareModel, projectModel.getMapManager()));
411 final Action moveSquareTopAction = editorActionManager.createAction(
"moveSquareTop",
"Selected Square View",
new MoveSquareTopAction<>(selectedSquareModel, projectModel.getMapManager()));
412 editorActionManager.createAction(
"findArchetypes",
"Archetypes",
new FindArchetypesAction<>(parent, archetypeChooserControl, objectChooser, projectModel.getArchetypeTypeSet()));
414 editorActionManager.createAction(
"moveSquarePrev",
"Selected Square View",
new MoveSquarePrevAction<>(selectedSquareModel, projectModel.getMapManager()));
415 editorActionManager.createAction(
"moveSquareNext",
"Selected Square View",
new MoveSquareNextAction<>(selectedSquareModel, projectModel.getMapManager()));
416 editorActionManager.createAction(
"prevWindow",
"Map,Window", mapDesktop);
417 editorActionManager.createAction(
"nextWindow",
"Map,Window", mapDesktop);
418 editorActionManager.createAction(
"addNewPickmap",
"Pickmap", pickmapChooserControl);
419 editorActionManager.createAction(
"openPickmapMap",
"Pickmap", pickmapChooserControl);
420 editorActionManager.createAction(
"deletePickmap",
"Pickmap", pickmapChooserControl);
421 editorActionManager.createAction(
"savePickmap",
"Pickmap", pickmapChooserControl);
422 editorActionManager.createAction(
"revertPickmap",
"Pickmap", pickmapChooserControl);
423 editorActionManager.createAction(
"viewTreasurelists",
"Tool",
new ViewTreasurelistsAction(treasureListTree, parent));
424 editorActionManager.createAction(
"mapCreateView",
"Map,Window", mapActions);
425 editorActionManager.createAction(
"mapProperties",
"Map", mapActions);
426 editorActionManager.createToggleAction(
"autoJoin",
"Map", mapActions);
427 editorActionManager.createAction(
"shrinkMapSize",
"Map", mapActions);
428 editorActionManager.createAction(
"enterExit",
"Map Navigation", mapActions);
429 editorActionManager.createAction(
"nextExit",
"Map Navigation", mapActions);
430 editorActionManager.createAction(
"prevExit",
"Map Navigation", mapActions);
431 editorActionManager.createAction(
"deleteUnknownObjects",
"Map Navigation", mapActions);
432 editorActionManager.createAction(
"enterNorthMap",
"Map Navigation", mapActions);
433 editorActionManager.createAction(
"enterEastMap",
"Map Navigation", mapActions);
434 editorActionManager.createAction(
"enterSouthMap",
"Map Navigation", mapActions);
435 editorActionManager.createAction(
"enterWestMap",
"Map Navigation", mapActions);
436 editorActionManager.createAction(
"enterNorthEastMap",
"Map Navigation", mapActions);
437 editorActionManager.createAction(
"enterSouthEastMap",
"Map Navigation", mapActions);
438 editorActionManager.createAction(
"enterSouthWestMap",
"Map Navigation", mapActions);
439 editorActionManager.createAction(
"enterNorthWestMap",
"Map Navigation", mapActions);
440 editorActionManager.createAction(
"enterUpMap",
"Map Navigation", mapActions);
441 editorActionManager.createAction(
"enterDownMap",
"Map Navigation", mapActions);
442 editorActionManager.createAction(
"createTileNorth",
"Map/Create Tile", mapActions);
443 editorActionManager.createAction(
"createTileEast",
"Map/Create Tile", mapActions);
444 editorActionManager.createAction(
"createTileSouth",
"Map/Create Tile", mapActions);
445 editorActionManager.createAction(
"createTileWest",
"Map/Create Tile", mapActions);
446 editorActionManager.createAction(
"createTileNorthEast",
"Map/Create Tile", mapActions);
447 editorActionManager.createAction(
"createTileSouthEast",
"Map/Create Tile", mapActions);
448 editorActionManager.createAction(
"createTileSouthWest",
"Map/Create Tile", mapActions);
449 editorActionManager.createAction(
"createTileNorthWest",
"Map/Create Tile", mapActions);
450 editorActionManager.createAction(
"createTileUp",
"Map/Create Tile", mapActions);
451 editorActionManager.createAction(
"createTileDown",
"Map/Create Tile", mapActions);
452 editorActionManager.createToggleAction(
"gridVisible",
"Map Navigation", mapActions);
453 editorActionManager.createToggleAction(
"lightVisible",
"Map Navigation",
new LightVisibleAction(mapViewSettings));
454 editorActionManager.createToggleAction(
"smoothing",
"Map Navigation", mapActions);
455 editorActionManager.createToggleAction(
"doubleFaces",
"Map Navigation", mapActions);
456 editorActionManager.createToggleAction(
"tileShow",
"Map Navigation", mapActions);
457 editorActionManager.createToggleAction(
"tileStretching",
"Map Navigation", mapActions);
458 editorActionManager.createAction(
"editPlugins",
"Plugin",
new PluginManagerFactory<>(mainViewFrame, pluginControl, projectModel.getPluginModel(), pluginParameterViewFactory, resourceIcons));
459 editorActionManager.createAction(
"savePlugins",
"Plugin",
new SavePluginsAction<>(pluginControl));
460 editorActionManager.createAction(
"importPlugin",
"Plugin",
new ImportPluginAction<>(projectModel.getPluginModel(), parent));
461 editorActionManager.createAction(
"update",
"Tool", updaterManager);
462 editorActionManager.createAction(
"about",
"Help",
new About(parent));
463 editorActionManager.createAction(
"undo",
"Undo", undoControl);
464 editorActionManager.createAction(
"redo",
"Undo", undoControl);
465 final Action exitAction = editorActionManager.createAction(
"exit",
"Other",
new ExitAction(exiter, scriptEditControl, fileControl, pickmapChooserControl, pluginControl));
466 mainView =
new MainView(mainViewFrame, exitAction, mapDesktop, icon, exiter);
467 editorActionManager.createAction(
"createPickmapFolder",
"Pickmap", mapFolderTreeActions);
468 editorActionManager.createAction(
"deletePickmapFolder",
"Pickmap", mapFolderTreeActions);
469 editorActionManager.createAction(
"resetView",
"Map", viewActions);
470 editorActionManager.createAction(
"saveMap",
"Map", mapFileActions);
471 editorActionManager.createAction(
"saveMapAs",
"Map", mapFileActions);
472 editorActionManager.createAction(
"createImage",
"Map,Image", mapFileActions);
473 editorActionManager.createAction(
"reloadMap",
"Map", mapFileActions);
474 editorActionManager.createAction(
"closeMap",
"Map", mapFileActions);
475 editorActionManager.createAction(
"clear",
"Copy Buffer", mainActions);
476 editorActionManager.createAction(
"cut",
"Copy Buffer", mainActions);
477 editorActionManager.createAction(
"copy",
"Copy Buffer", mainActions);
478 editorActionManager.createAction(
"paste",
"Copy Buffer", mainActions);
479 editorActionManager.createAction(
"pasteTiled",
"Copy Buffer", mainActions);
480 editorActionManager.createAction(
"shiftNorth",
"Map/Shift", mainActions);
481 editorActionManager.createAction(
"shiftNorthEast",
"Map/Shift", mainActions);
482 editorActionManager.createAction(
"shiftEast",
"Map/Shift", mainActions);
483 editorActionManager.createAction(
"shiftSouthEast",
"Map/Shift", mainActions);
484 editorActionManager.createAction(
"shiftSouth",
"Map/Shift", mainActions);
485 editorActionManager.createAction(
"shiftSouthWest",
"Map/Shift", mainActions);
486 editorActionManager.createAction(
"shiftWest",
"Map/Shift", mainActions);
487 editorActionManager.createAction(
"shiftNorthWest",
"Map/Shift", mainActions);
488 editorActionManager.createAction(
"find",
"Map", mainActions);
489 editorActionManager.createAction(
"findNext",
"Map", mainActions);
490 editorActionManager.createAction(
"findPrev",
"Map", mainActions);
491 editorActionManager.createAction(
"replace",
"Map", mainActions);
492 editorActionManager.createAction(
"fillAuto",
"Map/Fill", mainActions);
493 editorActionManager.createAction(
"fillAbove",
"Map/Fill", mainActions);
494 editorActionManager.createAction(
"fillBelow",
"Map/Fill", mainActions);
495 editorActionManager.createAction(
"randFillAuto",
"Map/Fill", mainActions);
496 editorActionManager.createAction(
"randFillAbove",
"Map/Fill", mainActions);
497 editorActionManager.createAction(
"randFillBelow",
"Map/Fill", mainActions);
498 editorActionManager.createAction(
"floodFill",
"Map/Fill", mainActions);
499 editorActionManager.createAction(
"massChange",
"Map", mainActions);
500 editorActionManager.createAction(
"selectAll",
"Map/Selection", mainActions);
501 editorActionManager.createAction(
"invertSelection",
"Map/Selection", mainActions);
502 editorActionManager.createAction(
"expandEmptySelection",
"Map/Selection", mainActions);
503 editorActionManager.createAction(
"tileStretchingSet",
"Map,Tile Stretching", mainActions);
504 editorActionManager.createAction(
"tileStretchingClear",
"Map,Tile Stretching", mainActions);
505 editorActionManager.createAction(
"tileStretchingIncrease",
"Map,Tile Stretching", mainActions);
506 editorActionManager.createAction(
"tileStretchingDecrease",
"Map,Tile Stretching", mainActions);
509 editorActionManager.createAction(
"collectArches",
"Tool",
new CollectArchesAction<>(projectModel.getProjectSettings(), projectModel.getResources(), exiter,
mainViewFrame));
510 editorActionManager.createAction(
"reloadFaces",
"Image,Tool",
new ReloadFacesAction<>(projectModel.getArchetypeSet(), projectModel.getFaceObjectProviders()));
511 editorActionManager.createAction(
"validateMap",
"Map,Tool",
new ValidateMapAction<>(projectModel.getValidators(), projectModel.getMapManager()));
512 editorActionManager.createAction(
"showHelp",
"Help",
new ShowHelpAction(parent));
513 editorActionManager.createAction(
"tipOfTheDay",
"Help",
new TipOfTheDayAction(parent));
514 editorActionManager.createAction(
"newMap",
"Map",
new NewMapAction<>(newMapDialogFactory));
515 editorActionManager.createAction(
"goMap",
"Map",
new GoMapDialogManager<>(parent, projectModel.getMapManager(),
mapViewsManager, projectModel.getProjectSettings(), exiter));
516 editorActionManager.createAction(
"goExit",
"Map Navigation",
new GoExitDialogManager<>(parent, projectModel.getMapManager(), mapViewManager, exitGameObjectMatcher, enterMap, projectModel.getFaceObjectProviders()));
518 editorActionManager.createAction(
"collectSpells",
"Tool",
new CollectSpellsAction(spellUtils, projectModel.getProjectSettings(), parent));
519 editorActionManager.createAction(
"controlClient",
"Tool",
new ControlClientAction(appPreferencesModel, mainViewFrame));
520 editorActionManager.createAction(
"controlServer",
"Tool",
new ControlServerAction(appPreferencesModel, mainViewFrame));
521 editorActionManager.createAction(
"gc",
"Tool",
new GcAction(statusBar));
522 editorActionManager.createAction(
"options",
"Tool",
new OptionsAction<>(editorFactory, projectModel.getProjectSettings(), editorSettings, projectModel.getValidators(), appPreferencesModel, exitConnectorModel, configSourceFactory, parent));
523 editorActionManager.createAction(
"shortcuts",
"Tool",
new ShortcutsAction(shortcutsManager, parent));
524 editorActionManager.createAction(
"zoom",
"Tool",
new ZoomAction<>(projectModel.getMapManager(), rendererFactory, parent));
525 editorActionManager.createAction(
"moveCursorNorth",
"Map Cursor,Map/Selection", mapCursorActions);
526 editorActionManager.createAction(
"moveCursorEast",
"Map Cursor,Map/Selection", mapCursorActions);
527 editorActionManager.createAction(
"moveCursorSouth",
"Map Cursor,Map/Selection", mapCursorActions);
528 editorActionManager.createAction(
"moveCursorWest",
"Map Cursor,Map/Selection", mapCursorActions);
529 editorActionManager.createAction(
"moveCursorNorthEast",
"Map Cursor,Map/Selection", mapCursorActions);
530 editorActionManager.createAction(
"moveCursorSouthEast",
"Map Cursor,Map/Selection", mapCursorActions);
531 editorActionManager.createAction(
"moveCursorSouthWest",
"Map Cursor,Map/Selection", mapCursorActions);
532 editorActionManager.createAction(
"moveCursorNorthWest",
"Map Cursor,Map/Selection", mapCursorActions);
533 editorActionManager.createAction(
"goLocation",
"Map Cursor",
new GoLocationAction<>(mapViewManager));
539 editorActionManager.createAction(
"insertArch",
"Map Cursor,Map",
new InsertArchAction<>(objectChooser, mapViewSettings));
543 editorActionManager.createAction(
"archAttributes",
"Map",
new ArchAttributesAction<>(gameObjectAttributesDialogFactory));
544 editorActionManager.createAction(
"newScript",
"Script", scriptEditControl);
545 editorActionManager.createAction(
"editScript",
"Script",
new EditScriptAction<>(fileControl));
546 editorActionManager.createAction(
"openFile",
"Map",
new OpenFileAction<>(fileControl));
547 editorActionManager.createAction(
"saveAllMaps",
"Map",
new SaveAllMapsAction<>(fileControl));
548 final Action aCloseAllMaps = editorActionManager.createAction(
"closeAllMaps",
"Map,Window",
new CloseAllMapsAction<>(fileControl));
549 editorActionManager.createAction(
"gameObjectTextEditor",
"Tool",
new MainViewActions<>(mainView, gameObjectAttributesControl, gameObjectTab, textEditorTab));
550 editorActionManager.createAction(
"manageBookmarks",
"Bookmarks",
new ManageBookmarksAction<>(mapMenu, mapImageCache, parent));
552 editorActionManager.createActionOptional(
"openInClient",
"Map", editorFactory.newServerActions(fileControl));
553 editorActionManager.createAction(
"exitCopy",
"Exit Connector", exitConnectorController);
554 editorActionManager.createAction(
"exitPaste",
"Exit Connector", exitConnectorController);
555 editorActionManager.createAction(
"exitConnect",
"Exit Connector", exitConnectorController);
556 pickmapChooserControl.setPopupMenu(ACTION_BUILDER.createPopupMenu(
true,
"pickmaps"));
557 final JMenuBar menuBar = ACTION_BUILDER.createMenuBar(
true,
"main");
558 mainViewFrame.setJMenuBar(menuBar);
559 mainViewFrame.add(
new MainToolbar(editorSettings).getComponent(), BorderLayout.NORTH);
560 mainViewFrame.add(statusBar, BorderLayout.SOUTH);
561 mainView.
addTab(gameObjectTab);
562 final String compassIconName = editorFactory.getCompassIconName();
563 final ImageIcon compassIcon = compassIconName == null ? null : resourceIcons.getResourceIcon(compassIconName);
564 mainView.
addTab(
new Tab(
"selectedSquare",
new SelectedSquareView<>(selectedSquareModel, gameObjectAttributesDialogFactory, objectChooser, mapViewManager, mapViewSettings, compassIcon, projectModel.getFaceObjectProviders(), unknownSquareIcon, moveSquareUpAction, moveSquareDownAction, moveSquareTopAction, moveSquareBottomAction, moveSquareEnvAction, moveSquareInvAction),
Location.RIGHT,
false, 1,
true));
566 mainView.
addTab(
new Tab(
"objects", objectChooser,
Location.LEFT,
false, 3,
true));
568 if (windowMenu == null) {
569 LOG.warn(
"'main' menu bar does not define 'window' menu.");
574 final JMenu pickmapFoldersMenu =
MenuUtils.
getMenu(menuBar,
"pickmapFolders");
575 if (pickmapFoldersMenu == null) {
576 LOG.warn(
"'main' menu bar does not define 'pickmapFolders' menu.");
578 mapFolderTreeActions.setPickmapFoldersMenu(pickmapFoldersMenu);
580 viewActions.init(projectModel.getGameObjectMatchers().getFilters());
582 if (viewMenu == null) {
583 LOG.warn(
"'main' menu bar does not define 'view' menu.");
585 viewActions.setMenu(viewMenu);
588 if (pluginsMenu == null) {
589 LOG.warn(
"'main' menu bar does not define 'plugins' menu.");
591 pluginControl.getView().setMenu(pluginsMenu);
594 gameObjectAttributesControl.addTab(
new ArchTab<>(projectModel.getArchetypeTypeSet(), gameObjectAttributesModel));
595 gameObjectAttributesControl.addTab(
new MsgTextTab<>(gameObjectAttributesModel));
596 gameObjectAttributesControl.addTab(
new EventsTab<>(parent, projectModel.getMapManager(), gameObjectAttributesModel, scriptArchEditor, editorFactory.newScriptArchData(), scriptArchDataUtils, scriptArchUtils));
597 gameObjectAttributesControl.addTab(
new FaceTab<>(gameObjectAttributesModel, projectModel.getFaceObjects(), projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), noFaceSquareIcon, unknownSquareIcon));
598 gameObjectAttributesControl.addTab(textEditorTab);
599 mainView.
addTab(
new Tab(
"monsters",
new MonsterControl<>(mapViewManager, delayedMapModelListenerManager, monsterMatcher).getView(),
Location.BOTTOM,
false, 4,
false));
601 mainView.
addTab(
new Tab(
"lockedItems", lockedItemsControl.getView(),
Location.BOTTOM,
false, 6,
false));
605 new ArchetypeValidator(projectModel.getAnimationObjects(), projectModel.getFaceObjects(), errorView).validate(projectModel.getArchetypeSet());
606 new AnimationValidator(projectModel.getFaceObjects(), errorView).validate(projectModel.getAnimationObjects());
611 if (recentMenu == null) {
612 LOG.warn(
"'main' menu bar does not define 'recent' menu.");
614 recentMapMenuManager.setMenu(recentMenu);
618 if (bookmarksMenu == null) {
619 LOG.warn(
"'main' menu bar does not define 'bookmarks' menu.");
621 bookmarksMapMenuManager.setMenu(bookmarksMenu);
625 if (analyzeMenu == null) {
626 LOG.warn(
"'main' menu bar does not define 'analyze' menu.");
628 filterControl.createMenuEntries(analyzeMenu);
631 mapUserListenerManager.
addMapManager(projectModel.getMapManager());
632 mapUserListenerManager.
addMapManager(projectModel.getPickmapManager());
636 new Loader<>(errorView, mapFolderTree, projectModel.getMapReaderFactory(), projectModel.getPickmapManager(),
mapViewsManager).load();
637 if (!pickmapChooserModel.isEmpty()) {
638 objectChooser.movePickmapChooserToFront();
640 recentMapMenuManager.initRecent();
641 if (bookmarksMapMenuManager != null) {
642 bookmarksMapMenuManager.initRecent();
646 new RecentManager<>(projectModel.getMapManager(), recentMapMenuPreferences);
649 new AutoValidator<>(projectModel.getValidators(), editorFactory.isAutoValidatorDefault(), delayedMapModelListenerManager);
650 projectModel.getMapManager().setFileControl(fileControl);
652 delayedMapModelListenerManager.start();
662 return ResourceBundle.getBundle(
"build").getString(
"build.number");
663 }
catch (
final MissingResourceException ignored) {
664 return "unknown version";
673 public void openFile(@NotNull
final File file)
throws IOException {
674 final boolean isScriptFile = file.getName().toLowerCase().endsWith(scriptExtension);
681 }
else if (!file.exists()) {
695 public void openFiles(
final Iterable<String> filenames) {
696 for (
final String filename : filenames) {
697 final File file =
new File(filename);
700 }
catch (
final IOException ex) {
715 public void run(@NotNull
final Iterable<String> args) {
716 mainViewFrame.setVisible(
true);
717 TipOfTheDayManager.showAtStartup(mainViewFrame);
721 ACTION_BUILDER.showMessageDialog(mainViewFrame,
"loadArchesNoArchetypes");
Implements the controller for undo/redo actions.
An EditorAction that toggles whether map lighting is visible.
A Filter that aggregates named filters.
final MapViewsManager< G, A, R > mapViewsManager
The MapViewsManager instance.
Dialog to edit events linked to item scripting.
static final Category LOG
The logger for printing log messages.
An EditorAction that shows the "tip of the day" dialog.
Implements the main status bar of the application.
Abstract controller base class for map view controls.
Package with common types for event archetypes.
Implements actions related to the MainView.
Convenience class for adding messages to a ErrorView instance using a fixed category name...
void reportLoadError(@Nullable final File file, @NotNull final String message)
A DisplayMode showing archetypes as images only.
An EditorAction that shrinks the current selection by one map square.
Graphical User Interface of Gridarta.
Interface for classes that match GameObjects.
This package contains classes related to matching GameObjects, so called GameObjectMatchers.
An EditorAction that runs the map validator on the current map.
Reading and writing of Atrinik maps.
The controller of the locked items view control.
Creates and displays the find dialog.
An EditorAction that edits or creates a map file.
final JFrame mainViewFrame
The main window's JFrame.
An EditorAction that toggles a selection process.
UI parts of the implementation of an Undo / Redo in Gridarta.
An EditorAction that adds the current pre-selection to the selection.
The JDesktopPane containing all map views.
An EditorAction that toggles the current pre-selection in the selection.
The action for saving modified plugins.
static final Preferences PREFERENCES
The Preferences.
final ProjectModel< G, A, R > projectModel
The ProjectModel to edit.
A tab in a TabbedPanel component.
An EditorAction that reloads all images from disk.
Gridarta can handle frame information of animations and allow the selection of an animation using a t...
Factory for creating ScriptedEvent instances.
The tab containing the game object text editor.
Tracks map views and attaches/detaches MapMouseListener instances.
An EditorAction that opens the "Create New Map" dialog.
Utility class for validating ArchetypeSet instances.
A factory that creates dialogs for editing game object attributes.
An EditorAction that finishes a selection process when the mouse button is released.
Implements actions for the "file" menu attached to maps.
Stores all existing MapViews.
GUIMainControl(@NotNull final ProjectModel< G, A, R > projectModel, @NotNull final EditorSettings editorSettings, @NotNull final ErrorView errorView, @NotNull final ResourceIcons resourceIcons, @NotNull final EditorFactory< G, A, R > editorFactory, @NotNull final ConfigSourceFactory configSourceFactory)
Creates a new instance.
final UpdaterManager updaterManager
The UpdaterManager instance.
void showNewMapDialog()
Shows a dialog for creating a new map.
Main window of the level editor.
Default FileControl implementation.
Encapsulates functionality related to actions for pickmap folder selection.
Maintains the application preferences state.
Utility class defining FileFilters.
void openScriptFile(@NotNull final String pathName)
Open a new empty script document.
The "Face" tab in the archetype chooser.
An net.sf.gridarta.utils.EditorAction that selects the previous game object in the SelectedSquareMode...
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
void openFile(@NotNull final File file)
Loads a map file.
Default MapViewSettings implementation.
final String scriptExtension
The extensions of event script files.
Interface for classes displaying error messages.
Base package of all Gridarta classes.
An EditorAction that inserts a new game object into the current map.
A View for choosing pickmaps.
An net.sf.gridarta.utils.EditorAction that moves the selected game object in the SelectedSquareModel ...
void addMapManager(@NotNull final MapManager< G, A, R > mapManager)
Registers a MapManager to track.
An EditorAction that creates a new bookmark for the current map.
This package contains the classes for the script editor used within the editor to create and modify P...
Reflects a game object (object on a map).
Implements views of links between GameObjects or groups or.
An net.sf.gridarta.utils.EditorAction that selects the next game object in the SelectedSquareModel.
Creates and displays the replace dialog.
MapView< G, A, R > openMapFileWithView(@NotNull final MapFile mapFile, @Nullable final Point viewPosition, @Nullable final Point centerSquare)
Load a map file and create a map view.
int getArchetypeCount()
Returns the number of Archetypes available.
An EditorAction that edits or creates a script file.
An EditorAction that deletes the currently selected game object.
A factory for creating ConfigSources.
Selects valid exit game objects from maps.
This package contains the preferences ui modules.
void loadShortcuts()
Restores all shortcuts from the preferences.
void handleThrowable(@NotNull final Throwable t)
Container for settings that affect the rendering of maps.
An EditorAction that opens the game object attributes dialog for the currently selected game object...
This class handles updating the map editor.
An EditorAction that saves all modified maps.
GameObjects are the objects based on Archetypes found on maps.
Interface used as preferences location.
An EditorAction that openes the "go location" dialog.
The "Events" tab in the game object attributes panel.
Creates images from map instances.
The controller of the exit connector.
Stores all known MapFiles.
static final String SQUARE_UNKNOWN
Default implementation of VolatileSettings.
static final String DEFAULT_PREVIEW
The default map preview to use if no icon can be created.
An EditorAction that closes all map windows.
The view of the archetype chooser.
An EditorAction that shows the help dialog.
The CFTreasureListTree class fully manages treasurelists.
Maintains a set of EditorAction instances and calls their event listener callbacks.
void openFiles(final Iterable< String > filenames)
Load a list of map files.
The filter package contains the classes for Filters.
void setTextAreaDefaults(@NotNull final TextAreaDefaults textAreaDefaults)
Caches icon and preview images for map files.
Displays the contents of the currently selected map square.
Manager for shortcuts of all Actions in an ActionBuilder instance.
Manages actions in the "map" menu.
The model of the game object attributes dialog.
static String getBuildNumberAsString()
Returns the application's build number as a string.
MainControl is a central class that's used for access on global data structures / collections and glo...
An EditorAction that runs the archetype collection.
final NewMapDialogFactory< G, A, R > newMapDialogFactory
The NewMapDialogFactory instance for creating new maps or pickmaps.
This package contains the other part of the script editor.
static final String SQUARE_NO_FACE
static final ActionBuilder ACTION_BUILDER
The ActionBuilder.
Default PickmapSettings implementation.
static final String DEFAULT_ICON
The default map icon to use if no icon can be created.
The controller of the monster view control.
Maintains loaded PickmapState instances.
Base classes for rendering maps.
An EditorAction that displays the browse archetypes dialog.
static final FileFilter MAP_FILE_FILTER
Swing FileFilter for map files.
Creates the main GUI of Gridarta.
final DefaultFileControl< G, A, R > fileControl
The DefaultFileControl instance.
ArchetypeSet< G, A, R > getArchetypeSet()
The Tab displaying the game object text editor.
Factory for creating MapRenderer instances.
ScriptEditControl - Manages events and data flow for the script editor entity.
Classes implementing the pickmap chooser.
net.sf.gridarta.model.scripts.ScriptArchData related functions.
An net.sf.gridarta.utils.EditorAction that moves the selected game object in the SelectedSquareModel ...
Utility class to create NewMapDialog instances.
Abstract base class for classes implementing display modes of the archetype chooser.
A Tab that displays the currently selected GameObject.
Utility class implementing actions that operate on ExitConnectorModels.
Utility class for ActionBuilder related functions.
Common base class for the panel that allows users to edit a GameObject's attributes.
Encapsulates actions and related functions.
Implements the auto-validator for map validation.
An EditorAction that displays the find archetypes dialog.
Stores information needed by the exit connector.
Creates images from map instances.
Manages the pickmap panel and most pickmap-related code in general.
The panel that displays the game objects of the currently selected map square.
A DisplayMode showing archetypes as images and archetype name.
The "Msg Text" tab in the game object attributes panel.
Dialog to create events linked to item scripting.
final ScriptEditControl scriptEditControl
The ScriptEditControl instance.
Creates ImageIcon instances from resources.
An net.sf.gridarta.utils.EditorAction that moves the selected game object in the SelectedSquareModel ...
An net.sf.gridarta.utils.EditorAction that moves the selected game object in the SelectedSquareModel ...
A Tab that displays map validator results.
Factory for creating map property dialog instances.
An GameObjectMatcher matching certain archetype types.
An net.sf.gridarta.utils.EditorAction that moves the selected game object in the SelectedSquareModel ...
An net.sf.gridarta.utils.EditorAction that moves the selected game object in the SelectedSquareModel ...
An EditorAction that opens the bookmarks manager.
An ErrorPanel displays errors to the user.
An EditorAction tha shows the treasurelists dialog.
void run(@NotNull final Iterable< String > args)
Starts the editor: makes the main window visible and opens map files.
Implements the "Game Object Text Editor".
Tracks key presses and maps them to actions.
void handleThrowable(final Throwable t)
This implementation displays the exception in a modal message dialog.
Helper class for entering maps.
void addTab(@NotNull final Tab tab)
Adds a tab.
The model component of the selected square control.
An EditorAction that selects the game object above the current game object.
void newScript()
Open a new empty script document.
Factory for creating PluginParameterView instances.
An EditorAction that selects the game object below the current game object.
An EditorAction that grows the current selection by one map square.
Settings that apply to the editor.
static final String APP_ICON
Application icon definitions (icon-dir).
Manager for GoExitDialog instances.
Loader for pickmaps from a directory.
Provides support for delayed notification of MapModel changes.
Common base implementation of CopyBuffer.
The controller of the connection view control.
The action for importing a plugin from a file.
final MainView mainView
The MainView instance.
That control of the archetype chooser.
An EditorAction that removes the current pre-selection from the selection.
void startup()
Eventually perform an update during startup.
Default ExitConnectorModel implementation.
Manages edit type actions in "view" menu.
Manager for GoMapDialog instances.
The object Chooser implementation.
The main toolbar of the application.
A DisplayMode showing archetypes as images and in-game game object name.
Utility class for validating AnimationObject instances.
A factory for creating MapView instances.
Interface for MapArchObjects.
static final String CLOSE_TAB_SMALL_ICON
Container for settings that affect pickmaps.
Encapsulates default settings for a text area.
Settings that are not retained across editor restarts.
The "Arch" tab in the archetype chooser.