From: Olivier G. <og...@us...> - 2008-02-17 22:11:48
|
Update of /cvsroot/osmose-dev/osmose/src/osmose/application/slideviewer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6501/src/osmose/application/slideviewer Modified Files: OSMSlideViewer.java OSMSlideViewerPanel.java Log Message: Added choice for putting bullet lists in notes (by Fatimatou) Index: OSMSlideViewer.java =================================================================== RCS file: /cvsroot/osmose-dev/osmose/src/osmose/application/slideviewer/OSMSlideViewer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OSMSlideViewer.java 3 Oct 2007 21:31:16 -0000 1.3 --- OSMSlideViewer.java 17 Feb 2008 22:11:51 -0000 1.4 *************** *** 21,25 **** import osmose.application.common.*; import osmose.application.data.*; ! /** --- 21,25 ---- import osmose.application.common.*; import osmose.application.data.*; ! import javax.swing.*; /** *************** *** 40,52 **** public void begin2Draw() { ! ! // Get index of current page in slide editor ! OSMSlide currentSlide = OSMApplication.SlideEditor.getCurrentSlide(); ! if(currentSlide != null) ! m_Panel.goPage(m_Panel.getPageIndex(currentSlide) + 1); ! else ! m_Panel.goPage(1); ! } ! /** --- 40,69 ---- public void begin2Draw() { ! // Get index of current page in slide editor ! OSMSlide currentSlide = OSMApplication.SlideEditor.getCurrentSlide(); ! int numberScreen = getNumberScreen(); ! if(numberScreen==1){ ! if(currentSlide != null){ ! m_Panel.goPage(m_Panel.getPageIndex(currentSlide) + 1); ! } ! else ! m_Panel.goPage(1); ! } ! if(numberScreen==2){ ! if(currentSlide != null){ ! m_Panel.goPage(m_Panel.getPageIndex(currentSlide)+1); ! m_PanelNotes.goPageNotes(m_Panel.getPageIndex(currentSlide)+1); ! ! m_Panel1.goPage(m_Panel1.getPageIndex(currentSlide) + 1); ! m_frame1.setVisible(true); ! } ! else{ ! ! m_Panel.goPage(1); ! m_PanelNotes.goPageNotes(1); ! m_Panel1.goPage(1); ! } ! } ! } /** *************** *** 55,63 **** public void onFrameClosing() { ! m_Panel.endOfSlides(); } - /** * starts the viewer. Sets the display mode in fullscreen mode, and displays --- 72,84 ---- public void onFrameClosing() { ! int numberScreen = getNumberScreen(); ! if(numberScreen == 1)m_Panel.endOfSlides(); ! if(numberScreen== 2){ ! m_Panel.endOfSlides(); ! m_Panel1.endOfSlides(); ! } } /** * starts the viewer. Sets the display mode in fullscreen mode, and displays *************** *** 66,70 **** public void beginViewing() { - // Use OSMFullScreenFrame capabilities showInFullScreen(); --- 87,90 ---- *************** *** 91,159 **** */ public OSMSlideViewer(OSMDocument doc, boolean audioComments) { ! super(); ! ! ! /** ! * Initialization of members. ! */ ! Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); ! ! ! // On mac, show this in a 4/3 frame. ! if(System.getProperty("os.name").toLowerCase().startsWith("mac")) ! { ! GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); ! Rectangle bounds = env.getMaximumWindowBounds(); ! m_Height = bounds.height - 25;//Height minus window title bar height ! m_Width = (int)(m_Height * 4 / 3); ! } ! else ! { ! int h = (int)screenSize.getHeight(); ! int w = (int)screenSize.getWidth(); ! m_Height = (int)(w * 3 / 4); ! if(m_Height > h) ! { ! m_Height = h; ! m_Width = (int)(h * 4 / 3); ! } ! else ! { ! m_Width = w; ! } ! } ! ! ! // Create panel to view... ! m_Panel = new OSMSlideViewerPanel(this, doc, m_Width, m_Height); ! m_Panel.setFlagAudioComments(audioComments); ! m_Panel.setMinimumSize(new Dimension(m_Width, m_Height)); ! m_Panel.setMaximumSize(new Dimension(m_Width, m_Height)); ! m_Panel.setPreferredSize(new Dimension(m_Width, m_Height)); ! ! ! // Construction of the GUI. ! getContentPane().setLayout(new GridBagLayout()); ! GridBagConstraints c = new GridBagConstraints(); ! c.insets = new Insets(0, 0, 0, 0); ! c.gridx = 0; ! c.gridy = 0; ! c.gridwidth = 1; ! c.gridheight = 1; ! c.anchor = GridBagConstraints.CENTER; ! getContentPane().add(m_Panel, c); ! getContentPane().setBackground(Color.BLACK); ! getContentPane().setForeground(Color.BLACK); ! // listener listening for 'key pressed' to navigate. ! this.addKeyListener(new KeyAdapter() { ! public void keyPressed(KeyEvent e) { ! m_Panel.keyPressed(e); ! } ! }); ! } /** * stops the viewing of the presentation. Resets the display mode to windowed --- 111,306 ---- */ public OSMSlideViewer(OSMDocument doc, boolean audioComments) { ! super(); ! ! /** ! * Initialization of members. ! */ ! Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); ! // On mac, show this in a 4/3 frame. ! if(System.getProperty("os.name").toLowerCase().startsWith("mac")) ! { ! GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); ! Rectangle bounds = env.getMaximumWindowBounds(); ! m_Height = bounds.height - 25;//Height minus window title bar height ! m_Width = (int)(m_Height * 4 / 3); ! } ! else ! { ! int h = (int)screenSize.getHeight(); ! int w = (int)screenSize.getWidth(); ! m_Height = (int)(w * 3 / 4); ! if(m_Height > h) ! { ! m_Height = h; ! m_Width = (int)(h * 4 / 3); ! } ! else ! { ! m_Width = w; ! } ! } ! ! GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ! GraphicsDevice[] gs = ge.getScreenDevices(); ! ! // Create panel to view... if there is only one screen ! if(gs.length==1){ ! m_Panel = new OSMSlideViewerPanel(this, doc, m_Width, m_Height,false); ! m_Panel.setFlagAudioComments(audioComments); ! m_Panel.setMinimumSize(new Dimension(m_Width, m_Height)); ! m_Panel.setMaximumSize(new Dimension(m_Width, m_Height)); ! m_Panel.setPreferredSize(new Dimension(m_Width, m_Height)); + // Construction of the GUI. + getContentPane().setLayout(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.insets = new Insets(0, 0, 0, 0); + c.gridx = 0; + c.gridy = 0; + c.gridwidth = 1; + c.gridheight = 1; + c.anchor = GridBagConstraints.CENTER; + getContentPane().add(m_Panel, c); + getContentPane().setBackground(Color.BLACK); + getContentPane().setForeground(Color.BLACK); + // listener listening for 'key pressed' to navigate. + this.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + m_Panel.keyPressed(e); + } + }); + } + if(gs.length==2){ + Rectangle bounds = ge.getMaximumWindowBounds(); + m_Height = bounds.height; + m_Width = m_Height; + + //create The First Panel + m_Panel =new OSMSlideViewerPanel(this, doc, m_Width, m_Height*3/4,false); + m_Panel.setFlagAudioComments(audioComments); + m_Panel.setMinimumSize(new Dimension(m_Width, m_Height*3/4)); + m_Panel.setMaximumSize(new Dimension(m_Width, m_Height*3/4)); + m_Panel.setPreferredSize(new Dimension(m_Width, m_Height*3/4)); + + // Construction of the GUI. + getContentPane().setLayout(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.insets = new Insets(0, 0, 0, 0); + c.gridx = 0; + c.gridy = 0; + c.gridwidth = 1; + c.gridheight = 1; + c.anchor = GridBagConstraints.CENTER; + + // listener listening for 'key pressed' to navigate. + this.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + m_Panel.keyPressed(e); + } + }); + + m_PanelNotes =new OSMSlideViewerPanel(this, doc, m_Width, m_Height/4,true); + m_PanelNotes.setFlagAudioComments(audioComments); + m_PanelNotes.setMinimumSize(new Dimension(m_Width, m_Height/4)); + m_PanelNotes.setMaximumSize(new Dimension(m_Width, m_Height/4)); + m_PanelNotes.setPreferredSize(new Dimension(m_Width, m_Height/4)); + + + + // listener listening for 'key pressed' to navigate. + this.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + m_PanelNotes.keyPressed(e); + } + }); + + //For the first frame + int h = (int)screenSize.getHeight(); + int w = (int)screenSize.getWidth(); + m_Height = (int)(w * 3 / 4); + if(m_Height > h) + { + m_Height = h; + m_Width = (int)(h * 4 / 3); + } + else + { + m_Width = w; + } + + GraphicsDevice gd = gs[0]; + m_frame = new JFrame(gd.getConfigurations()[0]); + m_frame.setLayout(new BorderLayout()); + m_frame.getContentPane().add(m_Panel, BorderLayout.NORTH); + m_frame.getContentPane().add(m_PanelNotes); + m_frame.setMinimumSize(new Dimension(m_Width, m_Height)); + m_frame.setMaximumSize(new Dimension(m_Width, m_Height)); + m_frame.setPreferredSize(new Dimension(m_Width, m_Height)); + m_frame.setUndecorated(true); + m_frame.setFocusable(true); + m_frame.setAlwaysOnTop(true); + m_frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + m_frame.setVisible(true); + m_win = new JWindow(m_frame); + gd.setFullScreenWindow(m_win); + + // The second Screen + GraphicsDevice gd1 = gs[1]; + GraphicsConfiguration gc1 = gd1.getDefaultConfiguration(); + Rectangle bounds1 = gc1.getBounds(); + int h2 = (int)bounds1.getHeight(); + int w2 = (int)bounds1.getWidth(); + + m_Height2 = (int)(w2 * 3 / 4); + if(m_Height2 > h2) + { + m_Height2 = h2; + m_Width2 = (int)(h2 * 4 / 3); + } + else + { + m_Width2 = w2; + } + + m_Panel1 =new OSMSlideViewerPanel(this, doc, m_Width2, m_Height2,false); + m_Panel1.setFlagAudioComments(audioComments); + m_Panel1.setMinimumSize(new Dimension(m_Width2, m_Height2)); + m_Panel1.setMaximumSize(new Dimension(m_Width2, m_Height2)); + m_Panel1.setPreferredSize(new Dimension(m_Width2, m_Height2)); + + + // Construction of the GUI : the same as the first + + // listener listening for 'key pressed' to navigate. + this.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + m_Panel1.keyPressed(e); + } + }); + + // For the second frame + ; + m_frame1 = new JFrame(gd1.getConfigurations()[0]); + FlowLayout bl=new FlowLayout(FlowLayout.CENTER); + m_frame1.setLayout(bl); + m_frame1.getContentPane().add(m_Panel1); + m_frame1.getContentPane().setBackground(Color.BLACK); + m_frame1.getContentPane().setForeground(Color.BLACK); + m_frame1.setMinimumSize(new Dimension(w2,h2)); + m_frame1.setMaximumSize(new Dimension(w2,h2)); + m_frame1.setPreferredSize(new Dimension(w2,h2)); + m_frame1.setUndecorated(true); + m_frame1.setFocusable(true); + m_frame1.setAlwaysOnTop(true); + m_frame1.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + m_frame1.setVisible(true); + m_win1 = new JWindow(m_frame1); + gd1.setFullScreenWindow(m_win1); + } + } + /** * stops the viewing of the presentation. Resets the display mode to windowed *************** *** 165,180 **** */ protected void endViewing() { - - // Return to normal mode returnFromFullScreen(); } /** ! * main panel of the frame containing all the components to display. */ private OSMSlideViewerPanel m_Panel; /** --- 312,394 ---- */ protected void endViewing() { // Return to normal mode returnFromFullScreen(); + int numberScreen = getNumberScreen(); + if(numberScreen==2){ + m_frame.hide(); + m_frame1.hide(); + m_win.hide(); + m_win1.hide(); + } + } + + /** + * @return the main panel of the frame containing all the components to display + * in the second screen + */ + public OSMSlideViewerPanel getPanel1(){ + return m_Panel1; + } + /** + * @return the main panel of the frame containing the Notes to display in + * the first screen or the screen when there is only screen + */ + public OSMSlideViewerPanel getPanelNotes(){ + return m_PanelNotes; + } + /** + * @return the main panel of the frame containing all the components to display in + * the first screen or the screen when there is only screen + */ + public OSMSlideViewerPanel getPanel(){ + return m_Panel; } + + /** + * window which contains the frame1 when there are two screens + */ + private JWindow m_win1; + + /** + * window which contains the frame when there are two screens + */ + private JWindow m_win; + + /** + * frame which contains the panel for the first screen + */ + private JFrame m_frame; + + /** + * frame which contains the panel for the second screen + */ + private JFrame m_frame1; + /** + * main panel of the frame containing all the components to display in the first screen. + */ + private OSMSlideViewerPanel m_PanelNotes; /** ! * main panel of the frame containing all the components to display in the second screen */ + private OSMSlideViewerPanel m_Panel1; + /** + * main panel of the frame containing all the components to display in the first screen. + */ private OSMSlideViewerPanel m_Panel; + + /** + * height in pixels of the frame two. + */ + private int m_Height2; + + /** + * width in pixels of the frame two. + */ + private int m_Width2; + + /** Index: OSMSlideViewerPanel.java =================================================================== RCS file: /cvsroot/osmose-dev/osmose/src/osmose/application/slideviewer/OSMSlideViewerPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OSMSlideViewerPanel.java 3 Oct 2007 21:31:16 -0000 1.2 --- OSMSlideViewerPanel.java 17 Feb 2008 22:11:51 -0000 1.3 *************** *** 20,23 **** --- 20,24 ---- import java.awt.*; import java.awt.event.*; + import javax.swing.JPanel; import osmose.application.*; import osmose.application.common.*; *************** *** 30,33 **** --- 31,35 ---- import osmose.application.slidesummary.*; import osmose.application.sound.*; + import osmose.application.user.OSMUser; *************** *** 50,55 **** */ public void goFirst() { - - // If in zoom mode, unzoom component first. if(m_ModeZoom) --- 52,55 ---- *************** *** 58,61 **** --- 58,72 ---- this.goPage(1); } + + /** + * it displays the first slide with Notes of the presentation on the screen. + */ + public void goFirstNotes() { + // If in zoom mode, unzoom component first. + if(m_ModeZoom) + if(m_ZoomedComponent != null) + unZoomComponent(); + this.goPageNotes(1); + } *************** *** 64,69 **** */ public void goLast() { - - // If in zoom mode, unzoom component first. if(m_ModeZoom) --- 75,78 ---- *************** *** 73,76 **** --- 82,95 ---- } + /** + * it displays the last slide with Notes of the presentation on the screen. + */ + public void goLastNotes() { + // If in zoom mode, unzoom component first. + if(m_ModeZoom) + if(m_ZoomedComponent != null) + unZoomComponent(); + this.goPageNotes(this.getNumberOfPages()); + } /** *************** *** 96,99 **** --- 115,137 ---- } + /** + * display the previous slide with Notes on the screen. If the first slide is currently + * displayed this method will stop the viewer (and return in a windowed + * screen mode). + */ + public void goPreviousNotes() { + // If in zoom mode, unzoom component first. + if(m_ModeZoom) + if(m_ZoomedComponent != null) + unZoomComponent(); + + /* verifies if we are at the first slide, if so, stop the viewer else + * display the next slide on the screen. */ + + if(this.getCurrentPage() <= 1) + endOfSlides(); + else + this.goPageNotes(this.getCurrentPage() - 1); + } /** *************** *** 104,114 **** public void goNext() { - // If in zoom mode, unzoom component first. if(m_ModeZoom) if(m_ZoomedComponent != null) unZoomComponent(); - - /** * verifies if we are at the 'Fin du diaporama' page, if so, stop the viewer --- 142,149 ---- *************** *** 121,124 **** --- 156,178 ---- } + /** + * display the next slide with Notes on the screen. If the 'Fin du diaporama' page is + * currently displayed this method will stop the viewer (and return in a + * windowed screen mode). + */ + public void goNextNotes() { + // If in zoom mode, unzoom component first. + if(m_ModeZoom) + if(m_ZoomedComponent != null) + unZoomComponent(); + /** + * verifies if we are at the 'Fin du diaporama' page, if so, stop the viewer + * else display the next slide on the screen. + */ + if(this.getCurrentPage() > this.getNumberOfPages()) + endOfSlides(); + else + this.goPageNotes(this.getCurrentPage() + 1); + } /** *************** *** 132,137 **** */ public Rectangle getBestBounds(Rectangle oldBounds) { - - /** * width and height of the component, x and y position of the left upper --- 186,189 ---- *************** *** 187,195 **** public void goPage(int number, boolean bSound, boolean bVideo) { - // Clear the panel this.removeAll(); - // Stop all playing video for(int d = 0;d < m_VideoPlayer.size();d++) --- 239,245 ---- *************** *** 200,216 **** } - // Stop all playing sounds m_PlayListPlayer.stop(); - // If index ok if((getNumberOfPages() >= number) && (number > 0)) { - // First, the background this.setBackground(Color.WHITE); ! m_CurrentPage = number; ! // Get the page and associated element --- 250,263 ---- } // Stop all playing sounds m_PlayListPlayer.stop(); // If index ok if((getNumberOfPages() >= number) && (number > 0)) { // First, the background this.setBackground(Color.WHITE); ! ! m_CurrentPage = number; // Get the page and associated element *************** *** 219,231 **** OSMElement elt = page.getElement(); - // Construct the title if(elt.getTitleIsIncluded() && model.getTitle().isDisplayed()) { - // Get size and position OSMPageItemProperties properties = page.getTitleProperties(); - // Create a component to display this title OSMSlideTxtComponent component = --- 266,275 ---- *************** *** 243,264 **** component.setUnderlined(page.getModel().getTitle().getFontUnderlined()); - // registers the mouse listeners that will handle the navigation - - // (depending on the mouse click). Enable the possibility for the user - - // to click on this title to go next or previous (and not only in a - // blank area of the screen). component.addMouseListener(m_MouseListener); - // Component is ready, add to the panel this.add(component); - // Set the associated element if(page.getType() == OSMSlide.TITLE) --- 287,300 ---- *************** *** 273,285 **** } - // After title, the body... ! if(model.getBody().isDisplayed()) { ! // Get size and position OSMPageItemProperties propBody = page.getBodyProperties(); - // Create a component to display this body OSMSlideBody compoBody = new OSMSlideBody(this, --- 309,319 ---- } // After title, the body... ! // if the ! if(model.getBody().isDisplayed() & page.getStateBox()==false) { // Get size and position OSMPageItemProperties propBody = page.getBodyProperties(); // Create a component to display this body OSMSlideBody compoBody = new OSMSlideBody(this, *************** *** 288,301 **** Math.round(((float)propBody.getW()) / this.getCoeff()), Math.round(((float)propBody.getH()) / this.getCoeff()), null, true); - - // No cursor compoBody.setNoCursor(); - // set slide type compoBody.setSlideType(page.getType()); - // Set font, size and color Font f = page.getModel().getBody().getFont(); --- 322,331 ---- *************** *** 305,313 **** compoBody.setColor(page.getModel().getBody().getFontColor()); - // Set model for chips compoBody.setModel(page.getModel()); - // Set unselectionnable and unresisable compoBody.setSelectionnable(false); --- 335,341 ---- *************** *** 315,336 **** compoBody.setUnderlined(page.getModel().getBody().getFontUnderlined()); - // Set the associated parent element compoBody.setElement(elt); - // Register mouse listener to move into presentation compoBody.addClickListener(m_MouseListener); - // adds the component to the screen. this.add(compoBody); } - // Number of the page if(page.getModel().getNumber().isDisplayed()) { - // Get size and position OSMPageItemProperties properties = page.getNumberProperties(); --- 343,359 ---- *************** *** 340,348 **** int h = Math.round(((float)properties.getH()) / this.getCoeff()); - // Simple text component OSMTxtComponent compoNumber = new OSMTxtComponent(this, x, y, w, h); - // Set font Font f = page.getModel().getNumber().getFont(); --- 363,369 ---- *************** *** 351,368 **** compoNumber.setFont(nf3); - // Set color compoNumber.setColor(page.getModel().getNumber().getFontColor()); compoNumber.setUnderlined(page.getModel().getNumber().getFontUnderlined()); - // Register mouse listener to move into presentation compoNumber.addMouseListener(m_MouseListener); - // Add component to the panel this.add(compoNumber); - // Set the text of the component Vector vslide = OSMApplication.getPresentation().getPageList(); --- 372,385 ---- *************** *** 370,397 **** } - // At the end, the medias... - // constructs each slide components that will display each media of the - // slide. if(model.getMedias().isDisplayed()) { Vector pagemedias = page.getMediaList(); - // Creates a new slide component for each media. for(java.util.Enumeration e = pagemedias.elements();e.hasMoreElements();) { OSMMedia media = (OSMMedia)e.nextElement(); - // gets the properties of this pagemedia (size, position). OSMPageItemProperties properties = media.getProperties(); - // verifies that the current media has to be included to the - // presentation (user's choice). if(media.isIncluded()) { --- 387,407 ---- *************** *** 478,482 **** creator.finish(); - // Reload image. Image img = Toolkit.getDefaultToolkit().getImage(path + "/" + file); --- 488,491 ---- *************** *** 505,513 **** if(!m_AudioComments) { - // Play the media sound (in fact bSound = true when m_AudioComments = false) m_PlayListPlayer.removeAllFiles(); - // Add sound of first element if(elt.getOSMSndMedia() != null) --- 514,520 ---- *************** *** 515,519 **** m_PlayListPlayer.addFile(elt.getOSMSndMedia().getAbsoluteFileName()); - // Then, add all sounds of sons elements if not a party one. if(!OSMTreeEditorPanel.isAboveTheLine(elt.getComponent())) { --- 522,525 ---- *************** *** 548,552 **** if(m_CurrentPage == (getNumberOfPages() + 1)) - /** * we want to display the page after the 'Fin du diaporama' page, so the --- 554,557 ---- *************** *** 555,560 **** endOfSlides(); else { ! ! /** * we want to display the page directly after the last page of the --- 560,564 ---- endOfSlides(); else { ! /** * we want to display the page directly after the last page of the *************** *** 563,567 **** m_CurrentPage = getNumberOfPages() + 1; - /** * displays 'Fin du diaporama' on the screen. --- 567,570 ---- *************** *** 579,583 **** this.moveToFront(text); - /** * sets the navigation mouse listener that will permits to go back or to --- 582,585 ---- *************** *** 585,601 **** */ text.addMouseListener(m_MouseListener); } } - /** * repaints the content of the page/slide on the screen. */ ! requestFocus(); ! ! // repaint(); } /** --- 587,821 ---- */ text.addMouseListener(m_MouseListener); + } } /** * repaints the content of the page/slide on the screen. */ ! requestFocus(); ! //repaint(); } + /** + * It displays the slide with Notes specified by its number + * @param number the index of the slide + */ + public void goPageNotes(int number) { + // Clear the panel + this.removeAll(); + // If index ok + if((getNumberOfPages() >= number) && (number > 0)) { + + // First, the background + this.setBackground(Color.WHITE); + m_CurrentPage = number; + + // Get the page and associated element + OSMSlide page = (OSMSlide)m_Pages.elementAt(number - 1); + //OSMPageModel model = page.getModel(); + //OSMElement elt = page.getElement(); + + // Get size and position + OSMPageItemProperties propertiesNotes = page.getTextProperties(); + OSMSlideTxtComponent compoNotes = + new OSMSlideTxtComponent(this, + Math.round(((float)propertiesNotes.getX()) / this.getCoeff()), + Math.round(((float)propertiesNotes.getY()) / this.getCoeff()), + Math.round(((float)propertiesNotes.getW()) / this.getCoeff()), + Math.round(((float)propertiesNotes.getH()) / this.getCoeff()), null); + + // Create a component to display the Notes + Font f = page.getModel().getText().getFont(); + Font nf = f.deriveFont((float)f.getSize2D() / this.getCoeff()); + compoNotes.setFont(nf); + compoNotes.setColor(page.getModel().getText().getFontColor()); + compoNotes.setSelectionnable(false); + compoNotes.setResizable(false); + compoNotes.setUnderlined(page.getModel().getText().getFontUnderlined()); + + // registers the mouse listeners that will handle the navigation + // (depending on the mouse click). Enable the possibility for the user + // to click on this title to go next or previous (and not only in a + // blank area of the screen). + + compoNotes.addMouseListener(m_MouseListener); + + //Component is ready, add to the panel + this.add(compoNotes); + boolean aboveTheLine = false; + + // if the checkbox is selected + if(page.getStateBox()==true){ + String notesBody = ""; + OSMElement parent = page.getElement(); + aboveTheLine = OSMTreeEditorPanel.isAboveTheLine(parent.getComponent()); + + if (!aboveTheLine) + { + Vector v = new Vector(); + OSMElement.getSons(parent, v); + int firstLevel = parent.getLevel(); + OSMElement element; + String chip; + for (int k = 0; k < v.size(); k++) + { + element = (OSMElement) v.get(k); + if(element.getTitleIsIncluded()) + { + int level = element.getLevel() - firstLevel; + chip = page.getModel().getChips().getChip(level - 1); + int lTmp = level; + while (lTmp-- > 1) + notesBody+=' '; + notesBody+= chip + ' ' +element.getTitle()+ '\n'; + } + } + } + + if(page.getType() == OSMSlide.SUMMARY){ + Enumeration e=OSMApplication.TreeEditor.getDocument().elements(); + while(e.hasMoreElements()) + { + OSMElement root = (OSMElement)e.nextElement(); + if(root.isInSummary()) + { + int firstLevel = root.getLevel() + 1; + notesBody+=root.getTitle() + '\n'; + Vector v = new Vector(); + OSMElement.getSons(root, v); + for (int idx = 0; idx < v.size(); idx++) + { + OSMElement element = (OSMElement) v.get(idx); + if (element.isInSummary()) + { + int level = element.getLevel() - firstLevel + 1; + while (level-- > 0) + notesBody+=' '; + notesBody+=element.getTitle()+'\n'; + } + } + } + } + } + if(page.getType() == OSMSlide.TITLE) + { + String str = ""; + OSMPresentation presentation = OSMApplication.getPresentation(); + // Add author name + if(presentation.isThereAuthorNameIncluded()) + { + str = (String)OSMUser.USER.getProperty("labels.author",OSMApplication .Localisation.getString("OSM_LabelsAuthor")); + str += " : " + presentation.getAuthorName(); + notesBody+= str + '\n'; + } + // Add author address + if(presentation.isThereAuthorAddressIncluded()) + notesBody += presentation.getAuthorAddress() + '\n'; + // Add author organism + if(presentation.isThereAuthorOrganismIncluded()) + notesBody+= presentation.getAuthorOrganism()+ '\n'; + // Add version number + if(presentation.isThereVersionNumberIncluded()) + { + str = (String)OSMUser.USER.getProperty("labels.version",OSMApplication.Localisation.getString("OSM_LabelsVersion")); + str += " : " + presentation.getVersionNumber(); + notesBody += str + '\n'; + + } + // Add date + if(presentation.isThereVersionDateIncluded()) + notesBody+= presentation.getVersionDate()+'\n'; + // Add keywords + if(presentation.isThereKeywordsIncluded()) + { + str = (String)OSMUser.USER.getProperty("labels.keywords",OSMApplication.Localisation.getString("OSM_LabelsKeywords")); + str += " : " + presentation.getKeywords(); + notesBody += str +'\n'; + + } + // Add summary + if(presentation.isThereResumeIncluded()) + { + str = (String)OSMUser.USER.getProperty("labels.resume",OSMApplication.Localisation.getString("OSM_LabelsResume")); + str += " : " + presentation.getResume(); + notesBody+= str + '\n'; + } + // Add purpose + if(presentation.isTherePurposeIncluded()) + { + str = (String)OSMUser.USER.getProperty("labels.purpose",OSMApplication.Localisation.getString("OSM_LabelsPurpose")); + str += " : " + presentation.getPurpose(); + notesBody += str + '\n'; + } + } + // set the body + compoNotes.setText(notesBody); + } + + // if the checkbox is not selected + else { + + // Set the notes written + compoNotes.setText(page.getWrittenNotes()); + + } + + } + + else { + + + /** + * index of page/slide is not valid (don't exist). Verifies if we have to + * display the page 'Fin du diaporama' (last one) or if we have to close + * the viewer. + */ + if(m_CurrentPage == (getNumberOfPages() + 1)) + + + /** + * we want to display the page after the 'Fin du diaporama' page, so the + * viewer has to be closed. + */ + endOfSlides(); + else { + + + /** + * we want to display the page directly after the last page of the + * presentation. We have to display a slide that says 'Fin du diaporama' + */ + m_CurrentPage = getNumberOfPages() + 1; + + /** + * displays 'Fin du diaporama' on the screen. + */ + OSMTxtComponent text = new OSMTxtComponent(this, m_Width / 2 - 75, 30, 150, 40); + String thestring = ""; + text.setText(thestring); + text.setFont(new Font("Serif", Font.PLAIN, 16)); + text.setColor(Color.WHITE); + OSMBackGroundComponent m_BgCompo = new OSMBackGroundComponent(this, Color.BLACK); + m_BgCompo.addMouseListener(m_MouseListener); + this.add(m_BgCompo); + m_BgCompo.setBounds(0, 0, m_Width, m_Height); + this.add(text); + this.moveToFront(text); + + /** + * sets the navigation mouse listener that will permits to go back or to + * stop the viewer. + */ + text.addMouseListener(m_MouseListener); + } + } + /** + * repaints the content of the page/slide on the screen. + */ + requestFocus(); + } + /** *************** *** 606,609 **** --- 826,832 ---- goPage(number, true, true); } + + + public void keyReleased(KeyEvent e) { *************** *** 634,669 **** * - bottom : go last slide.<br> * @param e the KeyEvent that corresponds to the key pressed */ public void keyPressed(KeyEvent e) { ! switch(e.getKeyCode()) { ! case KeyEvent.VK_BACK_SPACE: ! goPrevious(); ! break; // back space ! case KeyEvent.VK_SPACE: ! goNext(); ! break; // space ! case KeyEvent.VK_LEFT: ! goPrevious(); ! break; // left arrow ! case KeyEvent.VK_RIGHT: ! goNext(); ! break; // right arrow ! case KeyEvent.VK_UP: ! goFirst(); ! break; // up arrow ! case KeyEvent.VK_DOWN: ! goLast(); ! break; // bottom arrow ! case KeyEvent.VK_ESCAPE: ! endOfSlides(); ! break; // escape ! } ! } public void keyTyped(KeyEvent e) { --- 857,924 ---- * - bottom : go last slide.<br> * @param e the KeyEvent that corresponds to the key pressed + * @param num the number of the screens */ public void keyPressed(KeyEvent e) { ! GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); ! switch(e.getKeyCode()) { ! case KeyEvent.VK_BACK_SPACE: ! if(screenDevices.length==1)goPrevious(); ! if(screenDevices.length==2){ ! m_Frame.getPanel().goPrevious(); ! m_Frame.getPanelNotes().goPreviousNotes(); ! m_Frame.getPanel1().goPrevious(); ! } ! break; // back space ! case KeyEvent.VK_SPACE: ! if(screenDevices.length==1)goNext(); ! if(screenDevices.length==2){ ! m_Frame.getPanel().goNext(); ! m_Frame.getPanelNotes().goNextNotes(); ! m_Frame.getPanel1().goNext(); ! } ! break; // space ! case KeyEvent.VK_LEFT: ! if(screenDevices.length==1)goPrevious(); ! if(screenDevices.length==2){ ! m_Frame.getPanel().goPrevious(); ! m_Frame.getPanelNotes().goPreviousNotes(); ! m_Frame.getPanel1().goPrevious(); ! } ! break; // left arrow ! case KeyEvent.VK_RIGHT: ! if(screenDevices.length==1)goNext(); ! if(screenDevices.length==2){ ! m_Frame.getPanel().goNext(); ! m_Frame.getPanelNotes().goNextNotes(); ! m_Frame.getPanel1().goNext(); ! } ! break; // right arrow ! case KeyEvent.VK_UP: ! if(screenDevices.length==1)goFirst(); ! if(screenDevices.length==2){ ! m_Frame.getPanel().goFirst(); ! m_Frame.getPanelNotes().goFirstNotes(); ! m_Frame.getPanel1().goFirst(); ! } ! break; // up arrow ! case KeyEvent.VK_DOWN: ! if(screenDevices.length==1)goLast(); ! if(screenDevices.length==2){ ! m_Frame.getPanel().goLast(); ! m_Frame.getPanelNotes().goLastNotes(); ! m_Frame.getPanel1().goLast(); ! } ! break; // bottom arrow ! case KeyEvent.VK_ESCAPE: ! endOfSlides(); ! break; // escape ! } ! } public void keyTyped(KeyEvent e) { *************** *** 704,709 **** * @param width the width of the frame * @param height the height of the frame */ ! public OSMSlideViewerPanel(OSMSlideViewer frame, OSMDocument doc, int width, int height) { super(null, width, height); m_Frame = frame; --- 959,965 ---- * @param width the width of the frame * @param height the height of the frame + * @param flag if the panel contains the notes or not */ ! public OSMSlideViewerPanel(OSMSlideViewer frame, OSMDocument doc, int width, int height, boolean flag) { super(null, width, height); m_Frame = frame; *************** *** 711,715 **** m_AudioComments = false; - // Get title, summary and sort pages before viewint it OSMPage p = m_Document.getPresentation().getTitlePage(); --- 967,970 ---- *************** *** 725,729 **** m_VideoViewer = null; - // listener listening for 'click to zoom / unzoom' event. m_MouseListenerZoom = new MouseAdapter() { --- 980,983 ---- *************** *** 731,735 **** if(m_ModeZoom) - /** * user has clicked on the screen and we are in the zoom mode, --- 985,988 ---- *************** *** 740,744 **** else - /* * user has clicked on a slide zoomable component and we are in the --- 993,996 ---- *************** *** 753,790 **** // listener listening for 'click on a slide content' to navigate. m_MouseListener = new MouseAdapter() { ! public void mousePressed(MouseEvent e) { ! ! ! /* ! * user has clicked on the content of a slide (not on a zoomable ! * component). We need to operates the corresponding view navigation ! * action. We need to know which mouse button has been pressed to ! * act like this : ! * - left mouse button : go next slide. ! * - right mouse button : go previous slide. ! * - center mouse button : go first slide. (not supported on Win32) ! */ ! switch(e.getButton()) { ! case MouseEvent.BUTTON1: ! goNext(); ! break; // left mouse button ! case MouseEvent.BUTTON3: ! goPrevious(); ! break; // right mouse button ! case MouseEvent.BUTTON2: ! goFirst(); ! break; // center mouse button ! } ! } ! }; this.addMouseListener(m_MouseListener); // If summary never has been created, generate it OSMSummaryCreator creator = new OSMSummaryCreator(m_Document); creator.generateSummary(m_Document.getPresentation().getSummaryDepth()); ! // listener listening for 'key pressed' to navigate. --- 1005,1057 ---- // listener listening for 'click on a slide content' to navigate. m_MouseListener = new MouseAdapter() { ! public void mousePressed(MouseEvent e) { ! /* ! * user has clicked on the content of a slide (not on a zoomable ! * component). We need to operates the corresponding view navigation ! * action. We need to know which mouse button has been pressed to ! * act like this : ! * - left mouse button : go next slide. ! * - right mouse button : go previous slide. ! * - center mouse button : go first slide. (not supported on Win32) ! */ ! GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); ! switch(e.getButton()) { ! case MouseEvent.BUTTON1: ! if(screenDevices.length==1)goNext(); ! if(screenDevices.length==2){ ! m_Frame.getPanel().goNext(); ! m_Frame.getPanelNotes().goNextNotes(); ! m_Frame.getPanel1().goNext(); ! } ! break; // left mouse button ! case MouseEvent.BUTTON3: ! if(screenDevices.length==1)goPrevious(); ! if(screenDevices.length==2){ ! m_Frame.getPanel().goPrevious(); ! m_Frame.getPanelNotes().goPreviousNotes(); ! m_Frame.getPanel1().goPrevious(); ! } ! break; // right mouse button ! case MouseEvent.BUTTON2: ! if(screenDevices.length==1)goFirst(); ! if(screenDevices.length==2){ ! m_Frame.getPanel().goFirst(); ! m_Frame.getPanelNotes().goFirstNotes(); ! m_Frame.getPanel1().goFirst(); ! } ! break; // center mouse button ! } ! } ! }; this.addMouseListener(m_MouseListener); // If summary never has been created, generate it + if(flag==false){ OSMSummaryCreator creator = new OSMSummaryCreator(m_Document); creator.generateSummary(m_Document.getPresentation().getSummaryDepth()); ! } // listener listening for 'key pressed' to navigate. *************** *** 810,814 **** protected void zoomComponent(OSMSlideComponent component) { - /** * verifies that we aren't in the zoom mode and that the specified component --- 1077,1080 ---- *************** *** 817,821 **** if((!m_ModeZoom) && (component != null)) { - /** * removes the current slide content, and add only the specified component --- 1083,1086 ---- *************** *** 880,885 **** m_ZoomedComponent = null; m_ZoomedComponentBounds = null; - - // repaint(); } --- 1145,1148 ---- |