📄 elanframe2.java
字号:
layoutManager = new ElanLayoutManager(this, viewerManager); ELANCommandFactory.addDocument(this, viewerManager, layoutManager); MediaDescriptorUtil.createMediaPlayers((TranscriptionImpl) transcriptionForThisFrame, transcriptionForThisFrame.getMediaDescriptors()); ElanMediaPlayerController mediaController = viewerManager.getMediaPlayerController(); layoutManager.add(mediaController); TimeLineViewer timeLineViewer = viewerManager.createTimeLineViewer(); layoutManager.add(timeLineViewer); InterlinearViewer interlinearViewer = viewerManager.createInterlinearViewer(); layoutManager.add(interlinearViewer); layoutManager.showTimeLineViewer(); GridViewer gridViewer = viewerManager.createGridViewer(); layoutManager.add(gridViewer); TextViewer textViewer = viewerManager.createTextViewer(); layoutManager.add(textViewer); SubtitleViewer subtitleViewer1 = viewerManager.createSubtitleViewer(); layoutManager.add(subtitleViewer1); SubtitleViewer subtitleViewer2 = viewerManager.createSubtitleViewer(); layoutManager.add(subtitleViewer2); SubtitleViewer subtitleViewer3 = viewerManager.createSubtitleViewer(); layoutManager.add(subtitleViewer3); SubtitleViewer subtitleViewer4 = viewerManager.createSubtitleViewer(); layoutManager.add(subtitleViewer4); LinkedFileDescriptorUtil.initLinkedFiles((TranscriptionImpl) transcriptionForThisFrame); // layoutManager.add(new mpi.eudico.p2p.CollaborationPanel()); if (elanP2P != null) { elanP2P.setManagers(viewerManager, layoutManager); } // temp block for svg if (SVGPrefs.getUseSVG() || (((TranscriptionImpl) transcriptionForThisFrame).getSVGFile() != null)) { // lightweight svgviewer if (viewerManager.getMasterMediaPlayer() instanceof JMFGraphicMediaPlayer) { // don't need to add to layout menuItemFileOpen.setEnabled(false); menuItemFileNew.setEnabled(false); menuImport.setEnabled(false); } } ElanLocale.addElanLocaleListener(transcriptionForThisFrame, this); setFrameTitle(); initMenusAndCommands(); if (viewerManager.getMasterMediaPlayer().isFrameRateAutoDetected()) { // disable the menu to change the video standard, i.e. the frame length setMenuEnabled(FrameConstants.FRAME_LENGTH, false); } loadPreferences(); // instantiate Viewer components: // use CommandActions for relevant toolbar buttons and combobox menu items // position and size components using LayoutManager layoutManager.doLayout(); // this sucks but is needed to ensure visible video on the mac viewerManager.getMasterMediaPlayer().setMediaTime(0); } private void setFrameTitle() { try { if (transcriptionForThisFrame != null) { if (transcriptionForThisFrame.getName().equals(TranscriptionImpl.UNDEFINED_FILE_NAME)) { setTitle("Elan - " + ElanLocale.getString( "Frame.ElanFrame.UndefinedFileName")); } else { setTitle("Elan - " + transcriptionForThisFrame.getName()); } } } catch (Exception e) { e.printStackTrace(); } } /** * Performs some general initialization for an empty frame. */ private void initFrame() { // create the initial menu items initMenuBar(); // listen for WindowEvents events on the ElanFrame addWindowListener(new ElanFrameWindowListener()); // require the program to handle the operation in the // windowClosing method of a registered WindowListener object. setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // add this elanframe to locale listener //ElanLocale.addElanLocaleListener(this); pack(); /* Dimension dimSize = new Dimension(800, 650); setSize((int)dimSize.getWidth(), (int)dimSize.getHeight()); Dimension dimLocation = Toolkit.getDefaultToolkit().getScreenSize(); setLocation((int)(dimLocation.getWidth()/2-getWidth()/2),(int)(dimLocation.getHeight()/2-getHeight()/2)); */ Dimension d = (Dimension) Preferences.get("FrameSize", null); if (d != null) { setSize(d); } else { Dimension dimSize = new Dimension(800, 650); setSize((int) dimSize.getWidth(), (int) dimSize.getHeight()); } Point p = (Point) Preferences.get("FrameLocation", null); if (p != null) { setLocation(p); } else { Dimension dimLocation = Toolkit.getDefaultToolkit().getScreenSize(); setLocation((int) ((dimLocation.getWidth() / 2) - (getWidth() / 2)), (int) ((dimLocation.getHeight() / 2) - (getHeight() / 2))); } // the call to setVisible should be moved to (a new thread created in) // the class that called a constructor.... setVisible(true); } private void initMenuBar() { menuBar = new JMenuBar(); setJMenuBar(menuBar); //make menu visible / appear above heavyweight video JPopupMenu.setDefaultLightWeightPopupEnabled(false); MenuAction ma; ma = new MenuAction("Menu.File"); menuFile = new JMenu(ma); menuActions.add(ma); menuBar.add(menuFile); ma = new NewMA("Menu.File.New", this); menuActions.add(ma); menuItemFileNew = new JMenuItem(ma); menuFile.add(menuItemFileNew); ma = new OpenMA("Menu.File.Open", this); menuActions.add(ma); menuItemFileOpen = new JMenuItem(ma); menuFile.add(menuItemFileOpen); ma = new MenuAction("Menu.File.OpenRecent"); menuActions.add(ma); menuRecentFiles = new JMenu(ma); menuFile.add(menuRecentFiles); menuFile.addSeparator(); ma = new MenuAction("Menu.File.Import"); menuActions.add(ma); menuImport = new JMenu(ma); menuFile.add(menuImport); ma = new ImportShoeboxMA("Menu.File.Import.Shoebox", this); menuActions.add(ma); menuItemShoeboxImport = new JMenuItem(ma); menuImport.add(menuItemShoeboxImport); ma = new ImportCHATMA("Menu.File.Import.CHAT", this); menuActions.add(ma); menuItemCHATImport = new JMenuItem(ma); menuImport.add(menuItemCHATImport); ma = new ImportTranscriberMA("Menu.File.Import.Transcriber", this); menuActions.add(ma); menuItemTranscriberImport = new JMenuItem(ma); menuImport.add(menuItemTranscriberImport); menuFile.addSeparator(); ma = new ExitMA("Menu.File.Exit"); menuActions.add(ma); menuItemFileExit = new JMenuItem(ma); menuFile.add(menuItemFileExit); ma = new MenuAction("Menu.Edit"); menuActions.add(ma); menuEdit = new JMenu(ma); menuBar.add(menuEdit); menuEdit.setVisible(false); ma = new MenuAction("Menu.Annotation"); menuActions.add(ma); menuAnnotation = new JMenu(ma); menuBar.add(menuAnnotation); menuAnnotation.setVisible(false); ma = new MenuAction("Menu.Tier"); menuActions.add(ma); menuTier = new JMenu(ma); menuBar.add(menuTier); menuTier.setVisible(false); ma = new MenuAction("Menu.Type"); menuActions.add(ma); menuType = new JMenu(ma); menuBar.add(menuType); menuType.setVisible(false); ma = new MenuAction("Menu.Search"); menuActions.add(ma); menuSearch = new JMenu(ma); menuBar.add(menuSearch); menuSearch.setVisible(false); ma = new MenuAction("Menu.View"); menuActions.add(ma); menuView = new JMenu(ma); menuBar.add(menuView); menuView.setVisible(false); ma = new MenuAction("Menu.Options"); menuActions.add(ma); menuOptions = new JMenu(ma); menuBar.add(menuOptions); ma = new MenuAction("Menu.Window"); menuActions.add(ma); menuWindow = new JMenu(ma); windowsGroup = new ButtonGroup(); menuBar.add(menuWindow); ma = new MenuAction("Menu.Help"); menuActions.add(ma); menuHelp = new JMenu(ma); menuBar.add(menuHelp); menuHelp.setVisible(false); // temporary and therefore old fashioned menu item to allow fallback to JMF media players // on windows machines. As soon as native media is succesfully used in a few releases // this menu item can be deleted. The only action performed while toggling this item is // setting the PreferredMediaFramework property that is used by the player factory if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) { menuItemNativeMedia = new JCheckBoxMenuItem(); menuItemNativeMedia.setText("Use Native Media Platform"); menuItemNativeMedia.addActionListener(this); // haal de state uit de property boolean nativePrefered = true; String preferredMF = System.getProperty("PreferredMediaFramework"); // set here default choice if nothing defined if (preferredMF == null) { System.setProperty("PreferredMediaFramework", "NativeWindows"); //System.setProperty("PreferredMediaFramework", "JMF"); } else if (!preferredMF.equals("NativeWindows")) { nativePrefered = false; } menuItemNativeMedia.setState(nativePrefered); // optionally suppress jmf support for the standalone version String suppressJMF = System.getProperty("suppressJMF"); if ((suppressJMF == null) || !suppressJMF.toLowerCase().equals("true")) { menuOptions.add(menuItemNativeMedia); } } if (elanP2P != null) { ma = new MenuAction("Menu.P2P"); menuActions.add(ma); menuP2P = new JMenu(ma); menuBar.add(menuP2P); menuItemDiscoverDoc = new JMenuItem(); menuItemDiscoverDoc.addActionListener(this); menuItemDiscoverDoc.setActionCommand("DiscoverDoc"); menuP2P.add(menuItemDiscoverDoc); } if (System.getProperty("os.name").startsWith("Mac OS")) { // inserted by AR to allow choice for permanent detached video at startup menuItemPermanentDetached = new JCheckBoxMenuItem(); menuItemPermanentDetached.setText("Use detached media window"); menuItemPermanentDetached.addActionListener(this); // haal de state uit de preferences Boolean permanentDetached = (Boolean) Preferences.get("PreferredMediaWindow", null); if (permanentDetached == null) { permanentDetached = new Boolean(false); // default usage is attached media window } menuItemPermanentDetached.setState(permanentDetached.booleanValue()); menuOptions.add(menuItemPermanentDetached); // end of insertion by AR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -