[CF-Devel] Attached are a couple diffs I made to the java editor. I'm not 100% sure that these will apply cleanly, as in at least one case, the same file was changed - oen for the layout diff, one for the window diff, and I just broke them into the two diffs file by hand. These are mostly here for comments and possible suggestions. The layout.diff changes the layout of the window a bit. It basically extends the map drawing portion to the entire height of the window, and moves the portion that used to be below it into the right side area. This is most useful on higher res screens, where you have the vertical resolution to fit all the information in the right hand side, and you want a wider window, and don't really something at the bottom of the window below the map area chewing up space. It should be possible to make this a configuration option that the user checks in the options box. It would probably be a pain to make it update it in real time, but having it take effect next run would probably be OK. I tried to make it so that the map drawing area was at the far right, but could never get the layout to work properly. This patch also works nicely with the patch below, as you can basically resize the map pane into oblivian but still have all the important bits available. The window.diff file changes the editor so that the map windows are now managed by whatever window manager you use (eg, they are top level windows), and are not drawn in the map pane. I personally find this more convenient, as I have various hot keys I can use to close, open, and raise/lower windows. It also means that it is easier to make the windows very large, as they don't have to deal with the space taken up by the various selection/info panes in the editor (eg, you could select the arch you want to insert, and then raise the map window, obscuring the selection windows as you do your work). There are some other hacks mentioned, like sizing control. Also, the current map draw code seemed to have a harded 32 pixel offset it used for drawing. Not positive why that is there - in my effort to squeeze in every usuable pixel, I removed that - that is a large part of the diffs. CFJavaEditor diffs

Mark Wedel mwedel at sonic.net
Sat Aug 17 02:49:56 CDT 2002


  Resending this, as the mailing list seems to have eaten it up.  Of course, now 
that I do resend this, the original will probably pop out in a few hours :)


Attached are a couple diffs I made to the java editor.  I'm not 100% sure that 
these will apply cleanly, as in at least one case, the same file was changed - 
oen for the layout diff, one for the window diff, and I just broke them into the 
two diffs file by hand.

  These are mostly here for comments and possible suggestions.

  The layout.diff changes the layout of the window a bit.  It basically extends 
the map drawing portion to the entire height of the window, and moves the 
portion that used to be below it into the right side area.  This is most useful 
on higher res screens, where you have the vertical resolution to fit all the 
information in the right hand side, and you want a wider window, and don't 
really something at the bottom of the window below the map area chewing up 
space.  It should be possible to make this a configuration option that the user 
checks in the options box.  It would probably be a pain to make it update it in 
real time, but having it take effect next run would probably be OK.  I tried to 
make it so that the map drawing area was at the far right, but could never get 
the layout to work properly.  This patch also works nicely with the patch below, 
as you can basically resize the map pane into oblivian but still have all the 
important bits available.

  The window.diff file changes the editor so that the map windows are now 
managed by whatever window manager you use (eg, they are top level windows), and 
are not drawn in the map pane.  I personally find this more convenient, as I 
have various hot keys I can use to close, open, and raise/lower windows.  It 
also means that it is easier to make the windows very large, as they don't have 
to deal with the space taken up by the various selection/info panes in the 
editor (eg, you could select the arch you want to insert, and then raise the map 
window, obscuring the selection windows as you do your work).  There are some 
other hacks mentioned, like sizing control.  Also, the current map draw code 
seemed to have a harded 32 pixel offset it used for drawing.  Not positive why 
that is there - in my effort to squeeze in every usuable pixel, I removed that - 
that is a large part of the diffs.

  This patch is more problematic - since it changes the inheritence of the map 
frame from an internal frame to just a jframe, I don't see an easy way to 
control this via a config option.  The only thought I could have to do it via 
run time config option would be to put both the JFrame and JInternalFrame 
structures in the mapview structure, and initialize and control the appropriate 
one depending on the settings.  But that would be a lot of changes.  The only 
interesting point on that is that if the picks support gets put in, the picks 
map could always use the internal frame to prevent cluttering the users desktop 
(eg, you could basically use both at the same time).


-------------- next part --------------
Index: CFEditor/CMainView.java
===================================================================
RCS file: /cvsroot/crossfire/CFJavaEditor/CFEditor/CMainView.java,v
retrieving revision 1.18
diff -c -r1.18 CMainView.java
*** CFEditor/CMainView.java	3 May 2002 14:36:17 -0000	1.18
--- CFEditor/CMainView.java	14 Aug 2002 04:38:22 -0000
***************
*** 144,181 ****
          m_menu = new CMainMenu( m_control );
          setJMenuBar( m_menu );
  
          // Build the placeholder for tile palette
-         m_archPanel = new CArchPanel( m_control );
          m_mapPanel = new CMapTileList( m_control , this);
- 
-         m_mapDesktop = new JDesktopPane();
- 
-         m_splitRightPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT,
-                                           m_mapDesktop,
-                                           m_mapPanel);
- 
-         m_splitRightPane.setDividerLocation( divLocationRight );
-         m_splitRightPane.setDividerSize( BORDER_SIZE );
- 
-         getContentPane().add( m_splitRightPane, BorderLayout.CENTER);
- 
          m_mapArchPanel = new CMapArchPanel( m_control , this);
          m_splitDownPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT,
!                                          m_splitRightPane,
                                           m_mapArchPanel);
- 
          m_splitDownPane.setDividerLocation( divLocationDown );
          m_splitDownPane.setDividerSize( BORDER_SIZE );
- 
          getContentPane().add( m_splitDownPane, BorderLayout.CENTER);
! 
!         m_splitPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT,
!                                      m_archPanel,m_splitDownPane);
! 
          m_splitPane.setDividerLocation( divLocation );
          m_splitPane.setDividerSize( BORDER_SIZE );
          getContentPane().add( m_splitPane, BorderLayout.CENTER );
  
          // set bounds (location and size) of the main frame
          setBounds(x, y, width, height);
          show();
--- 144,185 ----
          m_menu = new CMainMenu( m_control );
          setJMenuBar( m_menu );
  
+ 
+         m_mapDesktop = new JDesktopPane();
+ 
+ 
          // Build the placeholder for tile palette
          m_mapPanel = new CMapTileList( m_control , this);
          m_mapArchPanel = new CMapArchPanel( m_control , this);
+ 
          m_splitDownPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT,
! 					m_mapPanel,
                                           m_mapArchPanel);
          m_splitDownPane.setDividerLocation( divLocationDown );
          m_splitDownPane.setDividerSize( BORDER_SIZE );
          getContentPane().add( m_splitDownPane, BorderLayout.CENTER);
! 
!         m_splitRightPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT,
! 				m_mapDesktop,
!                                          m_splitDownPane);
! 
!         m_splitRightPane.setDividerLocation( divLocationRight );
!         m_splitRightPane.setDividerSize( BORDER_SIZE );
!         getContentPane().add( m_splitRightPane, BorderLayout.CENTER);
! 
! 
! 
! 
!         m_archPanel = new CArchPanel( m_control );
!         m_splitPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT,
!                                      m_archPanel,m_splitRightPane);
          m_splitPane.setDividerLocation( divLocation );
          m_splitPane.setDividerSize( BORDER_SIZE );
+ 
          getContentPane().add( m_splitPane, BorderLayout.CENTER );
+ 
  
+ 
          // set bounds (location and size) of the main frame
          setBounds(x, y, width, height);
          show();
Index: CFEditor/CMapArchPanel.java
===================================================================
RCS file: /cvsroot/crossfire/CFJavaEditor/CFEditor/CMapArchPanel.java,v
retrieving revision 1.22
diff -c -r1.22 CMapArchPanel.java
*** CFEditor/CMapArchPanel.java	27 Apr 2002 17:46:12 -0000	1.22
--- CFEditor/CMapArchPanel.java	14 Aug 2002 04:38:25 -0000
***************
*** 125,131 ****
          m_panelDesktop = new JTabbedPane( JTabbedPane.TOP );
          mapArchPanel.setLayout(new BorderLayout());
          m_splitPane = new CSplitPane(
!             CSplitPane.HORIZONTAL_SPLIT,
              scrollPane3,
              scrollPane2);
  
--- 125,131 ----
          m_panelDesktop = new JTabbedPane( JTabbedPane.TOP );
          mapArchPanel.setLayout(new BorderLayout());
          m_splitPane = new CSplitPane(
!             CSplitPane.VERTICAL_SPLIT,
              scrollPane3,
              scrollPane2);
  
***************
*** 436,442 ****
          // add our elements
  
          archInvCount = new JLabel("");
!         c.gridx = 1;
          c.gridy = 0;
          c.gridwidth=1;
          gridbag.setConstraints(archInvCount, c);
--- 436,442 ----
          // add our elements
  
          archInvCount = new JLabel("");
!         c.gridx = 0;
          c.gridy = 0;
          c.gridwidth=1;
          gridbag.setConstraints(archInvCount, c);
***************
*** 445,458 ****
          archNameField.setText("");
          archNameField.setForeground(Color.blue);
          c.gridx = 0;
!         c.gridy = 0;
          c.gridwidth=1;
          gridbag.setConstraints(archNameField, c);
          archPanel.add(archNameField);
  
          archMapPos = new JLabel("");
!         c.gridx = 1;
!         c.gridy = 1;
          c.gridwidth=1;
          gridbag.setConstraints(archMapPos, c);
          archPanel.add(archMapPos);
--- 445,458 ----
          archNameField.setText("");
          archNameField.setForeground(Color.blue);
          c.gridx = 0;
!         c.gridy = 1;
          c.gridwidth=1;
          gridbag.setConstraints(archNameField, c);
          archPanel.add(archNameField);
  
          archMapPos = new JLabel("");
!         c.gridx = 0;
!         c.gridy = 2;
          c.gridwidth=1;
          gridbag.setConstraints(archMapPos, c);
          archPanel.add(archMapPos);
***************
*** 460,478 ****
          archFaceField.setText("");
          archFaceField.setForeground(Color.blue);
          c.gridx = 0;
!         c.gridy = 1;
          c.gridwidth=1;gridbag.setConstraints(archFaceField, c);
          archPanel.add(archFaceField);
  
          archTypeText.setText("");
          c.gridx = 0;
!         c.gridy = 2;
          gridbag.setConstraints(archTypeText, c);
          archPanel.add(archTypeText);
  
          archTileText.setText("");
!         c.gridx = 1;
!         c.gridy = 2;
          gridbag.setConstraints(archTileText, c);
          archPanel.add(archTileText);
  
--- 460,478 ----
          archFaceField.setText("");
          archFaceField.setForeground(Color.blue);
          c.gridx = 0;
!         c.gridy = 3;
          c.gridwidth=1;gridbag.setConstraints(archFaceField, c);
          archPanel.add(archFaceField);
  
          archTypeText.setText("");
          c.gridx = 0;
!         c.gridy = 4;
          gridbag.setConstraints(archTypeText, c);
          archPanel.add(archTypeText);
  
          archTileText.setText("");
!         c.gridx = 0;
!         c.gridy = 5;
          gridbag.setConstraints(archTileText, c);
          archPanel.add(archTileText);
  
-------------- next part --------------
Index: CFEditor/CMainControl.java
===================================================================
RCS file: /cvsroot/crossfire/CFJavaEditor/CFEditor/CMainControl.java,v
retrieving revision 1.27
diff -c -r1.27 CMainControl.java
*** CFEditor/CMainControl.java	4 May 2002 19:00:39 -0000	1.27
--- CFEditor/CMainControl.java	14 Aug 2002 04:38:21 -0000
***************
*** 646,652 ****
          try {
              map = new CMapControl(this, start, maparch);
              m_view.addLevelView( map.m_view ); // one view...
!             map.m_view.setAutoscrolls(true);
              m_levels.addElement( map );
              setCurrentLevel( map );
              refreshMenusAndToolbars();
--- 646,652 ----
          try {
              map = new CMapControl(this, start, maparch);
              m_view.addLevelView( map.m_view ); // one view...
! //            map.m_view.setAutoscrolls(true);
              m_levels.addElement( map );
              setCurrentLevel( map );
              refreshMenusAndToolbars();
***************
*** 1127,1136 ****
       */
  
      public void setCurrentLevel( CMapControl map ) {
!         m_currentMap= map;
!         refreshMenusAndToolbars();
  
          //        CMainStatusbar.getInstance().setLevelInfo( level );
      }
  
      /**
--- 1127,1138 ----
       */
  
      public void setCurrentLevel( CMapControl map ) {
! 	if (m_currentMap != map) {
! 	        m_currentMap= map;
! 	        refreshMenusAndToolbars();
  
          //        CMainStatusbar.getInstance().setLevelInfo( level );
+ 	}
      }
  
      /**
Index: CFEditor/CMainView.java
===================================================================
RCS file: /cvsroot/crossfire/CFJavaEditor/CFEditor/CMainView.java,v
retrieving revision 1.18
diff -c -r1.18 CMainView.java
*** CFEditor/CMainView.java	3 May 2002 14:36:17 -0000	1.18
--- CFEditor/CMainView.java	14 Aug 2002 04:38:22 -0000
***************
*** 358,369 ****
       */
      public void addLevelView( CMapView mapView ) {
          m_mapViews.add( mapView );
!         mapView.addInternalFrameListener( this );
!         m_mapDesktop.add( mapView );
  
          // set bounds to maximum size
!         mapView.setBounds(0, 0, m_mapPanel.getX()-BORDER_SIZE-2,
!                           m_mapArchPanel.getY()-BORDER_SIZE-4);
          //mapView.setBounds( 0, 0, 320, 240 );
          mapView.setVisible( true );
          setCurrentLevelView( mapView );
--- 362,373 ----
       */
      public void addLevelView( CMapView mapView ) {
          m_mapViews.add( mapView );
! //        mapView.addInternalFrameListener( this );
! //        m_mapDesktop.add( mapView );
  
          // set bounds to maximum size
! //        mapView.setBounds(0, 0, m_mapPanel.getX()-BORDER_SIZE-2,
! //                          m_mapArchPanel.getY()-BORDER_SIZE-4);
          //mapView.setBounds( 0, 0, 320, 240 );
          mapView.setVisible( true );
          setCurrentLevelView( mapView );
***************
*** 455,475 ****
          for (Enumeration enum = m_mapViews.elements(); enum.hasMoreElements();) {
              CMapView view = (CMapView) enum.nextElement();
  
!             if ( view.isIcon() ) {
                  if ( !fCareAboutIconification ) {
!                     try {
!                         view.setIcon( false );
                          m_control.setCurrentLevel( view.getMapControl() );
!                         view.moveToFront();
                          view.show();
                          return;
!                     } catch( java.beans.PropertyVetoException cantUniconify ) {
!                     }
                  }
              } else {
                  m_control.setCurrentLevel( view.getMapControl() );
                  view.show();
!                 view.moveToFront();
                  return;
              }
          }
--- 459,478 ----
          for (Enumeration enum = m_mapViews.elements(); enum.hasMoreElements();) {
              CMapView view = (CMapView) enum.nextElement();
  
!             if ( view.getState() == ICONIFIED ) {
                  if ( !fCareAboutIconification ) {
!                     {
!                         view.setIconImage( null );
                          m_control.setCurrentLevel( view.getMapControl() );
! //                        view.moveToFront();
                          view.show();
                          return;
!                     }
                  }
              } else {
                  m_control.setCurrentLevel( view.getMapControl() );
                  view.show();
! //                view.moveToFront();
                  return;
              }
          }
***************
*** 515,527 ****
          m_mapViews.insertElementAt( view, 0 );
  
          // Deiconify if necessary
!         if ( view.isIcon() ) {
!             try {
!                 view.setIcon( false );
                  view.show();
                  return;
!             } catch( java.beans.PropertyVetoException cantUniconify ) {
!             }
          }
          updateFocus( true );
      }
--- 518,529 ----
          m_mapViews.insertElementAt( view, 0 );
  
          // Deiconify if necessary
!         if ( view.getState() == ICONIFIED ) {
!             {
!                 view.setIconImage( null );
                  view.show();
                  return;
!             }
          }
          updateFocus( true );
      }
Index: CFEditor/CMapView.java
===================================================================
RCS file: /cvsroot/crossfire/CFJavaEditor/CFEditor/CMapView.java,v
retrieving revision 1.24
diff -c -r1.24 CMapView.java
*** CFEditor/CMapView.java	4 May 2002 19:00:39 -0000	1.24
--- CFEditor/CMapView.java	14 Aug 2002 04:38:29 -0000
***************
*** 37,43 ****
   * @author <a href="mailto:
     
     michael.toennies at nord-com.net
     
     ">Michael Toennies</a>
   * @author <a href="mailto:
     
     andi.vogl at gmx.net
     
     ">Andreas Vogl</a>
   */
! class CMapView extends JInternalFrame {
      /** The controller of this view. */
      private CMapControl m_control;
      private CMainControl main_control;
--- 37,43 ----
   * @author <a href="mailto:
     
     michael.toennies at nord-com.net
     
     ">Michael Toennies</a>
   * @author <a href="mailto:
     
     andi.vogl at gmx.net
     
     ">Andreas Vogl</a>
   */
! class CMapView extends JFrame {
      /** The controller of this view. */
      private CMapControl m_control;
      private CMainControl main_control;
***************
*** 75,81 ****
       * @param control     the controller of this view
       */
      CMapView ( CMainControl mc, CMapControl control ) {
!         super( "Map ["+control.getMapFileName()+"]", true, true, true, true );
          m_control = control;
          main_control = mc;
          showMapGrid = false;
--- 75,86 ----
       * @param control     the controller of this view
       */
      CMapView ( CMainControl mc, CMapControl control ) {
!         super( "Map ["+control.getMapFileName()+"]");
! 
!         Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
! 	int	reqwidth, reqheight;
! 
! //        super( "Map ["+control.getMapFileName()+"]", true, true, true, true );
          m_control = control;
          main_control = mc;
          showMapGrid = false;
***************
*** 128,136 ****
          gridMapMask[29] = "3333333333333333333333333333111111114444444444444444444444444444";
          gridMapMask[30] = "3333333333333333333333333333331111444444444444444444444444444444";
  
-         setDefaultCloseOperation( DO_NOTHING_ON_CLOSE );
  
!         getContentPane().setLayout( new BorderLayout() );
  
          m_renderer   = new CLevelRenderer();
          m_scrollPane = new JScrollPane( m_renderer );
--- 133,140 ----
          gridMapMask[29] = "3333333333333333333333333333111111114444444444444444444444444444";
          gridMapMask[30] = "3333333333333333333333333333331111444444444444444444444444444444";
  
  
!         getContentPane().setLayout( new BorderLayout(0,0) );
  
          m_renderer   = new CLevelRenderer();
          m_scrollPane = new JScrollPane( m_renderer );
***************
*** 142,147 ****
--- 146,194 ----
          m_renderer.addMouseListener( listener );
          m_renderer.addMouseMotionListener( listener );
          m_renderer.updateLookAndFeel();
+ 
+ 
+ 	// Not sure what to do about actual positioning of this window - as of now,
+ 	// it basically gets put at 0,0
+         if(m_control.getIsoView() ) {
+ 		reqwidth = m_mapHeight*IGUIConstants.TILE_ISO_YLEN+
+ 			m_mapWidth*IGUIConstants.TILE_ISO_YLEN+IGUIConstants.TILE_ISO_XLEN;
+ 		reqheight = (m_mapHeight*IGUIConstants.TILE_ISO_YLEN+
+ 			(m_mapWidth-m_mapHeight)*IGUIConstants.TILE_ISO_YLEN2)+1+IGUIConstants.TILE_ISO_XLEN;
+         } else {
+ 		// This fudge is sort of necessary.  If we don't have it, then it adds scrollbars.
+ 		// However, if we do have, now the scrollbars aren't necessary, and there is a band
+ 		// of grey.  Can't have everything I guess.
+ 		reqwidth = m_mapWidth*32 + 32;
+ 		reqheight = m_mapHeight*32 + 32;
+         }
+ 	// Don't want a new window bigger than the users screen.  Give a little extra space
+ 	// for window decorations.
+ 	// should probably still enforce some limit even if the user has a really big screen.
+ 	if (reqwidth > (screen.getWidth() - 40) ) reqwidth = (int)screen.getWidth() - 40 ;
+ 	if (reqheight > (screen.getHeight() - 40) ) reqheight = (int)screen.getHeight() - 40;
+ 
+ 	// Pure hack for my system - I run dual head, and want the map to still be within
+ 	// the size of one monitor, which is 1600 pixels.
+ 	if (reqwidth > 1500) reqwidth=1500;
+ 
+ 	setSize(reqwidth, reqheight);
+ 
+ 	// Another hack - position it at least so that the title bar is on the screen!
+ 	setLocation(20, 20);
+ 	
+         setDefaultCloseOperation( DO_NOTHING_ON_CLOSE );
+ 	addWindowListener( new WindowAdapter() { 
+ 		 public void windowClosing(WindowEvent event) {
+ 		    main_control.closeLevel(m_control);
+ 		 }
+ //		 public void windowActivated(WindowEvent event) {
+ //  	            CMapView view = (CMapView) event.getSource();
+ //		    main_control.getMainView().levelViewFocusGainedNotify(view);
+ //		 }
+ 	});
+ 
+ 	show();
      }
  
      /**
***************
*** 270,276 ****
                                 (m_mapHeight*IGUIConstants.TILE_ISO_YLEN+(m_mapWidth-m_mapHeight)*IGUIConstants.TILE_ISO_YLEN2)+1+IGUIConstants.TILE_ISO_XLEN );
          } else {
              forcedSize =
!                 new Dimension(m_mapWidth*32+64, m_mapHeight*32+64);
          }
          m_renderer.setPreferredSize( forcedSize );
          m_renderer.setMinimumSize( forcedSize );
--- 317,323 ----
                                 (m_mapHeight*IGUIConstants.TILE_ISO_YLEN+(m_mapWidth-m_mapHeight)*IGUIConstants.TILE_ISO_YLEN2)+1+IGUIConstants.TILE_ISO_XLEN );
          } else {
              forcedSize =
!                 new Dimension(m_mapWidth*32, m_mapHeight*32);
          }
          m_renderer.setPreferredSize( forcedSize );
          m_renderer.setMinimumSize( forcedSize );
***************
*** 545,551 ****
                      for (int x = 0; x < m_mapWidth; x++ ) {
                          if(m_mapGrid[x][y]==null) {
                              main_control.unknownTileIconX.paintIcon(
!                                                                     this, grfx, x*32+32,y*32+32);
                          } else {
                              node = m_mapGrid[x][y];
                              for(;node != null;) {
--- 592,598 ----
                      for (int x = 0; x < m_mapWidth; x++ ) {
                          if(m_mapGrid[x][y]==null) {
                              main_control.unknownTileIconX.paintIcon(
!                                                                     this, grfx, x*32,y*32);
                          } else {
                              node = m_mapGrid[x][y];
                              for(;node != null;) {
***************
*** 553,570 ****
                                      if(node.getNodeNr()== -1)
                                          {
                                              main_control.noarchTileIconX.paintIcon(
!                                                                                    this, grfx, x*32+32,y*32+32);
                                          } else if(node.getFaceFlag()== true) {
                                              main_control.nofaceTileIconX.paintIcon(
!                                                                                    this, grfx, x*32+32,y*32+32);
                                          } else {
                                              if(node.getFaceNr() == -1)
                                                  {
                                                      main_control.unknownTileIconX.paintIcon(
!                                                                                             this, grfx, x*32+32,y*32+32);
                                                  } else {
                                                      archlist.getFace(node.getFaceNr()).paintIcon(
!                                                                                                  this, grfx, x*32+32,y*32+32);
                                                  }
                                          }
                                  }
--- 600,617 ----
                                      if(node.getNodeNr()== -1)
                                          {
                                              main_control.noarchTileIconX.paintIcon(
!                                                                                    this, grfx, x*32,y*32);
                                          } else if(node.getFaceFlag()== true) {
                                              main_control.nofaceTileIconX.paintIcon(
!                                                                                    this, grfx, x*32,y*32);
                                          } else {
                                              if(node.getFaceNr() == -1)
                                                  {
                                                      main_control.unknownTileIconX.paintIcon(
!                                                                                             this, grfx, x*32,y*32);
                                                  } else {
                                                      archlist.getFace(node.getFaceNr()).paintIcon(
!                                                                                                  this, grfx, x*32,y*32);
                                                  }
                                          }
                                  }
***************
*** 577,593 ****
                  if ( showMapGrid ) {
                      for (int x = 0; x <= m_mapWidth; x++ ) {
                          grfx.drawLine(
!                                       x*32+32,
!                                       0+32,
!                                       x*32+32,
!                                       m_mapHeight*32+32);
                      }
                      for (int y = 0; y <= m_mapHeight; y++ ) {
                          grfx.drawLine(
!                                       0+32,
!                                       y*32+32,
!                                       m_mapWidth*32+32,
!                                       y*32+32);
                      }
                  }
                  if(highlight_on && mapMouseRightPos.y != -1 && mapMouseRightPos.x != -1) {
--- 624,640 ----
                  if ( showMapGrid ) {
                      for (int x = 0; x <= m_mapWidth; x++ ) {
                          grfx.drawLine(
!                                       x*32,
!                                       0,
!                                       x*32,
!                                       m_mapHeight*32);
                      }
                      for (int y = 0; y <= m_mapHeight; y++ ) {
                          grfx.drawLine(
!                                       0,
!                                       y*32,
!                                       m_mapWidth*32,
!                                       y*32);
                      }
                  }
                  if(highlight_on && mapMouseRightPos.y != -1 && mapMouseRightPos.x != -1) {
***************
*** 599,606 ****
                                    if(mapMousePos.y != -1 && mapMousePos.x != -1)
                                    {
                                    main_control.mapGridIconX.paintIcon(
!                                   this, grfx, mapMouseRightPos.x*32+32,
!                                   mapMouseRightPos.y*32+32);
                                    }
                                  */
              }
--- 646,653 ----
                                    if(mapMousePos.y != -1 && mapMousePos.x != -1)
                                    {
                                    main_control.mapGridIconX.paintIcon(
!                                   this, grfx, mapMouseRightPos.x*32,
!                                   mapMouseRightPos.y*32);
                                    }
                                  */
              }
***************
*** 636,642 ****
                  if(m_mapGrid[x][y]==null) {
                      // draw the empty-tile icon (directly to the mapview)
                      main_control.unknownTileIconX.paintIcon(
!                                                             this, grfx, x*32+32,y*32+32);
                  } else {
                      node = m_mapGrid[x][y];
  
--- 683,689 ----
                  if(m_mapGrid[x][y]==null) {
                      // draw the empty-tile icon (directly to the mapview)
                      main_control.unknownTileIconX.paintIcon(
!                                                             this, grfx, x*32,y*32);
                  } else {
                      node = m_mapGrid[x][y];
  
***************
*** 667,681 ****
                  // an ImageIcon and paint it into the mapview:
                  if (m_mapGrid[x][y] != null) {
                      tmp_icon.setImage(tmp_image);
!                     tmp_icon.paintIcon(this, getGraphics(), x*32+32, y*32+32);
                  }
  
                  // if grid is active, draw grid lines (right and bottom)
                  if ( showMapGrid ) {
                      // horizontal:
!                     grfx.drawLine(x*32+32, y*32+32, x*32+32, y*32+64);
                      // vertical:
!                     grfx.drawLine(x*32+32, y*32+32, x*32+64, y*32+32);
                  }
  
                  // if tile is highlighted, draw the highlight icon
--- 714,728 ----
                  // an ImageIcon and paint it into the mapview:
                  if (m_mapGrid[x][y] != null) {
                      tmp_icon.setImage(tmp_image);
!                     tmp_icon.paintIcon(this, getGraphics(), x*32, y*32);
                  }
  
                  // if grid is active, draw grid lines (right and bottom)
                  if ( showMapGrid ) {
                      // horizontal:
!                     grfx.drawLine(x*32, y*32, x*32, y*32+64);
                      // vertical:
!                     grfx.drawLine(x*32, y*32, x*32+64, y*32);
                  }
  
                  // if tile is highlighted, draw the highlight icon
***************
*** 703,709 ****
                  // Highlight the selected square
                  if (x >= topx && x <= botx && y >= topy && y <= boty) {
                      if (m_control.getIsoView() == false)
!                         main_control.mapSelIconX.paintIcon( this, grfx, x*32+32, y*32+32);
                      else {
                          // not used yet
                      }
--- 750,756 ----
                  // Highlight the selected square
                  if (x >= topx && x <= botx && y >= topy && y <= boty) {
                      if (m_control.getIsoView() == false)
!                         main_control.mapSelIconX.paintIcon( this, grfx, x*32, y*32);
                      else {
                          // not used yet
                      }
***************
*** 740,746 ****
                      }
                      else {
                          // Rectangular view
!                         main_control.mapSelIconX.paintIcon( this, grfx, posx*32+32, posy*32+32);
                      }
  
                      if (sign_y==0) break;
--- 787,793 ----
                      }
                      else {
                          // Rectangular view
!                         main_control.mapSelIconX.paintIcon( this, grfx, posx*32, posy*32);
                      }
  
                      if (sign_y==0) break;
***************
*** 815,826 ****
                      }
                  }
              } else {
!                 if(point.x>=32 && point.x<(m_mapWidth*32)+32 && point.y>=32 && point.y<(m_mapHeight*32)+32) {
!                     mapMousePos.x = (point.x-32)/32;
!                     mapMousePos.y = (point.y-32)/32;
  
!                     mapMousePosOff.x = (point.x-32)-mapMousePos.x*32;
!                     mapMousePosOff.y = (point.y-32)-mapMousePos.y*32;
                  }
              }
  
--- 862,873 ----
                      }
                  }
              } else {
!                 if(point.x<(m_mapWidth*32) && point.y<(m_mapHeight*32)) {
!                     mapMousePos.x = (point.x)/32;
!                     mapMousePos.y = (point.y)/32;
  
!                     mapMousePosOff.x = (point.x)-mapMousePos.x*32;
!                     mapMousePosOff.y = (point.y)-mapMousePos.y*32;
                  }
              }
  
***************
*** 848,853 ****
--- 895,906 ----
              Point[] pre_redraw = null;   // array of tile coords which need to be redrawn
              boolean need_full_repaint = false;  // true if full repaint of map needed
  
+ 	    // I do this on map click and not actual focus - setting this on focus
+ 	    // makes controlling the current map (which is the map subject to
+ 	    // saves and what not) a bit harder as your mouse may drift over
+ 	    // another map.
+    	    main_control.setCurrentLevel(m_control);
+ 
              if(mapLoc != null) {
                  if (highlight_on && !m_control.getIsoView()) {
                      // if we had a selected rect, we must remove it:
Index: CFEditor/CopyBuffer.java
===================================================================
RCS file: /cvsroot/crossfire/CFJavaEditor/CFEditor/CopyBuffer.java,v
retrieving revision 1.17
diff -c -r1.17 CopyBuffer.java
*** CFEditor/CopyBuffer.java	4 May 2002 19:00:39 -0000	1.17
--- CFEditor/CopyBuffer.java	14 Aug 2002 04:38:30 -0000
***************
*** 144,149 ****
--- 144,150 ----
                  map_data = new CMapModel(main_ctrl, buff_ctrl,
                                           null, maparch);  // new MapModel
                  buff_ctrl = new CMapControl(main_ctrl, null, maparch); // new MapControl
+ 		buff_ctrl.m_view.hide();
              }
              catch (CGridderException e) {}
          }
    
    


More information about the crossfire mailing list