|
From: <cro...@li...> - 2003-10-12 14:23:50
|
Module Name: CFJavaEditor
Committed By: avogl
Date: Sun Oct 12 14:23:47 UTC 2003
Modified Files:
CFJavaEditor/src/cfeditor: ArchObject.java ArchObjectStack.java
CArchPanel.java CArchPanelPan.java CMainControl.java CMainView.java
CMapArchPanel.java CMapFileDecode.java CPickmapPanel.java
ScriptArchData.java
Log Message:
CFJavaEditor Update:
The archpanel tabs used to be sorted in the same order
as read from the arch directory file, which led
to unpredictable results on unix systems.
Now the archpanel tabs are always sorted in alphabetical
order. Due to the way Java handles tabbed panes, the
order is displayed left->right, bottom->up.
Anyways, as long as the archpanel width is not resized,
the order should now always stay exactly the same.
This patch was submitted by Mark Wedel.
I extended it to affect the pickmaps panel too.
Also added support for script event options.
--AndreasV
The following files had too many changes to show the context diffs here:
cvs rdiff -r1.6 -r1.7 CFJavaEditor/src/cfeditor/CPickmapPanel.java
cvs rdiff -r1.2 -r1.3 CFJavaEditor/src/cfeditor/ScriptArchData.java
Start of context diffs
Index: CFJavaEditor/src/cfeditor/ArchObject.java
diff -c CFJavaEditor/src/cfeditor/ArchObject.java:1.8 CFJavaEditor/src/cfeditor/ArchObject.java:1.9
*** CFJavaEditor/src/cfeditor/ArchObject.java:1.8 Sun Jul 13 10:49:10 2003
--- CFJavaEditor/src/cfeditor/ArchObject.java Sun Oct 12 07:23:46 2003
***************
*** 341,354 ****
return(tmp_arch);
}
!
public void setArtifactFlag(boolean aflag) {
artifacts_flag = aflag;
}
public boolean getArtifactFlag() {
return(artifacts_flag);
}
!
public void setPrevInv(ArchObject p)
{
inv_prev = p;
--- 341,354 ----
return(tmp_arch);
}
!
public void setArtifactFlag(boolean aflag) {
artifacts_flag = aflag;
}
public boolean getArtifactFlag() {
return(artifacts_flag);
}
!
public void setPrevInv(ArchObject p)
{
inv_prev = p;
***************
*** 365,371 ****
{
return(inv_next);
}
!
public ArchObject getStartInv()
{
return(inv_start);
--- 365,371 ----
{
return(inv_next);
}
!
public ArchObject getStartInv()
{
return(inv_start);
***************
*** 982,987 ****
--- 982,992 ----
public void addEventPlugin(String eventType, String pluginName) {
if (script == null) script = new ScriptArchData();
script.addEventData(eventType, pluginName, ScriptArchData.EDATA_PLUGIN_NAME);
+ }
+
+ public void addEventOptions(String eventType, String eventOptions) {
+ if (script == null) script = new ScriptArchData();
+ script.addEventData(eventType, eventOptions, ScriptArchData.EDATA_EVENT_OPTIONS);
}
public void addEventScript(String eventType, String filePath) {
Index: CFJavaEditor/src/cfeditor/ArchObjectStack.java
diff -c CFJavaEditor/src/cfeditor/ArchObjectStack.java:1.14 CFJavaEditor/src/cfeditor/ArchObjectStack.java:1.15
*** CFJavaEditor/src/cfeditor/ArchObjectStack.java:1.14 Sun Aug 3 12:02:34 2003
--- CFJavaEditor/src/cfeditor/ArchObjectStack.java Sun Oct 12 07:23:46 2003
***************
*** 192,200 ****
if (IGUIConstants.isoView)
loadArchesFromArtifacts(m_control.getArchDefaultFolder()+File.separator+IGUIConstants.ARTIFACTS_FILE);
- m_control.enableTabPane();
CMainStatusbar.getInstance().setText(" Sorting...");
connectFaces(); // attach faces to arches
System.gc();
// load the autojoin lists
--- 192,201 ----
if (IGUIConstants.isoView)
loadArchesFromArtifacts(m_control.getArchDefaultFolder()+File.separator+IGUIConstants.ARTIFACTS_FILE);
CMainStatusbar.getInstance().setText(" Sorting...");
connectFaces(); // attach faces to arches
+ m_control.enableTabPane();
+ m_control.getMainView().finishArchPanelBuildProccess();
System.gc();
// load the autojoin lists
Index: CFJavaEditor/src/cfeditor/CArchPanel.java
diff -c CFJavaEditor/src/cfeditor/CArchPanel.java:1.7 CFJavaEditor/src/cfeditor/CArchPanel.java:1.8
*** CFJavaEditor/src/cfeditor/CArchPanel.java:1.7 Sun Jul 13 10:49:11 2003
--- CFJavaEditor/src/cfeditor/CArchPanel.java Sun Oct 12 07:23:46 2003
***************
*** 94,103 ****
public void stateChanged(ChangeEvent e) {
JTabbedPane tp = (JTabbedPane)e.getSource();
! selectedArch=-1;
panelNode node = panelNodeStart;
! for(int i=0;i<tp.getSelectedIndex();i++)
node=node.next;
m_selectedPanel=node.data;
if(m_selectedPanel != null)
m_selectedPanel.showArchList();
--- 94,107 ----
public void stateChanged(ChangeEvent e) {
JTabbedPane tp = (JTabbedPane)e.getSource();
! // This is weird: we need to compare against SelectedComponent,
! // and *not* SelectedIndex. The index seemed to get all messed up during
! // load proccess, leading to odd behaviour and sometimes wrecked panes.
! Component sel = tp.getSelectedComponent();
panelNode node = panelNodeStart;
! while (node != null && node.data.getPanel() != sel)
node=node.next;
+
m_selectedPanel=node.data;
if(m_selectedPanel != null)
m_selectedPanel.showArchList();
***************
*** 121,127 ****
if(m_selectedPanel == null)
return null;
return(m_selectedPanel.getArchListObject());
-
}
public void showArchPanelQuickObject(ArchObject arch) {
--- 125,130 ----
***************
*** 146,151 ****
--- 149,158 ----
m_selectedPanel.showArchList();
}
+ /**
+ * Add a new arch panel. This happens during load proccess.
+ * @param name
+ */
public void addPanel(String name) {
panelNode newnode = new panelNode(new CArchPanelPan(this, m_control), name);
***************
*** 155,165 ****
if(panelNodeLast != null)
panelNodeLast.next = newnode;
panelNodeLast = newnode;
! this.m_tabDesktop.add(newnode.data.getPanel(),name);
! // make it aktive
! this.m_tabDesktop.setSelectedIndex(m_tabDesktop.getTabCount()-1);
m_selectedPanel = newnode.data;
}
void appExitNotify() {
--- 162,192 ----
if(panelNodeLast != null)
panelNodeLast.next = newnode;
panelNodeLast = newnode;
!
! // insert new panels in alphabetical order
! int i;
! for (i=0; i<m_tabDesktop.getTabCount() && name.compareToIgnoreCase(m_tabDesktop.getTitleAt(i)) > 0; i++);
! this.m_tabDesktop.insertTab(name, null, newnode.data.getPanel(), null, i);
!
! // careful: during the build proccess we are setting 'm_selectedPanel'
! // in spite of the fact that this panel might *not* actually be selected
m_selectedPanel = newnode.data;
+ }
+ /**
+ * After the build proccess is completed and the panels have
+ * been fully constructed, we must correct the 'm_selectedPanel'
+ * setting and make sure the arch list is properly drawn.
+ */
+ public void finishBuildProccess() {
+ Component sel = m_tabDesktop.getSelectedComponent();
+ panelNode node = panelNodeStart;
+ while (node != null && node.data.getPanel() != sel)
+ node=node.next;
+
+ m_selectedPanel = node.data;
+ if(m_selectedPanel != null)
+ m_selectedPanel.showArchList();
}
void appExitNotify() {
***************
*** 168,180 ****
m_splitPane.getDividerLocation() );
}
-
public int getPanelArch() {
return(selectedArch);
}
void refresh() {
! archQuickPanel.refresh(); // why is this not working??? Look in CArchQuickView...
repaint();
}
--- 195,206 ----
m_splitPane.getDividerLocation() );
}
public int getPanelArch() {
return(selectedArch);
}
void refresh() {
! archQuickPanel.refresh(); // refresh quickview
repaint();
}
Index: CFJavaEditor/src/cfeditor/CArchPanelPan.java
diff -c CFJavaEditor/src/cfeditor/CArchPanelPan.java:1.5 CFJavaEditor/src/cfeditor/CArchPanelPan.java:1.6
*** CFJavaEditor/src/cfeditor/CArchPanelPan.java:1.5 Sat May 3 11:23:06 2003
--- CFJavaEditor/src/cfeditor/CArchPanelPan.java Sun Oct 12 07:23:46 2003
***************
*** 212,218 ****
for(int i=0;i<this.listcounter;i++) {
if(index >=0) {
if(index == 0) {
! // this.model.addElement(this.list.substring(offset,offset+5) + " I:"+this.list.substring(offset+5,offset+10) );
this.model.addElement(this.list.substring(offset,offset+5));
} else {
if(index == Integer.parseInt(this.list.substring(offset+5,offset+10)))
--- 212,218 ----
for(int i=0;i<this.listcounter;i++) {
if(index >=0) {
if(index == 0) {
! // this.model.addElement(this.list.substring(offset,offset+5) + " I:"+this.list.substring(offset+5,offset+10) );
this.model.addElement(this.list.substring(offset,offset+5));
} else {
if(index == Integer.parseInt(this.list.substring(offset+5,offset+10)))
***************
*** 229,236 ****
/* This is the only method defined by ListCellRenderer. We just
* reconfigure the Jlabel each time we're called.
*/
! public Component getListCellRendererComponent(
! JList list,
Object value, // value to display
int index, // cell index
boolean iss, // is the cell selected
--- 229,235 ----
/* This is the only method defined by ListCellRenderer. We just
* reconfigure the Jlabel each time we're called.
*/
! public Component getListCellRendererComponent(JList list,
Object value, // value to display
int index, // cell index
boolean iss, // is the cell selected
***************
*** 243,257 ****
*/
super.getListCellRendererComponent(list, value, index, iss, chf);
-
/* We additionally set the JLabels icon property here.
*/
!
!
! ArchObject arch = m_control.getArchObjectStack().getArch(
! Integer.parseInt(value.toString()));
if(iss) {
! m_panel.selectedArch = Integer.parseInt(value.toString()); m_control.SetStatusText(" "+value.toString()+" ");
}
m_control.setPlainFont(this);
setText(arch.getArchName());
--- 242,253 ----
*/
super.getListCellRendererComponent(list, value, index, iss, chf);
/* We additionally set the JLabels icon property here.
*/
! ArchObject arch = m_control.getArchObjectStack().getArch(Integer.parseInt(value.toString()));
if(iss) {
! m_panel.selectedArch = Integer.parseInt(value.toString());
! m_control.SetStatusText(" "+value.toString()+" ");
}
m_control.setPlainFont(this);
setText(arch.getArchName());
Index: CFJavaEditor/src/cfeditor/CMainControl.java
diff -c CFJavaEditor/src/cfeditor/CMainControl.java:1.16 CFJavaEditor/src/cfeditor/CMainControl.java:1.17
*** CFJavaEditor/src/cfeditor/CMainControl.java:1.16 Sun Jul 13 10:49:11 2003
--- CFJavaEditor/src/cfeditor/CMainControl.java Sun Oct 12 07:23:46 2003
***************
*** 1517,1531 ****
return;
}
! int tabIndex = CPickmapPanel.getInstance().getPickmapTabIndex(activePickmap);
! if (tabIndex >= 0) {
! closeLevel(activePickmap, true); // close the old map
! CPickmapPanel.getInstance().openPickmap(mfile, tabIndex); // open the new map
! CPickmapPanel.getInstance().setActivePickmap(tabIndex);
! // Update the main view so the new map instantly pops up.
! m_view.update(m_view.getGraphics());
! }
}
}
}
--- 1517,1528 ----
return;
}
! closeLevel(activePickmap, true); // close the old map
! CPickmapPanel.getInstance().openPickmap(mfile); // open the new map
! CPickmapPanel.getInstance().setActivePickmap(mfile.getName());
! // Update the main view so the new map instantly pops up.
! m_view.update(m_view.getGraphics());
}
}
}
Index: CFJavaEditor/src/cfeditor/CMainView.java
diff -c CFJavaEditor/src/cfeditor/CMainView.java:1.11 CFJavaEditor/src/cfeditor/CMainView.java:1.12
*** CFJavaEditor/src/cfeditor/CMainView.java:1.11 Sun Jul 13 10:49:11 2003
--- CFJavaEditor/src/cfeditor/CMainView.java Sun Oct 12 07:23:46 2003
***************
*** 256,261 ****
--- 256,265 ----
m_archPanel.movePickmapPanelToFront();
}
+ public void finishArchPanelBuildProccess() {
+ m_archPanel.finishBuildProccess();
+ }
+
/**
* @returns the active arch in the left-side panel.
* This can either be a default arch from the archlist, or
***************
*** 404,409 ****
--- 408,421 ----
*/
void refreshMapArchPanel() {
m_mapArchPanel.refresh();
+ }
+
+ /**
+ * refresh the arch panel (left window)
+ */
+ void refreshArchPanel() {
+ m_archPanel.invalidate();
+ m_archPanel.refresh();
}
/**
Index: CFJavaEditor/src/cfeditor/CMapArchPanel.java
diff -c CFJavaEditor/src/cfeditor/CMapArchPanel.java:1.10 CFJavaEditor/src/cfeditor/CMapArchPanel.java:1.11
*** CFJavaEditor/src/cfeditor/CMapArchPanel.java:1.10 Sat May 3 11:23:07 2003
--- CFJavaEditor/src/cfeditor/CMapArchPanel.java Sun Oct 12 07:23:46 2003
***************
*** 548,554 ****
});
grid.add(s_new);
! s_path = new JButton("File Path");
s_path.setMargin(new Insets(3, 3, 3, 3));
s_path.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
--- 548,554 ----
});
grid.add(s_new);
! s_path = new JButton("Edit Params");
s_path.setMargin(new Insets(3, 3, 3, 3));
s_path.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
|