Commit 2dc523c3 authored by Claes Sjofors's avatar Claes Sjofors

Java trend and fast curves implemented

parent bccecc15
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "jpwr_rt_gdh.h" #include "jpwr_rt_gdh.h"
#include "pwr.h" #include "pwr.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_cbuf.h"
#include "co_cdh.h" #include "co_cdh.h"
#include "co_dcli.h" #include "co_dcli.h"
#include "co_time.h" #include "co_time.h"
...@@ -2748,6 +2749,241 @@ JNIEXPORT jobjectArray JNICALL Java_jpwr_rt_Gdh_getObjectBodyDef ...@@ -2748,6 +2749,241 @@ JNIEXPORT jobjectArray JNICALL Java_jpwr_rt_Gdh_getObjectBodyDef
return gdhrsAttrDefArr; return gdhrsAttrDefArr;
} }
JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_getCircBuffInfo
(JNIEnv *env, jobject obj, jobject info_obj)
{
int sts;
jclass circBuffInfo_id;
static jmethodID circBuffInfo_getCircArefOix = NULL;
static jmethodID circBuffInfo_getCircArefVid = NULL;
static jmethodID circBuffInfo_getCircArefBody = NULL;
static jmethodID circBuffInfo_getCircArefOffset = NULL;
static jmethodID circBuffInfo_getCircArefSize = NULL;
static jmethodID circBuffInfo_getCircArefFlags = NULL;
static jmethodID circBuffInfo_getResolution = NULL;
static jmethodID circBuffInfo_getSamples = NULL;
static jmethodID circBuffInfo_getElementType = NULL;
static jmethodID circBuffInfo_getFirstIdx = NULL;
static jmethodID circBuffInfo_getLastIdx = NULL;
static jmethodID circBuffInfo_getOffset = NULL;
static jfieldID circBuffInfo_firstIdx_id;
static jfieldID circBuffInfo_lastIdx_id;
static jfieldID circBuffInfo_offset_id;
static jfieldID circBuffInfo_samples_id;
static jfieldID circBuffInfo_size_id;
static jfieldID circBuffInfo_bufp_id;
static jfieldID circBuffInfo_status_id;
int element_type;
int element_size;
jint jsts;
cbuf_sCircBuffInfo info;
memset( &info, 0, sizeof(info));
circBuffInfo_id = (*env)->FindClass( env, "jpwr/rt/CircBuffInfo");
if( circBuffInfo_getCircArefOix == NULL) {
circBuffInfo_getCircArefOix = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefOix", "()I");
circBuffInfo_getCircArefVid = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefVid", "()I");
circBuffInfo_getCircArefBody = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefBody", "()I");
circBuffInfo_getCircArefOffset = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefOffset", "()I");
circBuffInfo_getCircArefSize = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefSize", "()I");
circBuffInfo_getCircArefFlags = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefFlags", "()I");
circBuffInfo_getResolution = (*env)->GetMethodID( env, circBuffInfo_id, "getResolution", "()I");
circBuffInfo_getSamples = (*env)->GetMethodID( env, circBuffInfo_id, "getSamples", "()I");
circBuffInfo_getElementType = (*env)->GetMethodID( env, circBuffInfo_id, "getElementType", "()I");
circBuffInfo_getFirstIdx = (*env)->GetMethodID( env, circBuffInfo_id, "getFirstIdx", "()I");
circBuffInfo_getLastIdx = (*env)->GetMethodID( env, circBuffInfo_id, "getLastIdx", "()I");
circBuffInfo_getOffset = (*env)->GetMethodID( env, circBuffInfo_id, "getOffset", "()I");
circBuffInfo_firstIdx_id = (*env)->GetFieldID( env, circBuffInfo_id, "firstIdx", "I");
circBuffInfo_lastIdx_id = (*env)->GetFieldID( env, circBuffInfo_id, "lastIdx", "I");
circBuffInfo_offset_id = (*env)->GetFieldID( env, circBuffInfo_id, "offset", "I");
circBuffInfo_samples_id = (*env)->GetFieldID( env, circBuffInfo_id, "samples", "I");
circBuffInfo_size_id = (*env)->GetFieldID( env, circBuffInfo_id, "size", "I");
circBuffInfo_bufp_id = (*env)->GetFieldID( env, circBuffInfo_id, "bufp", "Ljava/lang/Object;");
circBuffInfo_status_id = (*env)->GetFieldID( env, circBuffInfo_id, "status", "I");
}
info.circ_aref.Objid.oix = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getCircArefOix);
info.circ_aref.Objid.vid = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getCircArefVid);
info.circ_aref.Body = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getCircArefBody);
info.circ_aref.Offset = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getCircArefOffset);
info.circ_aref.Size = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getCircArefSize);
info.circ_aref.Flags.m = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getCircArefFlags);
info.samples = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getSamples);
info.resolution = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getResolution);
info.first_idx = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getFirstIdx);
info.last_idx = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getLastIdx);
info.offset = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getOffset);
element_type = (*env)->CallIntMethod( env, info_obj, circBuffInfo_getElementType);
element_size = cdh_TypeToSize( (pwr_eType)element_type);
info.bufsize = info.samples * element_size;
info.bufp = (char *) calloc( 1, info.bufsize);
sts = cbuf_GetCircBuffInfo( &info, 1);
jsts = (jint) sts;
(*env)->SetIntField( env, info_obj, circBuffInfo_status_id, jsts);
if ( ODD(sts)) {
switch ( element_type) {
case pwr_eType_Float32: {
jfloatArray jfarray = 0;
jfarray = (*env)->NewFloatArray( env, info.bufsize/4);
(*env)->SetFloatArrayRegion( env, jfarray, 0, info.bufsize/4, info.bufp);
(*env)->SetObjectField( env, info_obj, circBuffInfo_bufp_id, (jobject)jfarray);
break;
}
case pwr_eType_UInt32:
case pwr_eType_Int32:
case pwr_eType_UInt16:
case pwr_eType_Int16:
case pwr_eType_UInt8:
case pwr_eType_Int8: {
jintArray jiarray = 0;
jiarray = (*env)->NewIntArray( env, info.bufsize/4);
(*env)->SetIntArrayRegion( env, jiarray, 0, info.bufsize/4, info.bufp);
(*env)->SetObjectField( env, info_obj, circBuffInfo_bufp_id, (jobject)jiarray);
break;
}
default: ;
}
(*env)->SetIntField( env, info_obj, circBuffInfo_firstIdx_id, info.first_idx);
(*env)->SetIntField( env, info_obj, circBuffInfo_lastIdx_id, info.last_idx);
(*env)->SetIntField( env, info_obj, circBuffInfo_offset_id, info.offset);
(*env)->SetIntField( env, info_obj, circBuffInfo_samples_id, info.samples);
(*env)->SetIntField( env, info_obj, circBuffInfo_size_id, info.size);
}
free( info.bufp);
return 1;
}
JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_updateCircBuffInfo
(JNIEnv *env, jobject obj, jobject info_array, jint info_size)
{
int sts;
jclass circBuffInfo_id;
static jmethodID circBuffInfo_getCircArefOix = NULL;
static jmethodID circBuffInfo_getCircArefVid = NULL;
static jmethodID circBuffInfo_getCircArefBody = NULL;
static jmethodID circBuffInfo_getCircArefOffset = NULL;
static jmethodID circBuffInfo_getCircArefSize = NULL;
static jmethodID circBuffInfo_getCircArefFlags = NULL;
static jmethodID circBuffInfo_getResolution = NULL;
static jmethodID circBuffInfo_getSamples = NULL;
static jmethodID circBuffInfo_getElementType = NULL;
static jmethodID circBuffInfo_getFirstIdx = NULL;
static jmethodID circBuffInfo_getLastIdx = NULL;
static jmethodID circBuffInfo_getOffset = NULL;
static jfieldID circBuffInfo_firstIdx_id;
static jfieldID circBuffInfo_lastIdx_id;
static jfieldID circBuffInfo_offset_id;
static jfieldID circBuffInfo_samples_id;
static jfieldID circBuffInfo_size_id;
static jfieldID circBuffInfo_bufp_id;
static jfieldID circBuffInfo_status_id;
int element_type;
int element_size;
jint jsts;
cbuf_sCircBuffInfo info[20];
jobject info_obj[20];
int i;
memset( &info, 0, sizeof(info));
circBuffInfo_id = (*env)->FindClass( env, "jpwr/rt/CircBuffInfo");
if( circBuffInfo_getCircArefOix == NULL) {
circBuffInfo_getCircArefOix = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefOix", "()I");
circBuffInfo_getCircArefVid = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefVid", "()I");
circBuffInfo_getCircArefBody = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefBody", "()I");
circBuffInfo_getCircArefOffset = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefOffset", "()I");
circBuffInfo_getCircArefSize = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefSize", "()I");
circBuffInfo_getCircArefFlags = (*env)->GetMethodID( env, circBuffInfo_id, "getCircArefFlags", "()I");
circBuffInfo_getResolution = (*env)->GetMethodID( env, circBuffInfo_id, "getResolution", "()I");
circBuffInfo_getSamples = (*env)->GetMethodID( env, circBuffInfo_id, "getSamples", "()I");
circBuffInfo_getElementType = (*env)->GetMethodID( env, circBuffInfo_id, "getElementType", "()I");
circBuffInfo_getFirstIdx = (*env)->GetMethodID( env, circBuffInfo_id, "getFirstIdx", "()I");
circBuffInfo_getLastIdx = (*env)->GetMethodID( env, circBuffInfo_id, "getLastIdx", "()I");
circBuffInfo_getOffset = (*env)->GetMethodID( env, circBuffInfo_id, "getOffset", "()I");
circBuffInfo_firstIdx_id = (*env)->GetFieldID( env, circBuffInfo_id, "firstIdx", "I");
circBuffInfo_lastIdx_id = (*env)->GetFieldID( env, circBuffInfo_id, "lastIdx", "I");
circBuffInfo_offset_id = (*env)->GetFieldID( env, circBuffInfo_id, "offset", "I");
circBuffInfo_samples_id = (*env)->GetFieldID( env, circBuffInfo_id, "samples", "I");
circBuffInfo_size_id = (*env)->GetFieldID( env, circBuffInfo_id, "size", "I");
circBuffInfo_bufp_id = (*env)->GetFieldID( env, circBuffInfo_id, "bufp", "Ljava/lang/Object;");
circBuffInfo_status_id = (*env)->GetFieldID( env, circBuffInfo_id, "status", "I");
}
if ( info_size > 20)
info_size = 20;
for ( i = 0; i < info_size; i++) {
info_obj[i] = (*env)->GetObjectArrayElement( env, info_array, i);
info[i].circ_aref.Objid.oix = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getCircArefOix);
info[i].circ_aref.Objid.vid = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getCircArefVid);
info[i].circ_aref.Body = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getCircArefBody);
info[i].circ_aref.Offset = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getCircArefOffset);
info[i].circ_aref.Size = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getCircArefSize);
info[i].circ_aref.Flags.m = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getCircArefFlags);
info[i].samples = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getSamples);
info[i].resolution = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getResolution);
info[i].first_idx = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getFirstIdx);
info[i].last_idx = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getLastIdx);
info[i].offset = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getOffset);
element_type = (*env)->CallIntMethod( env, info_obj[i], circBuffInfo_getElementType);
element_size = cdh_TypeToSize( (pwr_eType)element_type);
info[i].bufsize = info[i].samples * element_size;
info[i].bufp = (char *) calloc( 1, info[i].bufsize);
}
sts = cbuf_UpdateCircBuffInfo( info, info_size);
jsts = (jint) sts;
(*env)->SetIntField( env, info_obj[0], circBuffInfo_status_id, jsts);
if ( ODD(sts)) {
for ( i = 0; i < info_size; i++) {
switch ( element_type) {
case pwr_eType_Float32: {
jfloatArray jfarray = 0;
jfarray = (*env)->NewFloatArray( env, info[i].size);
(*env)->SetFloatArrayRegion( env, jfarray, 0, info[i].size, info[i].bufp);
(*env)->SetObjectField( env, info_obj[i], circBuffInfo_bufp_id, (jobject)jfarray);
break;
}
case pwr_eType_UInt32:
case pwr_eType_Int32:
case pwr_eType_UInt16:
case pwr_eType_Int16:
case pwr_eType_UInt8:
case pwr_eType_Int8: {
jintArray jiarray = 0;
jiarray = (*env)->NewIntArray( env, info[i].size);
(*env)->SetIntArrayRegion( env, jiarray, 0, info[i].size, info[i].bufp);
(*env)->SetObjectField( env, info_obj[i], circBuffInfo_bufp_id, (jobject)jiarray);
break;
}
default: ;
}
(*env)->SetIntField( env, info_obj[i], circBuffInfo_firstIdx_id, info[i].first_idx);
(*env)->SetIntField( env, info_obj[i], circBuffInfo_lastIdx_id, info[i].last_idx);
(*env)->SetIntField( env, info_obj[i], circBuffInfo_offset_id, info[i].offset);
(*env)->SetIntField( env, info_obj[i], circBuffInfo_samples_id, info[i].samples);
(*env)->SetIntField( env, info_obj[i], circBuffInfo_size_id, info[i].size);
free( info[i].bufp);
}
}
return 1;
}
static int gdh_JidToPointer( int id, void **p) static int gdh_JidToPointer( int id, void **p)
{ {
#if ( defined OS_POSIX) && defined HW_X86_64 #if ( defined OS_POSIX) && defined HW_X86_64
......
...@@ -370,11 +370,27 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getSuperClass ...@@ -370,11 +370,27 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getSuperClass
/* /*
* Class: jpwr_rt_Gdh * Class: jpwr_rt_Gdh
* Method: getObjectBodyDef * Method: getObjectBodyDef
* Signature: (ILjpwr/rt/PwrtAttrRef;)[Ljpwr/rt/GdhrsAttrDef; * Signature: (ILjpwr/rt/PwrtAttrRef;)Ljpwr/rt/GdhrsAttrDef;
*/ */
JNIEXPORT jobjectArray JNICALL Java_jpwr_rt_Gdh_getObjectBodyDef JNIEXPORT jobjectArray JNICALL Java_jpwr_rt_Gdh_getObjectBodyDef
(JNIEnv *, jobject, jint, jobject); (JNIEnv *, jobject, jint, jobject);
/*
* Class: jpwr_rt_Gdh
* Method: getCircBuffInfo
* Signature: (Ljpwr/rt/CircBuffInfo;)I
*/
JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_getCircBuffInfo
(JNIEnv *, jobject, jobject);
/*
* Class: jpwr_rt_Gdh
* Method: updateCircBuffInfo
* Signature: (Ljpwr/rt/CircBuffInfo[];I)I
*/
JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_updateCircBuffInfo
(JNIEnv *, jobject, jobject, jint);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import jpwr.jop.*;
import java.beans.Beans;
/** RatioLayout.java -- Layout manager for Java containers
*
* This layout manager allows you to specify ratios of x,y,width,height
* using a Proportion object.
*
* For example,
*
* setLayout(new RatioLayout());
* add( myObject, new Proportion(myObject.getBounds(), this.getSize()));
*
* @author Mats Trovik inspired by RatioLayout.java by Terence Parr
*
*/
public class RatioLayout implements LayoutManager2 {
// track the ratios for each object of form "xratio,yratio;wratio,hratio"
//Vector<Proportion> ratios = new Vector<Proportion>(1);
Vector ratios = new Vector(1);
// track the components also so we can remove associated modifier
// if necessary.
//Vector<Component> components = new Vector<Component>(1);
Vector components = new Vector(1);
public void addLayoutComponent(String r, Component comp) {
}
// The used method for adding components.
public void addLayoutComponent(Component comp, Object o){
Proportion r = (Proportion) o;
ratios.addElement(r);
components.addElement(comp);
}
//Maximum layout size depends on the target (as opposed to the normal case)
public Dimension maximumLayoutSize(Container target){
return target.getSize();
}
public float getLayoutAlignmentX(Container target){
//The layout is left aligned
return (float) 0.0;
}
public float getLayoutAlignmentY(Container target){
//the layout is top aligned
return (float) 0.0;
}
//Reset the Layout
public void invalidateLayout(Container target){
// This is called more frequently in 1.5...
// ratios = new Vector(1);
//components = new Vector(1);
}
// Remove component from Layout
public void removeLayoutComponent(Component comp) {
int i = components.indexOf(comp);
if ( i!=-1 ) {
ratios.removeElementAt(i);
components.removeElementAt(i);
}
}
public Dimension preferredLayoutSize(Container target) {
return target.getSize();
}
public Dimension minimumLayoutSize(Container target) {
return target.getSize();
}
public void layoutContainer(Container target) {
Insets insets = target.getInsets();
int ncomponents = target.getComponentCount();
Dimension d = target.getSize();
//make sure to not draw over the insets.(Java standard)
d.width -= insets.left+insets.right;
d.height -= insets.top+insets.bottom;
System.out.println( "RatioLayout: width " + d.width + " height " + d.height);
//Layout each component
for (int i = 0 ; i < ncomponents ; i++) {
Component comp = target.getComponent(i);
Proportion compProp;
try {
compProp = (Proportion)ratios.elementAt(i);
}
catch (ArrayIndexOutOfBoundsException e){
break;
}
//Set the width and height according to the ratio specified when
//the component was added.
int w = (int)(d.width*compProp.rw);
int h = (int)(d.height*compProp.rh);
// set x & y to the ratio specified when the component was added.
//These values will be changed if the comonent is a slider or
//a moving GeComponent.
int x = (int) (d.width*compProp.rx);
int y = (int) (d.height*compProp.ry);
if(comp instanceof GeComponent){
GeComponent tempComp= (GeComponent) comp;
//If the component is of type mDynType_Move...
if((tempComp.dd.dynType & GeDyn.mDynType_Move) != 0){
if (compProp.firstDraw){
// ... and it's drawn for the first time, store the
//parent's dimension in Proportion.previous,
compProp.firstDraw=false;
compProp.previous.setSize(d.width,d.height);
}
else{
/*... and it's drawn for at least the 2nd time, the
*place where to draw it is caculated from the ratio
*between the the current dimensions of the parent and
*the previous dimensions (before resize)
*of the parent multiplied with the position of the
*object. Care is taken to only adjust the position in
*the direction(s) specified by the GeDynMove.moveX(Y)Attribute.
*The current dimensions of the parent are stored
*in Proportion.previous.*/
for(int j=0;j<tempComp.dd.elements.length;j++)
{
if(tempComp.dd.elements[j] instanceof GeDynMove){
Rectangle compLoc = comp.getBounds();
if ((! ((GeDynMove)tempComp.dd.elements[j]).moveXAttribute.equals(""))){
double rx = (1.0*d.width /compProp.previous.width );
x = (int) (compLoc.x*rx);
}
if ((! ((GeDynMove)tempComp.dd.elements[j]).moveYAttribute.equals(""))){
double ry = (1.0*d.height/compProp.previous.height);
y = (int) (compLoc.y*ry);
}
}
compProp.previous.setSize(d.width,d.height);
}
}
}
//If the component is a slider...
else if((tempComp.dd.actionType & GeDyn.mActionType_Slider) != 0){
if (compProp.firstDraw){
// ... and it's drawn for the first time, store the
//parent's dimension in Proportion.previous,
compProp.firstDraw=false;
compProp.previous.setSize(d.width,d.height);
}
else{
/*... and it's drawn for at least the 2nd time,
*the direction of the slider is checked.
*The ratio between the target width or height
*(after resize) and the previous width or
*height is used to calculate the position
*fitting the new size. The current dimensions
*of the parent are stored in Proportion.previous.*/
for(int j=0;j<tempComp.dd.elements.length;j++)
{
if(tempComp.dd.elements[j] instanceof GeDynSlider){
Rectangle compLoc = comp.getBounds();
if (
((GeDynSlider)tempComp.dd.elements[j]).direction == Ge.DIRECTION_LEFT
||
((GeDynSlider)tempComp.dd.elements[j]).direction == Ge.DIRECTION_RIGHT){
double rx = (1.0*d.width /compProp.previous.width );
x = (int) (compLoc.x*rx);
}
else if (
((GeDynSlider)tempComp.dd.elements[j]).direction == Ge.DIRECTION_UP
||
((GeDynSlider)tempComp.dd.elements[j]).direction == Ge.DIRECTION_DOWN){
double ry = (1.0*d.height/compProp.previous.height);
y = (int) (compLoc.y*ry);
}
}
}
compProp.previous.setSize(d.width,d.height);
}
}
}
//Place the component.
comp.setBounds(x+insets.left,y+insets.top,w,h);
//Resize the font of JTextFields.
if (comp instanceof JTextField){
comp.setFont(comp.getFont().deriveFont((float)(1.0*h*6/10)));
}
}
}
public String toString() {
return getClass().getName();
}
}
...@@ -127,6 +127,9 @@ public class JopAxis extends JComponent { ...@@ -127,6 +127,9 @@ public class JopAxis extends JComponent {
public Font getFont() { public Font getFont() {
return font; return font;
} }
public void reconfigure() {
shapes = null;
}
public double rotate; public double rotate;
public void setRotate( double rotate) { this.rotate = rotate;} public void setRotate( double rotate) { this.rotate = rotate;}
public double getRotate() { return rotate;} public double getRotate() { return rotate;}
...@@ -313,7 +316,6 @@ public class JopAxis extends JComponent { ...@@ -313,7 +316,6 @@ public class JopAxis extends JComponent {
if ( 45.0 <= rotate && rotate < 135.0) { if ( 45.0 <= rotate && rotate < 135.0) {
g.translate( -height, 0.0); g.translate( -height, 0.0);
g.rotate( - Math.PI * rotate/180, height, 0.0); g.rotate( - Math.PI * rotate/180, height, 0.0);
g.transform( AffineTransform.getScaleInstance( height/width, width/height));
} }
else if ( 135.0 <= rotate && rotate < 225.0) else if ( 135.0 <= rotate && rotate < 225.0)
{ {
...@@ -357,6 +359,10 @@ public class JopAxis extends JComponent { ...@@ -357,6 +359,10 @@ public class JopAxis extends JComponent {
public float getMinValue() { public float getMinValue() {
return minValue; return minValue;
} }
public void setFixHeight( float fixHeight) {
size.setSize( size.getWidth(), fixHeight);
setSize(size);
}
} }
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import javax.swing.table.*;
import javax.swing.border.*;
import java.net.URL;
import jpwr.rt.*;
public class JopCurve extends JFrame
{
static final int COLUMN_COLOR = 0;
static final int COLUMN_VIEW = 1;
static final int COLUMN_UNIT = 2;
static final int COLUMN_SCALE = 3;
static final int COLUMN_ATTRIBUTE = 4;
static final int COLUMNS = 5;
JopSession session;
JopEngine engine;
Object root;
private JTable names;
private JToolBar toolbar;
private JScrollPane chartScrollPane;
private Chart chart;
private Chart navigator;
private JopCurveAxis[] yaxis = new JopCurveAxis[JopCurveData.CURVE_MAX_COLS];
private CurveAxis xaxis;
private JopCurveData gcd;
boolean fillCurve = false;
int chartWidth = 5000;
boolean[] viewChart;
private JCheckBox namesCheckBox;
String[] namesHeader = new String[] {"", "View", "Unit", "Scale", "Attribute"};
JopCurveIfc caller;
public JopCurve( JopSession session, JopCurveIfc caller, JopCurveData gcd) {
this.caller = caller;
this.gcd = gcd;
this.session = session;
engine = session.getEngine();
init();
}
public JopCurve( JopCurveIfc caller, JopCurveData gcd) {
this.caller = caller;
this.gcd = gcd;
engine = new JopEngine( 1000, (Object)this);
session = new JopSession( engine, (Object)this);
init();
}
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
if ( caller != null)
caller.close();
}
}
public void updateChart() {
chart.repaint();
navigator.repaint();
}
public void updateAxis() {
xaxis.setMinValue((float)gcd.x_min_value_axis[0]);
xaxis.setMaxValue((float)gcd.x_max_value_axis[0]);
xaxis.setMinValue((float)gcd.x_min_value_axis[0]);
xaxis.setMaxValue((float)gcd.x_max_value_axis[0]);
xaxis.setLines(gcd.x_axis_lines[0]);
xaxis.setLongQuotient(gcd.x_axis_linelongq[0]);
xaxis.setValueQuotient(gcd.x_axis_valueq[0]);
xaxis.setFormat(gcd.x_format[0]);
xaxis.reconfigure();
xaxis.repaint();
for ( int i = 0; i < gcd.cols; i++) {
yaxis[i].setMinValue((float)gcd.y_min_value_axis[i]);
yaxis[i].setMaxValue((float)gcd.y_max_value_axis[i]);
yaxis[i].setMinValue((float)gcd.y_min_value_axis[i]);
yaxis[i].setMaxValue((float)gcd.y_max_value_axis[i]);
yaxis[i].setLines(gcd.y_axis_lines[i]);
yaxis[i].setLongQuotient(gcd.y_axis_linelongq[i]);
yaxis[i].setValueQuotient(gcd.y_axis_valueq[i]);
yaxis[i].setFormat(gcd.y_format[i]);
yaxis[i].reconfigure();
yaxis[i].repaint();
}
chart.setVerticalLines(gcd.x_trend_lines[0]-2);
chart.setHorizontalLines(gcd.y_trend_lines[0]-2);
System.out.println( "Lines " + (gcd.x_trend_lines[0]-2) + " " + (gcd.y_trend_lines[0]-2));
chart.repaint();
navigator.repaint();
}
public void init() {
Dimension size = new Dimension( 1200, 900);
setPreferredSize(size);
//addWindowListener( new BasicWindowMonitor());
JPanel panel1 = new JPanel(new BorderLayout());
JPanel panel2 = new JPanel(new BorderLayout());
JPanel panel3 = new JPanel(new BorderLayout());
panel1.setMinimumSize(new Dimension(20, 20));
panel2.setMinimumSize(new Dimension(20, 20));
panel3.setMinimumSize(new Dimension(20, 20));
init_toolbar();
init_names();
init_chart();
xaxis = new CurveAxis();
xaxis.setBounds(new Rectangle(0,0,chartWidth,30));
// xaxis.setFixHeight(30);
xaxis.setBorderColor(0);
xaxis.setTextColor(0);
xaxis.setMinValue((float)gcd.x_min_value_axis[0]);
xaxis.setMaxValue((float)gcd.x_max_value_axis[0]);
xaxis.setLines(gcd.x_axis_lines[0]);
xaxis.setLongQuotient(gcd.x_axis_linelongq[0]);
xaxis.setValueQuotient(gcd.x_axis_valueq[0]);
xaxis.setLineLength(15);
xaxis.setLineWidth(1);
xaxis.setRotate(270);
xaxis.setFont(new Font("Helvetica", Font.PLAIN, 14));
xaxis.setFormat(gcd.x_format[0]);
for ( int i = 0; i < gcd.cols; i++) {
yaxis[i] = new JopCurveAxis();
yaxis[i].setBounds(new Rectangle( i*40, 0, 40, 700));
// yaxis[i].setFixHeight(30);
yaxis[i].setFillColor(gcd.axiscolor[i]);
yaxis[i].setBorderColor(0);
yaxis[i].setTextColor(0);
yaxis[i].setMinValue((float)gcd.y_min_value_axis[i]);
yaxis[i].setMaxValue((float)gcd.y_max_value_axis[i]);
yaxis[i].setLines(gcd.y_axis_lines[i]);
yaxis[i].setLongQuotient(gcd.y_axis_linelongq[i]);
yaxis[i].setValueQuotient(gcd.y_axis_valueq[i]);
yaxis[i].setLineLength(15);
yaxis[i].setLineWidth(1);
yaxis[i].setRotate(180);
yaxis[i].setFont(new Font("Helvetica", Font.PLAIN, 12));
yaxis[i].setFormat(gcd.y_format[i]);
yaxis[i].setOpaque(true);
}
init_navigator();
JScrollPane scp1 = new JScrollPane(names);
panel1.add(scp1);
// Y axes
AxisPanel panel5 = new AxisPanel();
Dimension dsize = new Dimension( gcd.cols * 40, 700);
panel5.setSize(dsize);
// panel5.addComponentListener(new AspectRatioListener(this, dsize));
panel5.setLayout( new JopCurveAxisLayout());
for ( int i = 0; i < gcd.cols; i++) {
panel5.add( yaxis[i]);
}
// Scrolled chart
ChartPanel panel4 = new ChartPanel();
panel4.setLayout( new JopCurveChartLayout());
panel4.add( chart);
panel4.add( xaxis);
chartScrollPane = new JScrollPane(panel4);
chartScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
chartScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
chartScrollPane.setBounds(new Rectangle( gcd.cols*40, 0, 1000, 700));
panel5.add( chartScrollPane);
panel2.add( panel5);
panel3.add( navigator);
JSplitPane sp1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false, panel1, panel2);
sp1.setOneTouchExpandable(true);
sp1.setDividerLocation(150);
JSplitPane sp2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false, sp1, panel3);
sp2.setOneTouchExpandable(true);
sp2.setDividerLocation(750);
this.getContentPane().add(toolbar, BorderLayout.NORTH);
this.getContentPane().add(sp2, BorderLayout.CENTER);
setTitle(JopLang.transl("Curve"));
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
pack();
setVisible(true);
if ( gcd.type == JopCurveData.eDataType_DsTrend) {
JScrollBar sb = chartScrollPane.getHorizontalScrollBar();
int value = sb.getMaximum();
System.out.println( "Scrollbar maximum " + value);
sb.setValue( value);
}
}
public void init_toolbar()
{
toolbar = new JToolBar("Curve toolbar");
MenuAction zoomInAction = new MenuAction("Zoom In", new ImageIcon( JopSpider.getImage( session, "jpwr/jop/xtt_zoom_in.png")));
MenuAction zoomOutAction = new MenuAction("Zoom Out", new ImageIcon( JopSpider.getImage( session, "jpwr/jop/xtt_zoom_out.png")));
MenuAction zoomResetAction = new MenuAction("Zoom Reset", new ImageIcon( JopSpider.getImage( session, "jpwr/jop/xtt_zoom_reset.png")));
MenuAction pageLeftAction = new MenuAction("Page Left", new ImageIcon( JopSpider.getImage( session, "jpwr/jop/ge_page_left.png")));
MenuAction scrollLeftAction = new MenuAction("Scroll Left", new ImageIcon( JopSpider.getImage( session, "jpwr/jop/ge_scroll_left.png")));
MenuAction scrollRightAction = new MenuAction("Scroll Right", new ImageIcon( JopSpider.getImage( session, "jpwr/jop/ge_scroll_right.png")));
MenuAction pageRightAction = new MenuAction("Page Right", new ImageIcon( JopSpider.getImage( session, "jpwr/jop/ge_page_right.png")));
JButton button;
button = toolbar.add(zoomInAction);
button.setActionCommand((String)zoomInAction.getValue(Action.NAME));
button.setToolTipText((String)zoomInAction.getValue(Action.NAME));
button = toolbar.add(zoomOutAction);
button.setActionCommand((String)zoomOutAction.getValue(Action.NAME));
button.setToolTipText((String)zoomOutAction.getValue(Action.NAME));
button = toolbar.add(zoomResetAction);
button.setActionCommand((String)zoomResetAction.getValue(Action.NAME));
button.setToolTipText((String)zoomResetAction.getValue(Action.NAME));
button = toolbar.add(pageLeftAction);
button.setActionCommand((String)pageLeftAction.getValue(Action.NAME));
button.setToolTipText((String)pageLeftAction.getValue(Action.NAME));
button = toolbar.add(scrollLeftAction);
button.setActionCommand((String)scrollLeftAction.getValue(Action.NAME));
button.setToolTipText((String)scrollLeftAction.getValue(Action.NAME));
button = toolbar.add(scrollRightAction);
button.setActionCommand((String)scrollRightAction.getValue(Action.NAME));
button.setToolTipText((String)scrollRightAction.getValue(Action.NAME));
button = toolbar.add(pageRightAction);
button.setActionCommand((String)pageRightAction.getValue(Action.NAME));
button.setToolTipText((String)pageRightAction.getValue(Action.NAME));
}
JButton button = new JButton();
int currentNamesScale = 0;
public void init_names() {
viewChart = new boolean[gcd.cols];
for ( int i = 0; i < gcd.cols; i++)
viewChart[i] = true;
TableModel model=new NamesTableModel(gcd.cols, COLUMNS);
names =new JTable( model );
names.getColumnModel().getColumn(COLUMN_COLOR).setCellRenderer(new NamesTableCellRenderer());
names.setColumnSelectionAllowed( false);
names.getTableHeader().setReorderingAllowed(false);
names.setRowSelectionAllowed( false);
names.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
names.getColumnModel().getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
names.getColumnModel().getColumn(COLUMN_COLOR).setPreferredWidth( 30);
names.getColumnModel().getColumn(COLUMN_VIEW).setPreferredWidth( 40);
names.getColumnModel().getColumn(COLUMN_UNIT).setPreferredWidth( 70);
names.getColumnModel().getColumn(COLUMN_SCALE).setPreferredWidth( 40);
names.getColumnModel().getColumn(COLUMN_ATTRIBUTE).setPreferredWidth( 1000);
names.setAutoResizeMode( JTable.AUTO_RESIZE_OFF);
names.setIntercellSpacing( new Dimension( 10, 2));
names.getColumnModel().getColumn(COLUMN_SCALE).setCellRenderer(new NamesButtonRenderer());
names.getColumnModel().getColumn(COLUMN_SCALE).setCellEditor(new NamesButtonEditor(new JCheckBox()));
button.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
System.out.println("Button Clicked in JTable Cell " + currentNamesScale);
maxMinDialog( currentNamesScale);
}
}
);
}
void maxMinDialog( int col) {
JTextField minField = new JTextField( String.format( "%f", gcd.y_min_value_axis[col]));
JTextField maxField = new JTextField( String.format( "%f", gcd.y_max_value_axis[col]));
JPanel maxMinPanel = new JPanel();
maxMinPanel.add(new JLabel("MinValue"));
maxMinPanel.add(minField);
maxMinPanel.add(Box.createHorizontalStrut(15)); // a spacer
maxMinPanel.add(new JLabel("MaxValue"));
maxMinPanel.add(maxField);
int result = JOptionPane.showConfirmDialog(null, maxMinPanel,
"Axis Limits", JOptionPane.OK_CANCEL_OPTION);
if (result == JOptionPane.OK_OPTION) {
float minValue = new Float( minField.getText()).floatValue();
float maxValue = new Float( maxField.getText()).floatValue();
gcd.scale( gcd.y_axis_type[col], col, gcd.y_value_type[col],
minValue, maxValue, false, false);
yaxis[col].setMinValue((float)gcd.y_min_value_axis[col]);
yaxis[col].setMaxValue((float)gcd.y_max_value_axis[col]);
yaxis[col].setMinValue((float)gcd.y_min_value_axis[col]);
yaxis[col].setMaxValue((float)gcd.y_max_value_axis[col]);
yaxis[col].setLines(gcd.y_axis_lines[col]);
yaxis[col].setLongQuotient(gcd.y_axis_linelongq[col]);
yaxis[col].setValueQuotient(gcd.y_axis_valueq[col]);
yaxis[col].reconfigure();
yaxis[col].repaint();
updateChart();
}
}
class NamesButtonRenderer extends JButton implements TableCellRenderer {
public NamesButtonRenderer() {
setOpaque(true);
}
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
setText((value == null) ? "" : value.toString());
return this;
}
}
class NamesButtonEditor extends DefaultCellEditor {
private String label;
public NamesButtonEditor(JCheckBox checkBox) {
super(checkBox);
}
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int row, int column) {
System.out.println( "Button editor row: " + row);
label = (value == null) ? "" : value.toString();
currentNamesScale = row;
button.setText(label);
return button;
}
public Object getCellEditorValue() {
return new String(label);
}
}
public class NamesTableCellRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
Component c =
super.getTableCellRendererComponent(table, value,
isSelected, hasFocus,
row, column);
if ( column == COLUMN_COLOR)
c.setBackground( GeColor.getColor( 0, gcd.color[row]));
return c;
}
}
class NamesTableModel extends AbstractTableModel {
public NamesTableModel(int rows, int cols){
super();
}
public int getColumnCount() {
return COLUMNS;
}
public int getRowCount() {
return gcd.cols;
}
public Object getValueAt(int row, int column) {
switch ( column) {
case COLUMN_COLOR:
return new String("");
case COLUMN_VIEW:
return viewChart[row];
case COLUMN_UNIT:
return gcd.y_unit[row];
case COLUMN_SCALE:
return new String("");
case COLUMN_ATTRIBUTE:
return gcd.y_name[row];
default:
return null;
}
}
public Class<?> getColumnClass(int columnIndex) {
if(columnIndex == COLUMN_VIEW) {
return Boolean.class;
}
return String.class;
}
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if(columnIndex == COLUMN_VIEW){
boolean view = (Boolean)aValue;
viewChart[rowIndex] = view;
chart.repaint();
navigator.repaint();
}
super.setValueAt(aValue, rowIndex, columnIndex);
}
public String getColumnName(int column) {
return namesHeader[column];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
if( columnIndex == COLUMN_VIEW){
return true;
}
else if( columnIndex == COLUMN_SCALE){
return true;
}
return super.isCellEditable(rowIndex, columnIndex);
}
}
public void init_chart() {
chart = new Chart();
chart.setVerticalLines(gcd.x_trend_lines[0]-2);
chart.setHorizontalLines(gcd.y_trend_lines[0]-2);
chart.setFixWidth(chartWidth);
}
public void init_navigator() {
navigator = new Chart();
navigator.setVerticalLines(gcd.x_trend_lines[0]-2);
navigator.setHorizontalLines(gcd.y_trend_lines[0]-2);
}
public void setFillCurve( boolean fillCurve) {
this.fillCurve = fillCurve;
}
private class NamesViewAction extends AbstractAction {
public NamesViewAction( String text, Icon icon) {
super( text, icon);
}
public void actionPerformed( ActionEvent e) {
int idx = Integer.parseInt( e.getActionCommand());
viewChart[idx] = !viewChart[idx];
}
}
private class MenuAction extends AbstractAction {
public MenuAction( String text, Icon icon) {
super( text, icon);
}
public void actionPerformed( ActionEvent e) {
if ( e.getActionCommand() == "Zoom In") {
chartWidth += 1000;
Dimension d = chartScrollPane.getSize();
xaxis.setBounds(new Rectangle(0,d.height - JopCurveChartLayout.AXIS_HEIGHT, chartWidth,30));
chart.setFixWidth(chartWidth);
chartScrollPane.setPreferredSize( new Dimension( chartWidth, d.height));
}
else if ( e.getActionCommand() == "Zoom Out") {
chartWidth -= 1000;
Dimension d = chartScrollPane.getSize();
xaxis.setBounds(new Rectangle(0,d.height - JopCurveChartLayout.AXIS_HEIGHT, chartWidth,30));
chart.setFixWidth(chartWidth);
chartScrollPane.setPreferredSize( new Dimension( chartWidth, d.height));
}
else if ( e.getActionCommand() == "Zoom Reset") {
chartWidth = 5000;
Dimension d = chartScrollPane.getSize();
xaxis.setBounds(new Rectangle(0,d.height - JopCurveChartLayout.AXIS_HEIGHT, chartWidth,30));
chart.setFixWidth(chartWidth);
chartScrollPane.setPreferredSize( new Dimension( chartWidth, chartScrollPane.getHeight()));
}
else if ( e.getActionCommand() == "Page Left") {
JScrollBar sb = chartScrollPane.getHorizontalScrollBar();
int value = sb.getValue();
sb.setValue( value - sb.getVisibleAmount());
}
else if ( e.getActionCommand() == "Scroll Left") {
JScrollBar sb = chartScrollPane.getHorizontalScrollBar();
int value = sb.getValue();
sb.setValue( value - 100);
}
else if ( e.getActionCommand() == "Scroll Right") {
JScrollBar sb = chartScrollPane.getHorizontalScrollBar();
int value = sb.getValue();
sb.setValue( value + 100);
}
else if ( e.getActionCommand() == "Page Right") {
JScrollBar sb = chartScrollPane.getHorizontalScrollBar();
int value = sb.getValue();
sb.setValue( value + sb.getVisibleAmount());
System.out.println( "Page Right value: " + value);
}
}
}
private class CurveAxis extends JopAxis
{
public CurveAxis() { super(); };
public Dimension getMininumSize() { return getPreferredSize();}
public Dimension getMaxinumSize() { return getPreferredSize();}
public Dimension getPreferredSize() { return new Dimension( chartWidth, 40);}
}
private class AxisPanel extends JPanel
{
int origHeight = 0;
public AxisPanel() { super(); }
public void paintComponent(Graphics g1) {
super.paintComponent(g1);
int h = getHeight();
Graphics2D g = (Graphics2D) g1;
Component c;
}
public Dimension getPreferredSize() {
float height = getParent().getHeight();
float width = getWidth();
return new Dimension( (int)width, (int)height);
}
}
private class ChartPanel extends JPanel
{
int origHeight = 0;
public ChartPanel() { super(); }
public void paintComponent(Graphics g1) {
super.paintComponent(g1);
Graphics2D g = (Graphics2D) g1;
Component c;
for ( int i = 0; i < getComponentCount(); i++) {
c = getComponent(i);
c.paint(g);
}
}
public Dimension getPreferredSize() {
float height = getParent().getHeight();
return new Dimension( chartWidth, (int)height);
}
}
private class Chart extends JComponent
{
public Chart() {}
Shape[] lineShapes;
float original_width = 0;
float original_height = 0;
float oldWidth;
float oldHeight;
float fixWidth = 0;
boolean update = true;
boolean updateLines = true;
int verticalLines = 0;
int horizontalLines = 0;
int lineColor = 35;
int fillColor = 38;
int borderColor = 9999;
public void setVerticalLines( int verticalLines) {
this.verticalLines = verticalLines;
updateLines = true;
}
public void setHorizontalLines( int horizontalLines) {
this.horizontalLines = horizontalLines;
updateLines = true;
}
public void setFixWidth( float fixWidth) {
this.fixWidth = fixWidth;
float height = getHeight();
setSize(new Dimension((int)fixWidth, (int)height));
}
public Dimension getPreferredSize() {
if ( fixWidth == 0)
return super.getPreferredSize();
float height = getHeight();
return new Dimension((int)fixWidth, (int)height);
}
public void paint(Graphics g1) {
super.paint(g1);
Graphics2D g = (Graphics2D)g1;
float width = getWidth();
float height = getHeight();
AffineTransform save = g.getTransform();
int i;
int j;
boolean updateSize = false;
GeneralPath[] path = new GeneralPath[gcd.cols];
if ( original_width == 0 && original_height == 0) {
original_width = width;
original_height = height;
}
if ( updateLines) {
lineShapes = new Shape[1 + horizontalLines + verticalLines];
updateLines = false;
}
if ( fixWidth == 0) {
if ( oldWidth != width || oldHeight != height) {
oldWidth = width;
oldHeight = height;
updateSize = true;
}
}
else {
width = fixWidth;
if ( oldHeight != height) {
oldWidth = width;
oldHeight = height;
updateSize = true;
}
}
if ( updateSize || lineShapes[0] == null) {
lineShapes[0] = new Rectangle2D.Float( 0F, 0F, width, height);
for ( i = 0; i < verticalLines; i++)
lineShapes[1+i] = new Line2D.Float( width / (verticalLines + 1) * (i+1), 0F,
width / (verticalLines + 1) * (i+1), height);
for ( i = 0; i < horizontalLines; i++)
lineShapes[1+verticalLines+i] = new Line2D.Float( 0F, height / (horizontalLines + 1) * (i+1),
width, height / (horizontalLines + 1) * (i+1));
}
//g.transform( AffineTransform.getScaleInstance( width/original_width,
// height/original_height));
g.setColor(GeColor.getColor( 0, fillColor));
g.fill( lineShapes[0]);
g.setColor(GeColor.getColor(0, lineColor));
for ( i = 0; i < verticalLines; i++)
g.draw( lineShapes[1+i]);
for ( i = 0; i < horizontalLines; i++)
g.draw( lineShapes[1+verticalLines+i]);
for ( j = 0; j < gcd.cols; j++) {
if ( !viewChart[j])
continue;
path[j] = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
path[j].reset();
if ( gcd.x_reverse) {
path[j].moveTo(width - (gcd.x_data[0][0] - gcd.x_min_value_axis[0]) * width / (gcd.x_max_value_axis[0] - gcd.x_min_value_axis[0]), height);
for ( i = 0; i < gcd.rows[j]; i++) {
path[j].lineTo( width - (gcd.x_data[0][i] - gcd.x_min_value_axis[0]) * width / (gcd.x_max_value_axis[0] - gcd.x_min_value_axis[0]),
height - (gcd.y_data[j][i] - gcd.y_min_value_axis[j]) * height / (gcd.y_max_value_axis[j] - gcd.y_min_value_axis[j]));
// System.out.println( "(" + (width - (gcd.x_data[0][i] - gcd.x_min_value_axis[0]) * width / (gcd.x_max_value_axis[0] - gcd.x_min_value_axis[0])) + "," + (height - (gcd.y_data[j][i] - gcd.y_min_value_axis[j]) * height / (gcd.y_max_value_axis[j] - gcd.y_min_value_axis[j])) + ") y:" + gcd.y_data[j][i]);
}
path[j].lineTo( width - (gcd.x_data[0][gcd.rows[j]-1] - gcd.x_min_value_axis[0]) * width / (gcd.x_max_value_axis[0] - gcd.x_min_value_axis[0]), height);
}
else {
path[j].moveTo((gcd.x_data[0][0] - gcd.x_min_value_axis[0]) * width / (gcd.x_max_value_axis[0] - gcd.x_min_value[0]), height);
for ( i = 0; i < gcd.rows[j]; i++)
path[j].lineTo( (gcd.x_data[0][i] - gcd.x_min_value_axis[0]) * width / (gcd.x_max_value_axis[0] - gcd.x_min_value[0]),
height - (gcd.y_data[j][i] - gcd.y_min_value_axis[j]) * height / (gcd.y_max_value_axis[j] - gcd.y_min_value_axis[j]));
path[j].lineTo( (gcd.x_data[0][gcd.rows[j]-1] - gcd.x_min_value_axis[0]) * width / (gcd.x_max_value_axis[0] - gcd.x_min_value[0]), height);
}
}
if ( fillCurve) {
for ( j = 0; j < gcd.cols; j++) {
if ( !viewChart[j])
continue;
g.setColor(GeColor.getColor(0, gcd.fillcolor[j]));
g.fill( path[j]);
}
}
for ( j = 0; j < gcd.cols; j++) {
if ( !viewChart[j])
continue;
g.setColor(GeColor.getColor(0, gcd.color[j]));
g.setStroke( new BasicStroke(1F));
g.draw( path[j]);
}
g.setColor(GeColor.getColor(0, borderColor));
g.draw( lineShapes[0]);
//g.setTransform(save);
}
}
public static void main(String[] args)
{
boolean debug = false;
for(int i = 0; i < args.length; i++)
{
if(args[i].equals("-d") || args[i].equals("-D"))
{
debug = true;
}
}
JopCurveData gcd = new JopCurveData();
gcd.cols = 3;
gcd.y_name[0] = new String("H1-Av1.ActualValue");
gcd.y_name[1] = new String("H2-Av1.ActualValue");
gcd.y_name[2] = new String("H3-Av1.ActualValue");
gcd.y_unit[0] = new String("m/s");
gcd.y_unit[1] = new String("%");
gcd.y_unit[2] = new String("mm");
for ( int j = 0; j < 3; j++) {
gcd.rows[j] = 100;
gcd.x_data[j] = new double[gcd.rows[j]];
gcd.y_data[j] = new double[gcd.rows[j]];
for ( int i = 0; i < gcd.rows[j]; i++) {
gcd.x_data[j][i] = i;
if ( j == 0)
gcd.y_data[j][i] = Math.sin(2F * i / 20);
else if ( j == 1)
gcd.y_data[j][i] = 5 * Math.cos(2F * i / 20);
else if ( j == 2)
gcd.y_data[j][i] = - 20 * Math.sin(2F * i / 20);
}
gcd.x_axis_type[j] = JopCurveData.eAxis_x;
gcd.y_axis_type[j] = JopCurveData.eAxis_y;
}
gcd.type = JopCurveData.eDataType_DsTrend;
gcd.x_reverse = true;
gcd.get_borders();
gcd.get_default_axis();
gcd.select_color(false);
for ( int j = 0; j < gcd.cols; j++) {
System.out.println("gcd.y_max_value " + j + " " + gcd.y_max_value_axis[j]);
System.out.println("gcd.y_min_value " + j + " " + gcd.y_min_value_axis[j]);
System.out.println("gcd.x_max_value " + j + " " + gcd.x_max_value_axis[j]);
System.out.println("gcd.x_min_value " + j + " " + gcd.x_min_value_axis[j]);
}
JopCurve frame = new JopCurve(null, gcd);
frame.setFillCurve(false);
for ( int j = 0; j < 10; j++) {
try {
Thread.sleep(2000);
}
catch ( InterruptedException e) {
}
System.out.println( "Woke upp");
gcd.add_points( 1, 2, new double[] {0.6,5.4});
frame.updateChart();
}
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.awt.font.*;
import javax.swing.*;
import java.awt.event.*;
import jpwr.rt.*;
public class JopCurveAxis extends JComponent {
Dimension size;
public JopCurveAxis()
{
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
size = new Dimension( 102, 36);
}
int fillColor = 9999;
int borderColor = 9999;
public int originalTextColor = 9999;
public int textColor = 9999;
int lineWidth = 1;
float lineLength;
int lines = 11;
int longQuotient = 1;
int valueQuotient = 1;
GeCFormat cFormat;
Font font;
public void setFillColor( int fillColor) {
this.fillColor = fillColor;
}
public int getFillColor() {
return fillColor;
}
public void setBorderColor( int borderColor) {
this.borderColor = borderColor;
}
public int getBorderColor() {
return borderColor;
}
public void setTextColor( int textColor) {
this.textColor = textColor;
this.originalTextColor = textColor;
}
public int getTextColor() {
return textColor;
}
public void setLineWidth( int lineWidth) {
this.lineWidth = lineWidth;
}
public int getLineWidth() {
return lineWidth;
}
public void setLineLength( float lineLength) {
this.lineLength = lineLength;
}
public float getLineLength() {
return lineLength;
}
public void setLines( int lines) {
this.lines = lines;
}
public int getLines() {
return lines;
}
public void setLongQuotient( int longQuotient) {
this.longQuotient = longQuotient;
}
public int getLongQuotient() {
return longQuotient;
}
public void setValueQuotient( int valueQuotient) {
this.valueQuotient = valueQuotient;
}
public int getValueQuotient() {
return valueQuotient;
}
public void setFormat( String format) {
this.cFormat = new GeCFormat(format);
}
public void setFont( Font font) {
this.font = font;
}
public Font getFont() {
return font;
}
public void reconfigure() {
shapes = null;
}
public double rotate;
public void setRotate( double rotate) { this.rotate = rotate;}
public double getRotate() { return rotate;}
Shape[] shapes = null;
Line2D.Float[] hLines;
public void paint(Graphics g1) {
super.paint(g1);
Graphics2D g = (Graphics2D) g1;
Component c;
Point p;
paintComponent(g);
for ( int i = 0; i < getComponentCount(); i++) {
AffineTransform save = g.getTransform();
c = getComponent(i);
p = c.getLocation();
g.translate((int)p.getX(), (int)p.getY());
c.paint(g);
g.setTransform(save);
}
}
float hTextPosX[];
float hTextPosY[];
String hText[];
float oldHeight;
float heightOrig = 0;
float widthOrig = 0;
public void paintComponent(Graphics g1) {
int i, j;
Graphics2D g = (Graphics2D) g1;
float width = getWidth();
float height = getHeight();
AffineTransform save = g.getTransform();
float delta;
float value;
boolean drawText = (minValue != maxValue);
if ( heightOrig == 0) {
heightOrig = height;
widthOrig = width;
}
//g.setFont( font);
g.setFont( font.deriveFont( width / widthOrig * font.getSize()));
if ( shapes == null || height != oldHeight) {
float lineLen = this.lineLength * width / widthOrig;
shapes = new Shape[1];
FontRenderContext frc = g.getFontRenderContext();
if ( lines > 0)
{
hLines = new Line2D.Float[lines];
if ( drawText) {
hText = new String[lines/valueQuotient + 1];
hTextPosY = new float[lines/valueQuotient + 1];
hTextPosX = new float[lines/valueQuotient + 1];
}
if ( 135.0 <= rotate && rotate < 225.0) {
shapes[0] = new Line2D.Float(0F, 0F, 0F, height);
delta = height / ( lines - 1);
for ( i = 0; i < lines; i++) {
if ( i % longQuotient == 0)
hLines[i] = new Line2D.Float( 0F, delta * i,
lineLen, delta * i);
else
hLines[i] = new Line2D.Float( 0F,
delta * i, 2F/3F*lineLen, delta * i);
if ( drawText && i % valueQuotient == 0) {
if ( maxValue > minValue)
value = minValue + (maxValue - minValue) / ( lines - 1) * i;
else
value = minValue - (minValue - maxValue) / ( lines - 1) * i;
hText[i/valueQuotient] =
cFormat.format( value, new StringBuffer()).toString();
Rectangle2D textBounds =
g.getFont().getStringBounds( hText[i/valueQuotient], frc);
float textHeight = (float) textBounds.getHeight();
if ( i == 0)
hTextPosY[i/valueQuotient] = height;
else if ( i == lines - 1)
hTextPosY[i/valueQuotient] = 0F + textHeight/2;
else
hTextPosY[i/valueQuotient] = height - delta * i + textHeight/4;
hTextPosX[i/valueQuotient] = lineLen;
}
}
}
}
}
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
if ( isOpaque()) {
g.setColor(GeColor.getColor(0, fillColor));
g.fill( new Rectangle2D.Float( 0F, 0F, width, height));
}
g.setStroke( new BasicStroke((float)lineWidth));
g.setColor(GeColor.getColor(0, borderColor));
g.draw( shapes[0]);
for ( i = 0; i < lines; i++)
g.draw( hLines[i]);
if ( drawText) {
for ( i = 0; i < lines; i++) {
if ( i % valueQuotient == 0) {
g.drawString( hText[i/valueQuotient], hTextPosX[i/valueQuotient],
hTextPosY[i/valueQuotient]);
}
}
}
oldHeight = height;
}
public Dimension getPreferredSize() { return size;}
public Dimension getMinimumSize() { return size;}
float minValue = 0;
float maxValue = 100;
public void setMinValue( float minValue) {
this.minValue = minValue;
}
public void setMaxValue( float maxValue) {
this.maxValue = maxValue;
}
public float getMaxValue() {
return maxValue;
}
public float getMinValue() {
return minValue;
}
public void setFixHeight( float fixHeight) {
size.setSize( size.getWidth(), fixHeight);
setSize(size);
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import jpwr.jop.*;
import java.beans.Beans;
/** JopCurveAxisLayout.java -- Layout manager for Java containers
*
* This layout manager allows you to specify ratios of x,y,width,height
* using a Proportion object.
*
* For example,
*
* setLayout(new JopCurveAxisLayout());
* add( myObject, new Proportion(myObject.getBounds(), this.getSize()));
*
* @author Mats Trovik inspired by RatioLayout.java by Terence Parr
*
*/
public class JopCurveAxisLayout implements LayoutManager2 {
// track the ratios for each object of form "xratio,yratio;wratio,hratio"
//Vector<Proportion> ratios = new Vector<Proportion>(1);
Vector ratios = new Vector(1);
// track the components also so we can remove associated modifier
// if necessary.
//Vector<Component> components = new Vector<Component>(1);
Vector components = new Vector(1);
public void addLayoutComponent(String r, Component comp) {
}
// The used method for adding components.
public void addLayoutComponent(Component comp, Object o){
Proportion r = (Proportion) o;
ratios.addElement(r);
components.addElement(comp);
}
//Maximum layout size depends on the target (as opposed to the normal case)
public Dimension maximumLayoutSize(Container target){
return target.getSize();
}
public float getLayoutAlignmentX(Container target){
//The layout is left aligned
return (float) 0.0;
}
public float getLayoutAlignmentY(Container target){
//the layout is top aligned
return (float) 0.0;
}
//Reset the Layout
public void invalidateLayout(Container target){
// This is called more frequently in 1.5...
// ratios = new Vector(1);
//components = new Vector(1);
}
// Remove component from Layout
public void removeLayoutComponent(Component comp) {
int i = components.indexOf(comp);
if ( i!=-1 ) {
ratios.removeElementAt(i);
components.removeElementAt(i);
}
}
public Dimension preferredLayoutSize(Container target) {
return target.getSize();
}
public Dimension minimumLayoutSize(Container target) {
return target.getSize();
}
int origHeight = 0;
public void layoutContainer(Container target) {
Insets insets = target.getInsets();
int ncomponents = target.getComponentCount();
Dimension d = target.getSize();
//make sure to not draw over the insets.(Java standard)
d.width -= insets.left+insets.right;
d.height -= insets.top+insets.bottom;
//System.out.println( "AxisLayout: width " + d.width + " height " + d.height + " origH " + origHeight);
if ( origHeight == 0)
origHeight = d.height;
//Layout each component
for (int i = 0 ; i < ncomponents ; i++) {
Component comp = target.getComponent(i);
Proportion compProp;
try {
compProp = (Proportion)ratios.elementAt(i);
}
catch (ArrayIndexOutOfBoundsException e){
break;
}
//Set the width and height according to the ratio specified when
//the component was added.
int w = comp.getWidth();
int h = d.height;
// set x & y to the ratio specified when the component was added.
//These values will be changed if the comonent is a slider or
//a moving GeComponent.
int x = (int) comp.getX();
int y = (int) (comp.getY() * (double)d.height / origHeight);
if ( i == ncomponents - 1)
w = d.width - x;
else
h -= 43;
//System.out.println( "Comp: w " + w + " h " + h + " x " + x + " y " + y);
//Place the component.
comp.setBounds(x+insets.left,y+insets.top,w,h);
//Resize the font of JTextFields.
if (comp instanceof JTextField){
comp.setFont(comp.getFont().deriveFont((float)(1.0*h*6/10)));
}
}
}
public String toString() {
return getClass().getName();
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import jpwr.jop.*;
import java.beans.Beans;
/** JopCurveChartLayout.java -- Layout manager for Java containers
*
* This layout manager allows you to specify ratios of x,y,width,height
* using a Proportion object.
*
* For example,
*
* setLayout(new JopCurveChartLayout());
* add( myObject, new Proportion(myObject.getBounds(), this.getSize()));
*
* @author Mats Trovik inspired by RatioLayout.java by Terence Parr
*
*/
public class JopCurveChartLayout implements LayoutManager2 {
// track the ratios for each object of form "xratio,yratio;wratio,hratio"
//Vector<Proportion> ratios = new Vector<Proportion>(1);
Vector ratios = new Vector(1);
// track the components also so we can remove associated modifier
// if necessary.
//Vector<Component> components = new Vector<Component>(1);
Vector components = new Vector(1);
public static final int AXIS_HEIGHT = 28;
public void addLayoutComponent(String r, Component comp) {
}
// The used method for adding components.
public void addLayoutComponent(Component comp, Object o){
Proportion r = (Proportion) o;
ratios.addElement(r);
components.addElement(comp);
}
//Maximum layout size depends on the target (as opposed to the normal case)
public Dimension maximumLayoutSize(Container target){
return target.getSize();
}
public float getLayoutAlignmentX(Container target){
//The layout is left aligned
return (float) 0.0;
}
public float getLayoutAlignmentY(Container target){
//the layout is top aligned
return (float) 0.0;
}
//Reset the Layout
public void invalidateLayout(Container target){
// This is called more frequently in 1.5...
// ratios = new Vector(1);
//components = new Vector(1);
}
// Remove component from Layout
public void removeLayoutComponent(Component comp) {
int i = components.indexOf(comp);
if ( i!=-1 ) {
ratios.removeElementAt(i);
components.removeElementAt(i);
}
}
public Dimension preferredLayoutSize(Container target) {
return target.getSize();
}
public Dimension minimumLayoutSize(Container target) {
return target.getSize();
}
int origHeight = 0;
public void layoutContainer(Container target) {
Insets insets = target.getInsets();
int ncomponents = target.getComponentCount();
Dimension d = target.getSize();
//make sure to not draw over the insets.(Java standard)
d.width -= insets.left+insets.right;
d.height -= insets.top+insets.bottom;
//System.out.println( "ChartLayout: width " + d.width + " height " + d.height + " origH " + origHeight);
if ( origHeight == 0)
origHeight = d.height;
//Layout each component
for (int i = 0 ; i < ncomponents ; i++) {
Component comp = target.getComponent(i);
Proportion compProp;
try {
compProp = (Proportion)ratios.elementAt(i);
}
catch (ArrayIndexOutOfBoundsException e){
break;
}
//Set the width and height according to the ratio specified when
//the component was added.
int w = comp.getWidth();
int h;
int y;
if ( i == 0) {
h = d.height - AXIS_HEIGHT;
y = 0;
}
else {
h = AXIS_HEIGHT;
y = d.height - AXIS_HEIGHT;
}
// set x & y to the ratio specified when the component was added.
//These values will be changed if the comonent is a slider or
//a moving GeComponent.
int x = (int) comp.getX();
// int y = (int) (comp.getY() * (double)d.height / origHeight);
//System.out.println( "CompChart: w " + w + " h " + h + " x " + x + " y " + y);
//Place the component.
comp.setBounds(x+insets.left,y+insets.top,w,h);
//Resize the font of JTextFields.
if (comp instanceof JTextField){
comp.setFont(comp.getFont().deriveFont((float)(1.0*h*6/10)));
}
}
}
public String toString() {
return getClass().getName();
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import java.net.URL;
import jpwr.rt.*;
public class JopCurveData
{
public static final int CURVE_MAX_COLS = 20;
public static final int eDataType_LogFile = 0;
public static final int eDataType_DsTrend = 1;
public static final int eDataType_MultiTrend = 2;
public static final int eAxis_x = 0;
public static final int eAxis_y = 1;
public static final int eTimeFormat_Float = 0;
public static final int eTimeFormat_HourMinute = 1;
public static final int eTimeFormat_DayHour = 2;
int type;
int[] rows = new int[CURVE_MAX_COLS];
int cols;
String[] y_name = new String[CURVE_MAX_COLS];
String x_name;
String[] y_unit = new String[CURVE_MAX_COLS];
String[] x_unit = new String[CURVE_MAX_COLS];
double[][] y_data = new double[CURVE_MAX_COLS][];
double[][] x_data = new double[CURVE_MAX_COLS][];
double[] y_max_value = new double[CURVE_MAX_COLS];
double[] y_min_value = new double[CURVE_MAX_COLS];
double[] x_max_value = new double[CURVE_MAX_COLS];
double[] x_min_value = new double[CURVE_MAX_COLS];
double[] y_max_value_axis = new double[CURVE_MAX_COLS];
double[] y_min_value_axis = new double[CURVE_MAX_COLS];
int[] y_trend_lines = new int[CURVE_MAX_COLS];
int[] y_axis_lines = new int[CURVE_MAX_COLS];
int[] y_axis_linelongq = new int[CURVE_MAX_COLS];
int[] y_axis_valueq = new int[CURVE_MAX_COLS];
double[] x_max_value_axis = new double[CURVE_MAX_COLS];
double[] x_min_value_axis = new double[CURVE_MAX_COLS];
int[] x_trend_lines = new int[CURVE_MAX_COLS];
int[] x_axis_lines = new int[CURVE_MAX_COLS];
int[] x_axis_linelongq = new int[CURVE_MAX_COLS];
int[] x_axis_valueq = new int[CURVE_MAX_COLS];
int[] color = new int[CURVE_MAX_COLS];
int[] fillcolor = new int[CURVE_MAX_COLS];
int[] axiscolor = new int[CURVE_MAX_COLS];
int[] y_value_type = new int[CURVE_MAX_COLS];
int[] x_value_type = new int[CURVE_MAX_COLS];
int[] y_axis_type = new int[CURVE_MAX_COLS];
int[] x_axis_type = new int[CURVE_MAX_COLS];
double[] y_axis_width = new double[CURVE_MAX_COLS];
String[] y_format = new String[CURVE_MAX_COLS];
String[] x_format = new String[CURVE_MAX_COLS];
boolean x_reverse;
int time_format;
public JopCurveData() {}
public JopCurveData( int type) {
this.type = type;
}
/*
void get_borders();
void get_default_axis();
void select_color( bool dark_bg);
*/
public void get_borders() {
for ( int i = 0; i < cols; i++) {
y_max_value[i] = 1e-37;
y_min_value[i] = 1e37;
y_value_type[i] = Pwr.eType_Boolean;
for ( int j = 0; j < rows[i]; j++) {
if ( y_data[i][j] < y_min_value[i])
y_min_value[i] = y_data[i][j];
if ( y_data[i][j] > y_max_value[i])
y_max_value[i] = y_data[i][j];
if ( y_value_type[i] == Pwr.eType_Boolean &&
!( y_data[i][j] == 1 || y_data[i][j] == 0)) {
y_value_type[i] = Pwr.eType_Float64;
// printf( "Not Boolean %s: %f\n", name[i], data[i][j]);
}
}
}
if ( type == eDataType_MultiTrend) {
System.out.println( "get_borders datatype: " + type);
for ( int i = 0; i < cols; i++) {
x_max_value[i] = 1e-37;
x_min_value[i] = 1e37;
x_value_type[i] = Pwr.eType_Float64;
for ( int j = 0; j < rows[i]; j++) {
if ( x_data[i][j] < x_min_value[i])
x_min_value[i] = x_data[i][j];
if ( x_data[i][j] > x_max_value[i])
x_max_value[i] = x_data[i][j];
}
}
}
else {
System.out.println( "get_borders datatype: " + type + " rows " + rows[0]);
for ( int i = 0; i < 1; i++) {
x_max_value[i] = 1e-37;
x_min_value[i] = 1e37;
x_value_type[i] = Pwr.eType_Float64;
for ( int j = 0; j < rows[0]; j++) {
// System.out.println( "x_data[" + i + "] " + x_data[i][j]);
if ( x_data[i][j] < x_min_value[i])
x_min_value[i] = x_data[i][j];
if ( x_data[i][j] > x_max_value[i])
x_max_value[i] = x_data[i][j];
}
}
}
}
public void get_default_axis() {
for ( int i = 0; i < cols; i++) {
scale( y_axis_type[i], i, y_value_type[i], y_min_value[i], y_max_value[i], false, false);
}
int i = 0;
double axis_width;
if ( type != eDataType_MultiTrend) {
System.out.println( "x_min_value " + x_min_value[0] + " x_max_value " + x_max_value[0]);
scale( x_axis_type[i], i, x_value_type[i], x_min_value[i], x_max_value[i], false, false);
}
else {
double min_value = 1e37;
double max_value = -1e37;
for ( i = 0; i < cols; i++) {
if ( x_min_value[i] < min_value)
min_value = x_min_value[i];
if ( x_max_value[i] > max_value)
max_value = x_max_value[i];
}
scale( x_axis_type[0], 0, x_value_type[0], min_value, max_value, false, false);
for ( i = 1; i < cols; i++) {
x_min_value_axis[i] = x_min_value_axis[0];
x_max_value_axis[i] = x_max_value_axis[0];
}
}
}
public void select_color( boolean dark_bg) {
int j;
for ( int i = 0; i < cols; i++) {
j = i % 9;
switch( j) {
case 0:
// Orange
if ( dark_bg)
color[i] = GeColor.COLOR_144;
else
color[i] = GeColor.COLOR_146;
axiscolor[i] = GeColor.COLOR_135;
if ( dark_bg)
fillcolor[i] = GeColor.COLOR_137;
else
fillcolor[i] = GeColor.COLOR_133;
break;
case 1:
// YellowGreen
if ( dark_bg)
color[i] = GeColor.COLOR_85;
else
color[i] = GeColor.COLOR_87;
axiscolor[i] = GeColor.COLOR_75;
if ( dark_bg)
fillcolor[i] = GeColor.COLOR_67;
else
fillcolor[i] = GeColor.COLOR_64;
break;
case 2:
// Yellow
if ( dark_bg)
color[i] = GeColor.COLOR_115;
else
color[i] = GeColor.COLOR_117;
axiscolor[i] = GeColor.COLOR_105;
if ( dark_bg)
fillcolor[i] = GeColor.COLOR_107;
else
fillcolor[i] = GeColor.COLOR_104;
break;
case 3:
// Blue
color[i] = GeColor.COLOR_235;
axiscolor[i] = GeColor.COLOR_225;
if ( dark_bg)
fillcolor[i] = GeColor.COLOR_227;
else
fillcolor[i] = GeColor.COLOR_214;
break;
case 4:
// Violet
color[i] = GeColor.COLOR_205;
axiscolor[i] = GeColor.COLOR_195;
if ( dark_bg)
fillcolor[i] = GeColor.COLOR_197;
else
fillcolor[i] = GeColor.COLOR_184;
break;
case 5:
// Red
color[i] = GeColor.COLOR_175;
axiscolor[i] = GeColor.COLOR_165;
if ( dark_bg)
fillcolor[i] = GeColor.COLOR_167;
else
fillcolor[i] = GeColor.COLOR_154;
break;
case 6:
// Green
color[i] = GeColor.COLOR_295;
axiscolor[i] = GeColor.COLOR_285;
if ( dark_bg)
fillcolor[i] = GeColor.COLOR_287;
else
fillcolor[i] = GeColor.COLOR_274;
break;
case 7:
// Gray
color[i] = GeColor.COLOR_35;
axiscolor[i] = GeColor.COLOR_35;
if ( dark_bg)
fillcolor[i] = GeColor.COLOR_37;
else
fillcolor[i] = GeColor.COLOR_34;
break;
case 8:
// Seablue
color[i] = GeColor.COLOR_265;
axiscolor[i] = GeColor.COLOR_255;
if ( dark_bg)
fillcolor[i] = GeColor.COLOR_257;
else
fillcolor[i] = GeColor.COLOR_254;
break;
}
}
}
public void scale( int axis_type, int idx, int value_type,
double min_value, double max_value, boolean not_zero, boolean allow_odd) {
double value;
double maxval = 0;
double minval = 0;
int i_value;
int n, max_n, min_n;
int min_lines = 0;
int max_lines = 0;
boolean min_zero, max_zero;
int format_int, format_dec;
int trendlinequot = 2;
int axlinequot = 2;
int axvaluequot = 2;
double axis_width = 0;
String format = new String();
time_format = eTimeFormat_Float;
// Scale 0 - 10 for boolean
if ( value_type == Pwr.eType_Boolean) {
maxval = 10;
minval = 0;
i_value = 10;
max_lines = i_value;
min_lines = 0;
n = 0;
}
else {
n = 0;
if ( (type == eDataType_LogFile || type == eDataType_DsTrend ||
type == eDataType_MultiTrend)
&& axis_type == eAxis_x) {
// Time axis
if ( max_value - min_value < 300) {
i_value = (int)(max_value + 1);
maxval = i_value;
max_lines = i_value;
if ( min_value == 0)
i_value = 0;
else
i_value = (int)(min_value - 1);
minval = i_value;
min_lines = i_value;
}
else if ( max_value - min_value < 1000) {
i_value = (int)(max_value/10) * 10 + 10;
maxval = i_value;
max_lines = i_value / 10;
if ( min_value == 0)
i_value = 0;
else
i_value = (int)(min_value/10) * 10 - 10;
minval = i_value;
min_lines = i_value / 10;
}
else if ( max_value - min_value < 3000) {
i_value = (int)(max_value/50) * 50 + 50;
maxval = i_value;
max_lines = i_value / 50;
if ( min_value == 0)
i_value = 0;
else
i_value = (int)(min_value/50) * 50 - 50;
minval = i_value;
min_lines = i_value / 50;
}
else if ( max_value - min_value < 10000) {
i_value = (int)(max_value/100) * 100 + 100;
maxval = i_value;
max_lines = i_value / 100;
if ( min_value == 0)
i_value = 0;
else
i_value = (int)(min_value/100) * 100 - 100;
minval = i_value;
min_lines = i_value / 100;
}
else if ( max_value - min_value < 30000) {
i_value = (int)(max_value/600) * 600 + 600;
maxval = i_value;
max_lines = i_value / 60;
if ( min_value == 0)
i_value = 0;
else
i_value = (int)(min_value/60) * 60 - 60;
minval = i_value;
min_lines = i_value / 60;
time_format = eTimeFormat_HourMinute;
trendlinequot = 2;
axlinequot = 10;
axvaluequot = 10;
}
else if ( max_value - min_value < 60000) {
i_value = (int)(max_value/600) * 600 + 600;
maxval = i_value;
max_lines = i_value / 600;
if ( min_value == 0)
i_value = 0;
else
i_value = (int)(min_value/600) * 600 - 600;
minval = i_value;
min_lines = i_value / 600;
axlinequot = 6;
axvaluequot = 2;
time_format = eTimeFormat_HourMinute;
}
else if ( max_value - min_value < 140000) {
i_value = (int)(max_value/600) * 600 + 600;
maxval = i_value;
max_lines = i_value / 600;
if ( min_value == 0)
i_value = 0;
else
i_value = (int)(min_value/600) * 600 - 600;
minval = i_value;
min_lines = i_value / 600;
axlinequot = 6;
axvaluequot = 12;
time_format = eTimeFormat_HourMinute;
}
else {
i_value = (int)(max_value/3600) * 3600 + 3600;
maxval = i_value;
max_lines = i_value / 3600;
if ( min_value == 0)
i_value = 0;
else
i_value = (int)(min_value/3600) * 3600 - 3600;
minval = i_value;
min_lines = i_value / 3600;
axlinequot = 2 * (int)((max_value - min_value)/140000);
axvaluequot = 2 * (int)((max_value - min_value)/140000);
time_format = eTimeFormat_DayHour;
}
}
else {
min_zero = false;
max_zero = false;
// Power for max_value
if ( (max_value <= 0 && !not_zero) ||
max_value == 0) {
maxval = 0;
max_lines = 0;
max_n = 0;
max_zero = true;
}
else {
value = Math.abs(max_value);
n = 0;
if ( value >= 1) {
while ( value / 10 > 1) {
value = value / 10;
n++;
}
max_n = n;
}
else {
while ( value * 10 < 10) {
value = value * 10;
n++;
}
max_n = -n;
}
}
// Power for min_value
if ( (min_value >= 0 && !not_zero) ||
min_value == 0) {
minval = 0;
min_lines = 0;
min_n = 0;
min_zero = true;
}
else {
value = Math.abs(min_value);
n = 0;
if ( value >= 1) {
while ( value / 10 > 1) {
value = value / 10;
n++;
}
min_n = n;
}
else {
while ( value * 10 < 10) {
value = value * 10;
n++;
}
min_n = -n;
}
}
if ( min_zero) {
// Use power for max_value
i_value = (int)( max_value * Math.pow(10, -max_n)) + 1;
if ( Math.abs((double)(i_value-1) - max_value * Math.pow(10, -n)) < 1e-10)
i_value--;
if ( ((i_value & 1) == 1) && (i_value != 5) && !allow_odd)
i_value += 1;
maxval = (double)(i_value) * Math.pow( 10, max_n);
max_lines = i_value;
n = max_n;
}
else if ( max_zero) {
// Use power for min_value
i_value = (int)( min_value * Math.pow(10, -min_n)) + ((min_value < 0) ? -1 : 1);
if ( Math.abs((double)(i_value+1) - min_value * Math.pow(10, -n)) < 1e-10)
i_value++;
if ( ((i_value & 1) == 1) && i_value != 5 && !allow_odd)
i_value += 1;
minval = (double)(i_value) * Math.pow( 10, min_n);
min_lines = i_value;
n = min_n;
}
else {
// Use largest power of min and max
if ( max_n > min_n)
n = max_n;
else
n = min_n;
if ( max_value > 0) {
i_value = (int)( max_value * Math.pow(10, -n)) + 1;
if ( Math.abs((double)(i_value-1) - max_value * Math.pow(10, -n)) < 1e-10)
i_value--;
}
else
i_value = (int)( max_value * Math.pow(10, -n));
if ( ((i_value & 1) == 1) && i_value != 5 && !allow_odd)
i_value += 1;
maxval = (double)(i_value) * Math.pow( 10, n);
max_lines = i_value;
if ( min_value < 0) {
i_value = (int)( min_value * Math.pow(10, -n)) - 1;
if ( Math.abs((double)(i_value+1) - min_value * Math.pow(10, -n)) < 1e-10)
i_value++;
}
else
i_value = (int)( min_value * Math.pow(10, -n));
if ( ((i_value & 1) == 1) && i_value != 5 && !allow_odd)
i_value -= 1;
minval = (double)(i_value) * Math.pow( 10, n);
min_lines = i_value;
}
}
}
System.out.println( "Time format: " + time_format);
switch ( time_format) {
case eTimeFormat_Float:
// Float format
format_int = Math.abs(n) + 1;
if ( n > 0)
format_dec = 0;
else {
format_dec = Math.abs(n);
format_int++;
}
if ( minval < 0)
format_int++;
format = new String( "%" + format_int + "." + format_dec + "f");
axis_width = 0.65 * format_int + 0.4;
System.out.println( "format " + format);
break;
case eTimeFormat_HourMinute:
// Hour and minute format
format_int = Math.abs(n) + 1;
format = new String("%2t");
axis_width = 0.65 * format_int + 0.4;
break;
case eTimeFormat_DayHour:
// Days and hour format
format_int = Math.abs(n) + 1;
format = new String("%3t");
axis_width = 0.65 * format_int + 0.4;
break;
}
if ( axis_type == eAxis_y) {
y_max_value_axis[idx] = maxval;
y_min_value_axis[idx] = minval;
y_trend_lines[idx] = Math.abs(max_lines - min_lines) + 1;
System.out.println( "trend_lines " + y_trend_lines[idx] + " " + idx);
y_axis_lines[idx] = (y_trend_lines[idx] - 1) * trendlinequot + 1;
y_axis_linelongq[idx] = axlinequot;
y_axis_valueq[idx] = axvaluequot;
y_axis_width[idx] = axis_width;
y_format[idx] = format;
}
else {
x_max_value_axis[idx] = maxval;
x_min_value_axis[idx] = minval;
x_trend_lines[idx] = Math.abs(max_lines - min_lines) + 1;
x_axis_lines[idx] = (x_trend_lines[idx] - 1) * trendlinequot + 1;
x_axis_linelongq[idx] = axlinequot;
x_axis_valueq[idx] = axvaluequot;
x_format[idx] = format;
System.out.println( "x_format " + idx + " " + x_format[idx]);
}
}
/*
public void x_to_points( double x, double *t, double *values) {
int row;
double time;
if ( cd->type != eDataType_MultiTrend) {
// Time is a date
if ( !cd->x_reverse)
time = cd->x_min_value_axis[0] + x *
(cd->x_max_value_axis[0] - cd->x_min_value_axis[0]) / 200;
else
time = cd->x_min_value_axis[0] + (200.0 - x) *
(cd->x_max_value_axis[0] - cd->x_min_value_axis[0]) / 200;
// Approximate row
row = int ((time - cd->x_min_value[0]) /
(cd->x_max_value[0] - cd->x_min_value[0]) *
(cd->rows[0] - 1) + 0.5);
if ( row > cd->rows[0] - 1)
row = cd->rows[0] - 1;
else if ( row < 0)
row = 0;
else {
// Find exact row
double b1, b2;
int r = row;
for (int i = 0;; i++) {
if ( r == 0) {
b2 = (cd->x_data[0][row] + cd->x_data[0][r+1]) / 2;
if ( time < b2)
break;
r++;
}
else if ( r == cd->rows[0] - 1) {
b1 = (cd->x_data[0][r] + cd->x_data[0][r-1]) / 2;
if ( time >= b1)
break;
r--;
}
else {
b1 = (cd->x_data[0][r] + cd->x_data[0][r-1]) / 2;
b2 = (cd->x_data[0][r] + cd->x_data[0][r+1]) / 2;
if ( b1 <= time && time < b2)
break;
if ( b1 <= time)
r++;
else
r--;
}
if ( i > cd->rows[0]) {
// Corrupt data, se original row
r = row;
break;
}
}
row = r;
}
for ( int i = 0; i < cd->cols; i++)
values[i] = cd->y_data[i][row];
*t = cd->x_data[0][row];
}
else {
// Time is a date
if ( !cd->x_reverse)
time = cd->x_min_value_axis[0] + x *
(cd->x_max_value_axis[0] - cd->x_min_value_axis[0]) / 200;
else
time = cd->x_min_value_axis[0] + (200.0 - x) *
(cd->x_max_value_axis[0] - cd->x_min_value_axis[0]) / 200;
// Approximate row
for ( int j = 0; j < cd->cols; j++) {
row = int ((time - cd->x_min_value[j]) /
(cd->x_max_value[j] - cd->x_min_value[j]) *
(cd->rows[j] - 1) + 0.5);
if ( row > cd->rows[j] - 1)
row = cd->rows[j] - 1;
else if ( row < 0)
row = 0;
else {
// Find exact row
double b1, b2;
int r = row;
for (int i = 0;; i++) {
if ( r == 0) {
b2 = (cd->x_data[j][row] + cd->x_data[j][r+1]) / 2;
if ( time < b2)
break;
r++;
}
else if ( r == cd->rows[j] - 1) {
b1 = (cd->x_data[j][r] + cd->x_data[0][r-1]) / 2;
if ( time >= b1)
break;
r--;
}
else {
b1 = (cd->x_data[j][r] + cd->x_data[j][r-1]) / 2;
b2 = (cd->x_data[j][r] + cd->x_data[j][r+1]) / 2;
if ( b1 <= time && time < b2)
break;
if ( b1 <= time)
r++;
else
r--;
}
if ( i > cd->rows[j]) {
// Corrupt data, se original row
r = row;
break;
}
}
row = r;
}
values[j] = cd->y_data[j][row];
if ( j == 0)
*t = cd->x_data[j][row];
}
}
}
*/
void add_points( int idx, int num, double[] values) {
for ( int i = rows[idx] - num - 1; i >= 0; i--)
y_data[idx][i + num] = y_data[idx][i];
for ( int i = 0; i < num; i++)
y_data[idx][i] = values[i];
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import jpwr.rt.*;
public interface JopCurveIfc {
public void close();
}
...@@ -103,10 +103,10 @@ public class JopMethods { ...@@ -103,10 +103,10 @@ public class JopMethods {
return false; // NYI return false; // NYI
} }
else if ( method.equals("Trend")) { else if ( method.equals("Trend")) {
return false; // NYI return trendFilter();
} }
else if ( method.equals("Fast")) { else if ( method.equals("Fast")) {
return false; // NYI return fastFilter();
} }
else if ( method.equals("Photo")) { else if ( method.equals("Photo")) {
return false; // NYI return false; // NYI
...@@ -161,13 +161,13 @@ public class JopMethods { ...@@ -161,13 +161,13 @@ public class JopMethods {
// NYI // NYI
} }
else if ( method.equals("Trend")) { else if ( method.equals("Trend")) {
// NYI trend();
} }
else if ( method.equals("Fast")) { else if ( method.equals("Fast")) {
// NYI fast();
} }
else if ( method.equals("Photo")) { else if ( method.equals("Photo")) {
// NYI photo();
} }
else if ( method.equals("Note")) { else if ( method.equals("Note")) {
// NYI // NYI
...@@ -318,6 +318,70 @@ public class JopMethods { ...@@ -318,6 +318,70 @@ public class JopMethods {
session.executeCommand( cmd); session.executeCommand( cmd);
} }
public boolean trendFilter() {
CdhrClassId cret = gdh.getObjectClass( aref.getObjid());
if ( cret.evenSts()) return false;
if ( cret.classId == Pwrb.cClass_DsTrend ||
cret.classId == Pwrb.cClass_DsTrendCurve ||
cret.classId == Pwrb.cClass_PlotGroup)
return true;
String attr = object + ".DefTrend";
CdhrString sret = gdh.getObjectInfoString( attr);
if ( sret.evenSts())
return false;
if ( sret.str.equals(""))
return false;
return true;
}
public void trend() {
CdhrClassId cret = gdh.getObjectClass( aref.getObjid());
if ( cret.evenSts()) return;
if ( cret.classId == Pwrb.cClass_DsTrend ||
cret.classId == Pwrb.cClass_DsTrendCurve ||
cret.classId == Pwrb.cClass_PlotGroup) {
String cmd = "open trend /name=" + object;
System.out.println( "trend: " + cmd);
session.executeCommand( cmd);
return;
}
String attr = object + ".DefTrend";
CdhrString deftrend = gdh.getObjectInfoString( attr);
if ( deftrend.evenSts()) return;
String cmd = "open trend /name=" + deftrend;
System.out.println( "trend: " + cmd);
session.executeCommand( cmd);
}
public boolean fastFilter() {
CdhrClassId cret = gdh.getObjectClass( aref.getObjid());
if ( cret.evenSts()) return false;
if ( cret.classId == Pwrb.cClass_DsFastCurve)
return true;
return false;
}
public void fast() {
CdhrClassId cret = gdh.getObjectClass( aref.getObjid());
if ( cret.evenSts()) return;
if ( cret.classId == Pwrb.cClass_DsFastCurve) {
String cmd = "open fast /name=" + object;
System.out.println( "fast: " + cmd);
session.executeCommand( cmd);
}
}
public boolean dataSheetFilter() { public boolean dataSheetFilter() {
String attr = object + ".DataSheet"; String attr = object + ".DataSheet";
CdhrString sret = gdh.getObjectInfoString( attr); CdhrString sret = gdh.getObjectInfoString( attr);
...@@ -429,7 +493,6 @@ public class JopMethods { ...@@ -429,7 +493,6 @@ public class JopMethods {
else else
// Java name equals class name // Java name equals class name
name = sret.str.substring(0,1).toUpperCase() + sret.str.substring(1).toLowerCase(); name = sret.str.substring(0,1).toUpperCase() + sret.str.substring(1).toLowerCase();
System.out.println( "classGraphFilter: " + name + ", class: " + sret.str);
try { try {
Class clazz = Class.forName( name); Class clazz = Class.forName( name);
......
...@@ -85,6 +85,16 @@ public class JopMethodsMenu implements ActionListener, PopupMenuListener, ...@@ -85,6 +85,16 @@ public class JopMethodsMenu implements ActionListener, PopupMenuListener,
item.addActionListener( this); item.addActionListener( this);
} }
if ( methods.trendFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Trend")));
item.addActionListener( this);
}
if ( methods.fastFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Fast")));
item.addActionListener( this);
}
if ( methods.helpFilter()) { if ( methods.helpFilter()) {
popup.add( item = new JMenuItem( JopLang.transl("Help"))); popup.add( item = new JMenuItem( JopLang.transl("Help")));
item.addActionListener( this); item.addActionListener( this);
...@@ -154,6 +164,12 @@ public class JopMethodsMenu implements ActionListener, PopupMenuListener, ...@@ -154,6 +164,12 @@ public class JopMethodsMenu implements ActionListener, PopupMenuListener,
else if ( event.getActionCommand().equals(JopLang.transl("Graph"))) { else if ( event.getActionCommand().equals(JopLang.transl("Graph"))) {
methods.openGraph(); methods.openGraph();
} }
else if ( event.getActionCommand().equals(JopLang.transl("Trend"))) {
methods.trend();
}
else if ( event.getActionCommand().equals(JopLang.transl("Fast"))) {
methods.fast();
}
else if ( event.getActionCommand().equals(JopLang.transl("Help"))) { else if ( event.getActionCommand().equals(JopLang.transl("Help"))) {
methods.help(); methods.help();
} }
......
...@@ -160,6 +160,14 @@ public class JopSession { ...@@ -160,6 +160,14 @@ public class JopSession {
public void setOpWindowLanguage( int language ){ public void setOpWindowLanguage( int language ){
((JopSessionIfc) sessionRep).setOpWindowLanguage( language); ((JopSessionIfc) sessionRep).setOpWindowLanguage( language);
} }
public void openTrend( String[] trendList, String plotGroup) {
((JopSessionIfc) sessionRep).openTrend( trendList, plotGroup);
}
public void openFast( String fastObject) {
((JopSessionIfc) sessionRep).openFast( fastObject);
}
} }
......
...@@ -64,4 +64,6 @@ public interface JopSessionIfc { ...@@ -64,4 +64,6 @@ public interface JopSessionIfc {
public void openSearch(String object); public void openSearch(String object);
public void setOpWindowLabelText( String text ); public void setOpWindowLabelText( String text );
public void setOpWindowLanguage( int language ); public void setOpWindowLanguage( int language );
public void openTrend( String[] trendList, String plotGroup);
public void openFast( String fastObject);
} }
...@@ -396,12 +396,22 @@ public class JopSessionRep implements JopSessionIfc { ...@@ -396,12 +396,22 @@ public class JopSessionRep implements JopSessionIfc {
else if ( isOpWindowFrame()) else if ( isOpWindowFrame())
((JopOpWindowFrame)root).setLabelText( text); ((JopOpWindowFrame)root).setLabelText( text);
} }
public void setOpWindowLanguage( int language) { public void setOpWindowLanguage( int language) {
if ( isOpWindowApplet()) if ( isOpWindowApplet())
((JopOpWindowApplet)root).setLanguage( language); ((JopOpWindowApplet)root).setLanguage( language);
else if ( isOpWindowFrame()) else if ( isOpWindowFrame())
((JopOpWindowFrame)root).setLanguage( language); ((JopOpWindowFrame)root).setLanguage( language);
} }
public void openTrend( String[] trendList, String plotGroup) {
new JopXttTrend( session, trendList, plotGroup);
}
public void openFast( String fastObject) {
new JopXttFast( session, fastObject);
}
} }
......
...@@ -136,6 +136,8 @@ System.out.println( "qcom put finished"); ...@@ -136,6 +136,8 @@ System.out.println( "qcom put finished");
String jgraph = "JGRAPH"; String jgraph = "JGRAPH";
String graph = "GRAPH"; String graph = "GRAPH";
String url = "URL"; String url = "URL";
String trend = "TREND";
String fast = "FAST";
String cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase(); String cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase();
if ( jgraph.length() >= cli_arg1.length() && if ( jgraph.length() >= cli_arg1.length() &&
jgraph.substring(0,cli_arg1.length()).equals(cli_arg1)) { jgraph.substring(0,cli_arg1.length()).equals(cli_arg1)) {
...@@ -369,9 +371,37 @@ System.out.println( "qcom put finished"); ...@@ -369,9 +371,37 @@ System.out.println( "qcom put finished");
openURL( session, urlValue, newFrame, frameName, null); openURL( session, urlValue, newFrame, frameName, null);
} }
} }
else if ( root instanceof JFrame) {
System.out.println( "Not yet implemented");
} }
else if ( trend.length() >= cli_arg1.length() &&
trend.substring(0,cli_arg1.length()).equals(cli_arg1)) {
// Command is "OPEN TREND"
String name;
if ( cli.qualifierFound("cli_arg2"))
name = cli.getQualValue("cli_arg2");
else
name = cli.getQualValue("/NAME");
StringTokenizer tokens = new StringTokenizer( name, ",");
int cnt = tokens.countTokens();
String[] trendList = new String[cnt];
for ( int i = 0; i < cnt; i++)
trendList[i] = tokens.nextToken();
session.openTrend( trendList, null);
}
else if ( fast.length() >= cli_arg1.length() &&
fast.substring(0,cli_arg1.length()).equals(cli_arg1)) {
// Command is "OPEN FAST"
String name;
if ( cli.qualifierFound("cli_arg2"))
name = cli.getQualValue("cli_arg2");
else
name = cli.getQualValue("/NAME");
session.openFast( name);
} }
else { else {
System.out.println( "Unknown command"); System.out.println( "Unknown command");
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import javax.swing.table.*;
import javax.swing.border.*;
import javax.swing.Timer;
import java.net.URL;
import jpwr.rt.*;
public class JopXttFast implements ActionListener, JopCurveIfc {
public static final int XTT_FAST_MAX = 20;
public static final int FAST_CURVES = 10;
public static final int mFunction_ManTrigg = 1;
public static final int mFunction_LevelTrigg = 2;
public static final int mFunction_BeforeTrigg = 4;
public static final int mFunction_AlwaysPrepared = 8;
public static final int mFunction_User = 16;
JopSession session;
JopEngine engine;
Object root;
Timer timer;
JopCurve curve;
int fast_cnt = 2;
int min_interval_idx;
int max_time;
int min_interval;
int[] interval = new int[XTT_FAST_MAX];
int[] last_buffer = new int[XTT_FAST_MAX];
int[] last_next_index = new int[XTT_FAST_MAX];
JopCurveData gcd;
int fast_tid;
String[] buffers = new String[XTT_FAST_MAX];
String timeBuffer;
int[] element_type = new int[XTT_FAST_MAX];
float[] yMinValue = new float[XTT_FAST_MAX];
float[] yMaxValue = new float[XTT_FAST_MAX];
boolean[] fixScale = new boolean[XTT_FAST_MAX];
int update_time;
String fastObject;
int noOfPoints;
int fastFunction;
boolean newCurve;
boolean oldNewCurve;
public JopXttFast( String fastObject) {
engine = new JopEngine( 1000, (Object)this);
session = new JopSession( engine, (Object)this);
this.fastObject = fastObject;
init();
}
public JopXttFast( JopSession session, String fastObject) {
this.session = session;
engine = session.getEngine();
this.fastObject = fastObject;
init();
}
public void close() {
timer.stop();
}
void init() {
int i, j, k;
int start_idx;
int fast_buff_size = 478;
timer = new Timer( 1000, this);
if ( fast_cnt == 0) {
System.out.println("Error in fast configuration");
return;
}
CdhrObjid oret = engine.gdh.nameToObjid( fastObject);
if ( oret.evenSts()) {
System.out.println("Error in fast configuration");
return;
}
CdhrClassId cret = engine.gdh.getObjectClass( oret.objid);
if ( cret.evenSts()) {
System.out.println("Error in fast configuration");
return;
}
fast_tid = cret.classId;
if ( fast_tid == Pwrb.cClass_DsFastCurve) {
int[] actual_data_size = new int[XTT_FAST_MAX];
double fmin_interval = 0;
int tcp_i;
int object_cnt = fast_cnt;
float displayTime;
float displayUpdateTime;
float scanTime;
int noOfSample;
int displayResolution;
int timeResolution;
CdhrFloat fret;
// Get current status of the fast object
CdhrInt iret = engine.gdh.getObjectInfoInt( fastObject + ".NoOfPoints");
if ( iret.evenSts())
return;
noOfPoints = iret.value;
iret = engine.gdh.getObjectInfoInt( fastObject + ".Function");
if ( iret.evenSts()) return;
fastFunction = iret.value;
CdhrBoolean bret = engine.gdh.getObjectInfoBoolean( fastObject + ".Active");
if ( bret.evenSts()) return;
boolean active = bret.value;
CdhrString sret = engine.gdh.getObjectInfoString( fastObject + ".TimeBuffer");
if ( sret.evenSts()) return;
timeBuffer = sret.str;
// Create data for time axis
gcd = new JopCurveData( JopCurveData.eDataType_DsTrend);
gcd.x_data[0] = new double[noOfPoints];
gcd.x_name = new String("Time");
gcd.x_axis_type[0] = JopCurveData.eAxis_x;
CdhrFloatArray faret;
if ( !active) {
faret = engine.gdh.getObjectInfoFloatArray( timeBuffer, noOfPoints);
if ( faret.evenSts()) {
System.out.println("Time buffer error, " + timeBuffer);
return;
}
for ( j = 0; j < noOfPoints; j++) {
gcd.x_data[0][j] = faret.value[j];
}
}
fast_cnt = 0;
for ( i = 0; i < FAST_CURVES; i++) {
bret = engine.gdh.getObjectInfoBoolean( fastObject + ".CurveValid[" + i + "]");
if ( bret.evenSts())
return;
boolean curveValid = bret.value;
if ( curveValid) {
gcd.y_data[fast_cnt] = new double[noOfPoints];
fret = engine.gdh.getObjectInfoFloat( fastObject + ".YMinValue[" + fast_cnt + "]");
if ( fret.evenSts()) return;
yMinValue[fast_cnt] = fret.value;
fret = engine.gdh.getObjectInfoFloat( fastObject + ".YMaxValue[" + fast_cnt + "]");
if ( fret.evenSts()) return;
yMaxValue[fast_cnt] = fret.value;
sret = engine.gdh.getObjectInfoString( fastObject + ".Attribute[" + fast_cnt + "]");
if ( sret.evenSts()) return;
String attrName = sret.str;
sret = engine.gdh.getObjectInfoString( fastObject + ".Buffers[" + fast_cnt + "]");
if ( sret.evenSts()) return;
buffers[fast_cnt] = sret.str;
gcd.y_axis_type[fast_cnt] = JopCurveData.eAxis_y;
gcd.y_name[fast_cnt] = attrName;
gcd.rows[fast_cnt] = noOfPoints;
gcd.y_unit[i] = new String( "m/s");
if ( !active) {
faret = engine.gdh.getObjectInfoFloatArray( buffers[fast_cnt], noOfPoints);
if ( faret.evenSts()) {
System.out.println("Fast object error, " + fastObject);
return;
}
for ( j = 0; j < noOfPoints; j++)
gcd.y_data[fast_cnt][j] = faret.value[j];
}
fast_cnt++;
}
}
gcd.cols = fast_cnt;
}
gcd.x_reverse = true;
gcd.get_borders();
gcd.get_default_axis();
gcd.select_color(false);
for ( i = 0; i < fast_cnt; i++) {
if ( !(yMinValue[i] == 0F && yMaxValue[i] == 0F)) {
fixScale[i] = true;
gcd.scale( gcd.y_axis_type[i], i, gcd.y_value_type[i],
yMinValue[i], yMaxValue[i], false, false);
}
}
curve = new JopCurve( session, this, gcd);
curve.setFillCurve(false);
timer.start();
}
public void actionPerformed( ActionEvent e) {
fast_scan();
}
private void fast_scan() {
if ( fast_tid == Pwrb.cClass_DsFastCurve) {
int size = 0;
int i, j;
boolean active;
CdhrBoolean bret = engine.gdh.getObjectInfoBoolean( fastObject + ".New");
if ( bret.evenSts())
return;
newCurve = bret.value;
if ( newCurve && !oldNewCurve) {
bret = engine.gdh.getObjectInfoBoolean( fastObject + ".Active");
if ( bret.evenSts())
return;
active = bret.value;
if ( active) return;
CdhrFloatArray faret;
faret = engine.gdh.getObjectInfoFloatArray( timeBuffer, noOfPoints);
if ( faret.evenSts()) {
System.out.println("Time buffer error, " + timeBuffer);
return;
}
for ( j = 0; j < noOfPoints; j++) {
gcd.x_data[0][j] = faret.value[j];
System.out.println( "Time value[" + j + "]: " + faret.value[j]);
}
for ( i = 0; i < fast_cnt; i++) {
faret = engine.gdh.getObjectInfoFloatArray( buffers[i], noOfPoints);
if ( faret.evenSts()) {
System.out.println("Fast object error, " + fastObject);
return;
}
for ( j = 0; j < noOfPoints; j++)
gcd.y_data[i][j] = faret.value[j];
}
gcd.get_borders();
gcd.get_default_axis();
for ( i = 0; i < fast_cnt; i++) {
if ( fixScale[i])
gcd.scale( gcd.y_axis_type[i], i, gcd.y_value_type[i],
yMinValue[i], yMaxValue[i], false, false);
}
curve.updateAxis();
}
oldNewCurve = newCurve;
}
}
public static void main(String[] args)
{
boolean debug = false;
for(int i = 0; i < args.length; i++)
{
if(args[i].equals("-d") || args[i].equals("-D"))
{
debug = true;
}
}
JopXttFast fast = new JopXttFast("H28-Fast");
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.jop;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import javax.swing.table.*;
import javax.swing.border.*;
import javax.swing.Timer;
import java.net.URL;
import jpwr.rt.*;
public class JopXttTrend implements ActionListener, JopCurveIfc {
public static final int XTT_TREND_MAX = 20;
JopSession session;
JopEngine engine;
Object root;
DsTrend[] tp;
DsTrendCurve[] tcp;
Timer timer;
JopCurve curve;
int trend_cnt = 2;
int min_interval_idx;
int max_points;
int max_time;
int min_interval;
String[] trend_name = new String[XTT_TREND_MAX];
int[] interval = new int[XTT_TREND_MAX];
int[] last_buffer = new int[XTT_TREND_MAX];
int[] last_next_index = new int[XTT_TREND_MAX];
JopCurveData gcd;
int trend_tid;
String[] buffers = new String[XTT_TREND_MAX];
int[] element_type = new int[XTT_TREND_MAX];
int update_time;
CircBuffInfo[] cb_info = new CircBuffInfo[XTT_TREND_MAX];
private class DsTrend {
public int NoOfBuffers;
public int ScanTime;
public int Multiple;
public int NoOfSample;
public int WriteBuffer;
public int[] NextWriteIndex = new int[2];
public float[] DataBuffer = new float[478];
public DsTrend() {}
}
private class DsTrendCurve {
public PwrtAttrRef AttrRef;
public String AttrName;
public String TimeBuffer;
public float DisplayTime;
public float DisplayUpdateTime;
public float ScanTime;
public int NoOfSample;
public int DisplayResolution;
public int TimeResolution;
public String Buffer;
public int ElementType;
public int ActualDataSize;
public DsTrendCurve() {}
}
public JopXttTrend( String[] trendList, String plotGroup ) {
engine = new JopEngine( 1000, (Object)this);
session = new JopSession( engine, (Object)this);
init( trendList, plotGroup);
}
public JopXttTrend( JopSession session, String[] trendList, String plotGroup ) {
this.session = session;
engine = session.getEngine();
init( trendList, plotGroup);
}
public void close() {
System.out.println("JopXttTrend.close");
timer.stop();
}
void init( String[] trendList, String plotGroup) {
int i, j, k;
int start_idx;
int trend_buff_size = 478;
timer = new Timer( 1000, this);
if ( trendList != null) {
trend_name = trendList;
trend_cnt = trend_name.length;
}
else {
// Plotgroup as input
CdhrString ret;
trend_cnt = 0;
for ( i = 0; i < 20; i ++) {
ret = engine.gdh.getObjectInfoString( plotGroup + ".YObjectName["+i+"]");
if ( ret.evenSts() || ret.str.equals(""))
continue;
trend_name[trend_cnt++] = ret.str;
}
}
if ( trend_cnt == 0) {
System.out.println("Error in trend configuration");
return;
}
CdhrObjid oret = engine.gdh.nameToObjid( trend_name[0]);
if ( oret.evenSts()) {
System.out.println("Error in trend configuration");
return;
}
CdhrClassId cret = engine.gdh.getObjectClass( oret.objid);
if ( cret.evenSts()) {
System.out.println("Error in trend configuration");
return;
}
trend_tid = cret.classId;
if ( trend_tid == Pwrb.cClass_DsTrend) {
tp = new DsTrend[trend_cnt];
for ( i = 0; i < trend_cnt; i++) {
tp[i] = new DsTrend();
CdhrInt ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".ScanTime");
if ( ret.oddSts()) {
tp[i].ScanTime = ret.value;
ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".NoOfBuffers");
if ( ret.oddSts()) {
tp[i].NoOfBuffers = ret.value;
ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".NoOfSample");
if ( ret.oddSts()) {
tp[i].NoOfSample = ret.value;
ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".Multiple");
if ( ret.oddSts()) {
tp[i].Multiple = ret.value;
ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".WriteBuffer");
if ( ret.oddSts()) {
tp[i].WriteBuffer = ret.value;
ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".NextWriteIndex[0]");
if ( ret.oddSts()) {
tp[i].NextWriteIndex[0] = ret.value;
ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".NextWriteIndex[1]");
if ( ret.oddSts()) {
tp[i].NextWriteIndex[1] = ret.value;
}
}
}
}
}
}
}
if ( ret.evenSts()) {
System.out.println("Trend object error, " + trend_name[i]);
return;
}
CdhrFloatArray faret = engine.gdh.getObjectInfoFloatArray( trend_name[i] + ".DataBuffer", 478);
if ( faret.evenSts()) {
System.out.println("Trend object error, " + trend_name[i]);
return;
}
tp[i].DataBuffer = faret.value;
}
// Calculate number of points
max_time = 0;
min_interval = 100000;
int time;
for ( i = 0; i < trend_cnt; i++) {
System.out.println( "Multiple " + tp[i].Multiple + " ScanTime " + tp[i].ScanTime + " NoOfBuffers " + tp[i].NoOfBuffers + " NoOfSample " + tp[i].NoOfSample);
time = tp[i].Multiple * tp[i].ScanTime * tp[i].NoOfBuffers *
tp[i].NoOfSample;
if ( time > max_time)
max_time = time;
if ( (int) (tp[i].Multiple * tp[i].ScanTime) < min_interval) {
min_interval = tp[i].Multiple * tp[i].ScanTime;
min_interval_idx = i;
}
}
if ( min_interval == 0) {
System.out.println( "XNAV__TRENDCONFIG");
return;
}
max_points = max_time / min_interval;
System.out.println( "max_points: " + max_points);
for ( i = 0; i < trend_cnt; i++) {
interval[i] = tp[i].Multiple * tp[i].ScanTime / min_interval;
}
// Create data for time axis
gcd = new JopCurveData( JopCurveData.eDataType_DsTrend);
gcd.x_data[0] = new double[max_points];
gcd.x_name = new String("Time");
for ( j = 0; j < max_points; j++) {
gcd.x_data[0][j] = (double) (j * min_interval);
}
gcd.x_axis_type[0] = JopCurveData.eAxis_x;
for ( i = 0; i < trend_cnt; i++) {
gcd.y_data[i] = new double[max_points];
int write_buffer = tp[i].WriteBuffer;
start_idx = write_buffer * trend_buff_size / 2
+ (int)( tp[i].NextWriteIndex[write_buffer]);
if ( start_idx == 0) {
start_idx = tp[i].NoOfSample - 1 + trend_buff_size / 2;
write_buffer = 1;
}
else if ( start_idx == trend_buff_size / 2) {
start_idx = tp[i].NoOfSample - 1;
write_buffer = 0;
}
else
start_idx--;
int idx = 0;
for ( j = start_idx; j >= write_buffer * trend_buff_size/2; j--) {
for ( k = 0; k < interval[i]; k++) {
System.out.println( "idx: " + idx + " i: " + i + " j: " + j + " DataBuffer.length: " + tp[i].DataBuffer.length + " gcd.y_data[i].length: " + gcd.y_data[i].length);
gcd.y_data[i][idx] = tp[i].DataBuffer[j];
idx++;
}
}
for ( j = tp[i].NoOfSample - 1 + (write_buffer == 0 ? 1 : 0) * trend_buff_size/2;
j >= (write_buffer == 0 ? 1 : 0) * trend_buff_size/2; j--) {
for ( k = 0; k < interval[i]; k++) {
gcd.y_data[i][idx] = tp[i].DataBuffer[j];
idx++;
}
}
if ( start_idx != (int) tp[i].NoOfSample - 1 +
write_buffer * trend_buff_size/2) {
for ( j = tp[i].NoOfSample - 1 + write_buffer * trend_buff_size/2;
j > start_idx; j--) {
for ( k = 0; k < interval[i]; k++) {
gcd.y_data[i][idx] = tp[i].DataBuffer[j];
idx++;
}
}
}
last_buffer[i] = tp[i].WriteBuffer;
last_next_index[i] = tp[i].NextWriteIndex[last_buffer[i]];
gcd.y_axis_type[i] = JopCurveData.eAxis_y;
gcd.y_name[i] = trend_name[i];
gcd.y_unit[i] = new String( "m/s");
gcd.rows[i] = max_points;
}
gcd.cols = trend_cnt;
}
else if ( trend_tid == Pwrb.cClass_DsTrendCurve) {
int[] actual_data_size = new int[XTT_TREND_MAX];
double fmin_interval = 0;
int tcp_i;
int object_cnt = trend_cnt;
String[] object_names = trend_name;
trend_name = new String[XTT_TREND_MAX];
trend_cnt = 0;
// Get current status of the trend objects
i = 0;
tcp_i = 0;
max_points = 0;
tcp = new DsTrendCurve[XTT_TREND_MAX];
for ( i = 0; i < object_cnt; i++) {
float displayTime;
float displayUpdateTime;
float scanTime;
int noOfSample;
int displayResolution;
int timeResolution;
tcp[object_cnt] = new DsTrendCurve();
CdhrFloat fret = engine.gdh.getObjectInfoFloat( object_names[i] + ".DisplayTime");
if ( fret.evenSts())
continue;
displayTime = fret.value;
fret = engine.gdh.getObjectInfoFloat( object_names[i] + ".DisplayUpdateTime");
if ( fret.evenSts())
continue;
displayUpdateTime = fret.value;
fret = engine.gdh.getObjectInfoFloat( object_names[i] + ".ScanTime");
if ( fret.evenSts())
continue;
scanTime = fret.value;
CdhrInt iret = engine.gdh.getObjectInfoInt( object_names[i] + ".NoOfSample");
if ( iret.evenSts())
continue;
noOfSample = iret.value;
iret = engine.gdh.getObjectInfoInt( object_names[i] + ".DisplayResolution");
if ( iret.evenSts())
continue;
displayResolution = iret.value;
iret = engine.gdh.getObjectInfoInt( object_names[i] + ".TimeResolution");
if ( iret.evenSts())
continue;
timeResolution = iret.value;
for ( j = 0; j < 10; j++) {
CdhrString sret = engine.gdh.getObjectInfoString( object_names[i] + ".Attribute["+j+"]");
if ( sret.oddSts() && !sret.str.equals("")) {
tcp[tcp_i] = new DsTrendCurve();
tcp[tcp_i].AttrName = sret.str;
tcp[tcp_i].DisplayUpdateTime = displayUpdateTime;
tcp[tcp_i].ScanTime = scanTime;
tcp[tcp_i].DisplayTime = displayTime;
tcp[tcp_i].NoOfSample = noOfSample;
tcp[tcp_i].DisplayResolution = displayResolution;
tcp[tcp_i].TimeResolution = timeResolution;
sret = engine.gdh.getObjectInfoString( object_names[i] + ".Buffers["+j+"]");
if ( sret.evenSts() || sret.str.equals(""))
continue;
tcp[tcp_i].Buffer = sret.str;
CdhrAttrRef aret = engine.gdh.nameToAttrRef( tcp[tcp_i].Buffer);
if ( aret.evenSts())
continue;
tcp[tcp_i].AttrRef = aret.aref;
iret = engine.gdh.getObjectInfoInt( object_names[i] + ".AttributeType["+j+"]");
if ( iret.evenSts())
continue;
tcp[tcp_i].ElementType = iret.value;
tcp_i++;
if ( tcp_i >= XTT_TREND_MAX)
break;
}
}
if ( tcp_i >= XTT_TREND_MAX)
break;
}
trend_cnt = tcp_i;
if ( trend_cnt == 0)
return;
for ( i = 0; i < trend_cnt; i++) {
System.out.println("Attribute " + tcp[i].AttrName + " Buffer " + tcp[i].Buffer);
cb_info[i] = new CircBuffInfo();
cb_info[i].circAref = tcp[i].AttrRef;
cb_info[i].resolution = tcp[i].DisplayResolution;
cb_info[i].elementType = tcp[i].ElementType;
cb_info[i].samples = (int)(tcp[i].DisplayTime / tcp[i].ScanTime / cb_info[i].resolution);
System.out.println( "Samples: " + cb_info[i].samples);
engine.gdh.getCircBuffInfo( cb_info[i]);
System.out.println( "sts: " + cb_info[i].status);
tcp[i].ActualDataSize = cb_info[i].size;
if ( i == 0) {
update_time = (int)(tcp[0].DisplayUpdateTime * 1000F);
fmin_interval = tcp[0].ScanTime;
}
}
for ( i = 0; i < trend_cnt; i++) {
if ( cb_info[i].samples > max_points)
max_points = cb_info[i].samples;
}
// Create data for time axis
gcd = new JopCurveData( JopCurveData.eDataType_DsTrend);
gcd.x_data[0] = new double[max_points];
gcd.x_name = new String("Time");
for ( j = 0; j < max_points; j++) {
gcd.x_data[0][j] = (double)( fmin_interval * j * tcp[0].DisplayResolution);
}
gcd.x_axis_type[0] = JopCurveData.eAxis_x;
for ( i = 0; i < trend_cnt; i++) {
gcd.y_data[i] = new double[max_points];
System.out.println("ElementType " + tcp[i].ElementType + " " + Pwr.eType_Float32);
switch ( tcp[i].ElementType) {
case Pwr.eType_Float32:
for ( j = 0; j < tcp[i].ActualDataSize; j++) {
gcd.y_data[i][j] = (double)((float[])cb_info[i].bufp)[ tcp[i].ActualDataSize - j - 1];
System.out.println( j + " " + (double)((float[])cb_info[i].bufp)[ tcp[i].ActualDataSize - j - 1]);
}
break;
case Pwr.eType_Int32:
case Pwr.eType_UInt32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8:
for ( j = 0; j < tcp[i].ActualDataSize; j++) {
gcd.y_data[i][j] = (double)((int[])cb_info[i].bufp)[ tcp[i].ActualDataSize - j - 1];
System.out.println( j + " " + (double)((int[])cb_info[i].bufp)[ tcp[i].ActualDataSize - j - 1]);
}
break;
default: ;
}
cb_info[i].bufp = null;
gcd.y_axis_type[i] = JopCurveData.eAxis_y;
gcd.y_name[i] = tcp[i].AttrName;
gcd.rows[i] = max_points;
gcd.y_unit[i] = new String( "m/s");
}
gcd.cols = trend_cnt;
/*
if ( !trend_list) {
// Use axis values from plotgroup object
for ( i = 0; i < trend_cnt; i++) {
if ( plot.YMinValue[i] != plot.YMaxValue[i])
gcd->scale( gcd->y_axis_type[i], gcd->y_value_type[i],
plot.YMinValue[i], plot.YMaxValue[i],
&gcd->y_min_value_axis[i], &gcd->y_max_value_axis[i],
&gcd->y_trend_lines[i], &gcd->y_axis_lines[i], &gcd->y_axis_linelongq[i],
&gcd->y_axis_valueq[i], gcd->y_format[i],
&gcd->y_axis_width[i], 1, 1);
}
}
*/
}
gcd.x_reverse = true;
gcd.get_borders();
gcd.get_default_axis();
gcd.select_color(false);
System.out.println( "Lines h : " + gcd.y_trend_lines[0] + " v: " + gcd.x_trend_lines[0]);
curve = new JopCurve( session, this, gcd);
curve.setFillCurve(false);
timer.start();
}
public void actionPerformed( ActionEvent e) {
trend_scan();
}
private void trend_scan() {
if ( trend_tid == Pwrb.cClass_DsTrend) {
int write_buffer;
int idx;
int values;
int trend_buff_size = 478;
int i, j, k;
for ( i = 0; i < trend_cnt; i++) {
CdhrInt ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".NoOfSample");
if ( ret.oddSts()) {
tp[i].NoOfSample = ret.value;
ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".WriteBuffer");
if ( ret.oddSts()) {
tp[i].WriteBuffer = ret.value;
ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".NextWriteIndex[0]");
if ( ret.oddSts()) {
tp[i].NextWriteIndex[0] = ret.value;
ret = engine.gdh.getObjectInfoInt( trend_name[i] + ".NextWriteIndex[1]");
if ( ret.oddSts()) {
tp[i].NextWriteIndex[1] = ret.value;
}
}
}
}
if ( ret.evenSts()) {
System.out.println("Trend object error, " + trend_name[i]);
return;
}
CdhrFloatArray faret = engine.gdh.getObjectInfoFloatArray( trend_name[i] + ".DataBuffer", 478);
if ( faret.evenSts()) {
System.out.println("Trend object error, " + trend_name[i]);
return;
}
tp[i].DataBuffer = faret.value;
}
// Check if any new value
i = min_interval_idx;
if ( tp[i].NextWriteIndex[tp[i].WriteBuffer] !=
last_next_index[i]) {
values = tp[i].NextWriteIndex[tp[i].WriteBuffer]
- last_next_index[i];
if ( values < 0)
values = values + tp[i].NoOfSample;
last_next_index[i] =
tp[i].NextWriteIndex[tp[i].WriteBuffer];
for ( k = 0; k < values; k++) {
// Add new points
for ( i = 0; i < trend_cnt; i++) {
// Shift data
for ( j = max_points - 1; j > 0; j--)
gcd.y_data[i][j] = gcd.y_data[i][j-1];
// Insert new value
write_buffer = tp[i].WriteBuffer;
idx = write_buffer * trend_buff_size / 2
+ (int)( tp[i].NextWriteIndex[write_buffer]) - (values - 1 - k);
if ( idx == 0 || idx == trend_buff_size/2)
idx = tp[i].NoOfSample - 1 + (write_buffer == 0 ? 1: 0) *
trend_buff_size/2;
else
idx--;
gcd.y_data[i][0] = tp[i].DataBuffer[idx];
}
curve.updateChart();
}
}
}
else if ( trend_tid == Pwrb.cClass_DsTrendCurve) {
int size = 0;
int i, j;
engine.gdh.updateCircBuffInfo( cb_info, trend_cnt);
for ( i = 0; i < trend_cnt; i++) {
size = cb_info[i].size;
if ( size > 0) {
// Shift data
for ( j = cb_info[i].samples - 1; j >= size; j--)
gcd.y_data[i][j] = gcd.y_data[i][j-size];
// Insert new value
switch ( tcp[i].ElementType) {
case Pwr.eType_Float32:
for ( j = 0; j < size; j++) {
gcd.y_data[i][j] = ((float[])cb_info[i].bufp)[size - j - 1];
}
break;
case Pwr.eType_Int32:
case Pwr.eType_UInt32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8:
for ( j = 0; j < size; j++) {
gcd.y_data[i][j] = ((int[])cb_info[i].bufp)[size - j - 1];
}
break;
default: ;
}
}
}
if ( size > 0)
curve.updateChart();
}
}
public static void main(String[] args)
{
boolean debug = false;
for(int i = 0; i < args.length; i++)
{
if(args[i].equals("-d") || args[i].equals("-D"))
{
debug = true;
}
}
JopXttTrend trend = new JopXttTrend(new String[] {"H28-Trend2"},null);
}
}
...@@ -29,6 +29,7 @@ local_java_sources := \ ...@@ -29,6 +29,7 @@ local_java_sources := \
GeDyn.java \ GeDyn.java \
GeComponent.java \ GeComponent.java \
GeTextField.java \ GeTextField.java \
GeGradient.java \
GeSlider.java \ GeSlider.java \
JopBar.java \ JopBar.java \
JopTrend.java \ JopTrend.java \
...@@ -78,6 +79,9 @@ local_java_sources := \ ...@@ -78,6 +79,9 @@ local_java_sources := \
JopXYCurve.java \ JopXYCurve.java \
Proportion.java\ Proportion.java\
RatioLayout.java \ RatioLayout.java \
JopCurveAxis.java \
JopCurveAxisLayout.java \
JopCurveChartLayout.java \
AspectRatioListener.java \ AspectRatioListener.java \
JopSpiderFrame.java \ JopSpiderFrame.java \
JopLoginFrame.java \ JopLoginFrame.java \
...@@ -92,7 +96,6 @@ local_java_sources := \ ...@@ -92,7 +96,6 @@ local_java_sources := \
JopUtilities.java \ JopUtilities.java \
GeImage.java \ GeImage.java \
GeFrameThin.java \ GeFrameThin.java \
GeGradient.java \
Flow.java \ Flow.java \
FlowCtxInterface.java \ FlowCtxInterface.java \
FlowCmn.java \ FlowCmn.java \
...@@ -128,6 +131,11 @@ local_java_sources := \ ...@@ -128,6 +131,11 @@ local_java_sources := \
XttTree.java \ XttTree.java \
JopXttApplet.java \ JopXttApplet.java \
JopXttFrame.java \ JopXttFrame.java \
JopCurveData.java \
JopCurveIfc.java \
JopCurve.java \
JopXttTrend.java \
JopXttFast.java \
EventTableModel.java \ EventTableModel.java \
EventTableCellRender.java \ EventTableCellRender.java \
MhTable.java \ MhTable.java \
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.rt;
public class CircBuffInfo
{
public PwrtAttrRef circAref;
public int resolution;
public int samples;
public String description;
public Object bufp;
public int size;
public int firstIdx;
public int lastIdx;
public int offset;
public int elementType;
public int status;
public CircBuffInfo() {
}
public int getCircArefOix() { return circAref.getOix();}
public int getCircArefVid() { return circAref.getVid();}
public int getCircArefBody() { return circAref.getBody();}
public int getCircArefOffset() { return circAref.getOffset();}
public int getCircArefSize() { return circAref.getSize();}
public int getCircArefFlags() { return circAref.getFlags();}
public int getResolution() { return resolution;}
public int getSamples() { return samples;}
public int getElementType() { return elementType;}
public int getFirstIdx() { return firstIdx;}
public int getLastIdx() { return lastIdx;}
public int getOffset() { return offset;}
}
...@@ -450,6 +450,8 @@ public class Gdh { ...@@ -450,6 +450,8 @@ public class Gdh {
public native CdhrString getMsgText( int sts); public native CdhrString getMsgText( int sts);
public native CdhrClassId getSuperClass( int classid, PwrtObjid objid); public native CdhrClassId getSuperClass( int classid, PwrtObjid objid);
public native GdhrsAttrDef[] getObjectBodyDef(int classid, PwrtAttrRef aref); public native GdhrsAttrDef[] getObjectBodyDef(int classid, PwrtAttrRef aref);
public native int getCircBuffInfo(CircBuffInfo info);
public native int updateCircBuffInfo(CircBuffInfo[] info, int info_size);
// public native GdhrGetXttObj[] getAllXttChildrenNative(PwrtObjid objid); // public native GdhrGetXttObj[] getAllXttChildrenNative(PwrtObjid objid);
} }
......
...@@ -111,6 +111,8 @@ public class GdhServer ...@@ -111,6 +111,8 @@ public class GdhServer
public final static int GET_ALL_CLASS_ATTRIBUTES_STRING = 56; public final static int GET_ALL_CLASS_ATTRIBUTES_STRING = 56;
public final static int GET_OBJECT_INFO_FLOAT_ARRAY = 57; public final static int GET_OBJECT_INFO_FLOAT_ARRAY = 57;
public final static int GET_OBJECT_INFO_INT_ARRAY = 58; public final static int GET_OBJECT_INFO_INT_ARRAY = 58;
public final static int GET_CIRCBUFF_INFO = 59;
public final static int UPDATE_CIRCBUFF_INFO = 60;
public final static int PORT = 4445; public final static int PORT = 4445;
...@@ -589,7 +591,7 @@ public class GdhServer ...@@ -589,7 +591,7 @@ public class GdhServer
} }
catch(IOException e) catch(IOException e)
{ {
System.out.println("setObjectInfoString: IO exception"); System.out.println("getObjectInfoString: IO exception");
} }
break; break;
case GET_OBJECT_INFO_OBJID: case GET_OBJECT_INFO_OBJID:
...@@ -1793,6 +1795,118 @@ public class GdhServer ...@@ -1793,6 +1795,118 @@ public class GdhServer
System.out.println("GET_SUBSCRIPTIONS: IO exception"); System.out.println("GET_SUBSCRIPTIONS: IO exception");
} }
break; break;
case GET_CIRCBUFF_INFO:
try
{
CircBuffInfo info = new CircBuffInfo();
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
info.circAref = new PwrtAttrRef(objid, body, offset, size, flags);
info.samples = in.readInt();
info.resolution = in.readInt();
info.elementType = in.readInt();
gdh.getCircBuffInfo( info);
out.writeInt(info.status);
if ( info.status % 2 != 0) {
out.writeInt(info.size);
out.writeInt(info.firstIdx);
out.writeInt(info.lastIdx);
out.writeInt(info.offset);
out.writeInt(info.samples);
switch( info.elementType) {
case Pwr.eType_Float32:
for ( int j = 0; j < info.size; j++)
out.writeFloat(((float[])info.bufp)[j]);
break;
case Pwr.eType_Int32:
case Pwr.eType_UInt32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8:
for ( int j = 0; j < info.size; j++)
out.writeInt(((int[])info.bufp)[j]);
break;
default: ;
}
}
out.flush();
}
catch(IOException e)
{
System.out.println("getCircBuffInfo: IO exception");
}
break;
case UPDATE_CIRCBUFF_INFO:
try
{
int info_size = in.readInt();
CircBuffInfo[] info = new CircBuffInfo[info_size];
for ( i = 0; i < info_size; i++) {
info[i] = new CircBuffInfo();
int oix = in.readInt();
int vid = in.readInt();
int body = in.readInt();
int offset = in.readInt();
int size = in.readInt();
int flags = in.readInt();
PwrtObjid objid = new PwrtObjid(oix, vid);
info[i].circAref = new PwrtAttrRef(objid, body, offset, size, flags);
info[i].samples = in.readInt();
info[i].resolution = in.readInt();
info[i].elementType = in.readInt();
info[i].firstIdx = in.readInt();
info[i].lastIdx = in.readInt();
info[i].offset = in.readInt();
}
gdh.updateCircBuffInfo( info, info_size);
out.writeInt(info[0].status);
if ( info[0].status % 2 != 0) {
for ( i = 0; i < info_size; i++) {
out.writeInt(info[i].size);
out.writeInt(info[i].firstIdx);
out.writeInt(info[i].lastIdx);
out.writeInt(info[i].offset);
out.writeInt(info[i].samples);
switch( info[i].elementType) {
case Pwr.eType_Float32:
for ( int j = 0; j < info[i].size; j++)
out.writeFloat(((float[])info[i].bufp)[j]);
break;
case Pwr.eType_UInt32:
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8:
for ( int j = 0; j < info[i].size; j++)
out.writeInt(((int[])info[i].bufp)[j]);
break;
default: ;
}
}
}
out.flush();
}
catch(IOException e)
{
System.out.println("updateCircBuffInfo: IO exception");
}
break;
default: default:
errh.error("Received unknown function : " + function); errh.error("Received unknown function : " + function);
} }
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.rt;
import java.io.Serializable;
public class GdhrCircBuffInfo implements Serializable
{
public CircBuffInfo info;
public int sts;
public GdhrCircBuffInfo( CircBuffInfo info,
int sts)
{
this.info = info;
this.sts = sts;
}
public boolean evenSts() { return (sts % 2 == 0);}
public boolean oddSts() { return (sts % 2 == 1);}
public int getSts() { return sts;}
}
...@@ -158,10 +158,12 @@ public class Pwrb { ...@@ -158,10 +158,12 @@ public class Pwrb {
public static final int cClass_drive = 131896; public static final int cClass_drive = 131896;
public static final int cClass_DsFast = 131904; public static final int cClass_DsFast = 131904;
public static final int cClass_DsFastConf = 131912; public static final int cClass_DsFastConf = 131912;
public static final int cClass_DsFastCurve = 133616;
public static final int cClass_DsHist = 131920; public static final int cClass_DsHist = 131920;
public static final int cClass_DsHistServer = 131928; public static final int cClass_DsHistServer = 131928;
public static final int cClass_DsTrend = 131936; public static final int cClass_DsTrend = 131936;
public static final int cClass_DsTrendConf = 131944; public static final int cClass_DsTrendConf = 131944;
public static final int cClass_DsTrendCurve = 135816;
public static final int cClass_DSup = 131952; public static final int cClass_DSup = 131952;
public static final int cClass_Dv = 131960; public static final int cClass_Dv = 131960;
public static final int cClass_DvArea = 131968; public static final int cClass_DvArea = 131968;
......
...@@ -33,6 +33,8 @@ local_java_sources = \ ...@@ -33,6 +33,8 @@ local_java_sources = \
CdhrObjAttr.java \ CdhrObjAttr.java \
PwrsParInfo.java \ PwrsParInfo.java \
GdhrsAttrDef.java \ GdhrsAttrDef.java \
CircBuffInfo.java \
GdhrCircBuffInfo.java \
Gdh.java \ Gdh.java \
Sub.java \ Sub.java \
SubElement.java \ SubElement.java \
......
...@@ -100,6 +100,8 @@ public class Gdh ...@@ -100,6 +100,8 @@ public class Gdh
public final static int GET_ALL_CLASS_ATTRIBUTES_STRING = 56; public final static int GET_ALL_CLASS_ATTRIBUTES_STRING = 56;
public final static int GET_OBJECT_INFO_FLOAT_ARRAY = 57; public final static int GET_OBJECT_INFO_FLOAT_ARRAY = 57;
public final static int GET_OBJECT_INFO_INT_ARRAY = 58; public final static int GET_OBJECT_INFO_INT_ARRAY = 58;
public final static int GET_CIRCBUFF_INFO = 59;
public final static int UPDATE_CIRCBUFF_INFO = 60;
...@@ -1855,16 +1857,133 @@ public class Gdh ...@@ -1855,16 +1857,133 @@ public class Gdh
} }
} }
public void logString(String str) public int getCircBuffInfo(CircBuffInfo info)
{ {
try try {
out.writeInt(GET_CIRCBUFF_INFO);
out.writeInt(info.circAref.objid.oix);
out.writeInt(info.circAref.objid.vid);
out.writeInt(info.circAref.body);
out.writeInt(info.circAref.offset);
out.writeInt(info.circAref.size);
out.writeInt(info.circAref.flags);
out.writeInt(info.samples);
out.writeInt(info.resolution);
out.writeInt(info.elementType);
out.flush();
int sts = in.readInt();
if(sts % 2 == 0) {
info.status = sts;
return 0;
}
info.size = in.readInt();
info.firstIdx = in.readInt();
info.lastIdx = in.readInt();
info.offset = in.readInt();
info.samples = in.readInt();
switch ( info.elementType) {
case Pwr.eType_Float32: {
float[] buf = new float[info.size];
for ( int i = 0; i < info.size; i++)
buf[i] = in.readFloat();
info.bufp = buf;
break;
}
case Pwr.eType_UInt32:
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8: {
int[] buf = new int[info.size];
for ( int i = 0; i < info.size; i++)
buf[i] = in.readInt();
info.bufp = buf;
break;
}
default: ;
}
}
catch(IOException e) {
info.status = __IO_EXCEPTION;
return 0;
}
return 1;
}
public int updateCircBuffInfo(CircBuffInfo[] info, int info_size)
{ {
try {
out.writeInt(UPDATE_CIRCBUFF_INFO);
out.writeInt(info_size);
for ( int i = 0; i < info_size; i++) {
out.writeInt(info[i].circAref.objid.oix);
out.writeInt(info[i].circAref.objid.vid);
out.writeInt(info[i].circAref.body);
out.writeInt(info[i].circAref.offset);
out.writeInt(info[i].circAref.size);
out.writeInt(info[i].circAref.flags);
out.writeInt(info[i].samples);
out.writeInt(info[i].resolution);
out.writeInt(info[i].elementType);
out.writeInt(info[i].firstIdx);
out.writeInt(info[i].lastIdx);
out.writeInt(info[i].offset);
}
out.flush();
int sts = in.readInt();
if(sts % 2 == 0) {
System.out.println( "updateCircBuffInfo: sts " + sts);
info[0].status = sts;
return 0;
}
for ( int i = 0; i < info_size; i++) {
info[i].size = in.readInt();
info[i].firstIdx = in.readInt();
info[i].lastIdx = in.readInt();
info[i].offset = in.readInt();
info[i].samples = in.readInt();
switch( info[i].elementType) {
case Pwr.eType_Float32: {
float[] buf = new float[info[i].size];
for ( int j = 0; j < info[i].size; j++)
buf[j] = in.readFloat();
info[i].bufp = buf;
break;
}
case Pwr.eType_UInt32:
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8: {
int[] buf = new int[info[i].size];
for ( int j = 0; j < info[i].size; j++)
buf[j] = in.readInt();
info[i].bufp = buf;
break;
}
default: ;
}
}
}
catch(IOException e) {
info[0].status = __IO_EXCEPTION;
return 0;
}
return 1;
}
public void logString(String str)
{
try {
out.writeInt(LOG_STRING); out.writeInt(LOG_STRING);
out.writeUTF(str); out.writeUTF(str);
out.flush(); out.flush();
} }
catch(IOException e) catch(IOException e) {
{
} }
} }
...@@ -1891,8 +2010,7 @@ public class Gdh ...@@ -1891,8 +2010,7 @@ public class Gdh
{ {
String suffix; String suffix;
int idx1 = attrName.indexOf("##"); int idx1 = attrName.indexOf("##");
if(idx1 < 0) if(idx1 < 0) {
{
return Pwr.eType_Boolean; return Pwr.eType_Boolean;
} }
......
if [ "$pwra_db" == "" ]; then
source /etc/pwrp_profile
fi
pwrp()
{
source $pwra_db/pwra_env.sh $@
}
alias sdf="source $pwra_db/pwra_env.sh set project"
alias pwrc="wb_cmd"
alias pwrs="wb_start.sh pwrp pwrp"
alias pwra="wb -p pwrp pwrp"
1
100 V2.0.0
101 24
2
200 common
201 0
202 1
203 15
204
3
300 pwrp
301 aaupl/kQs1p3U
302 4129168825
303 16
305
304 Proview project user
307
306
308
99
3
300 op1
301 aa.d10HWuKdCo
302 4294843775
303 17
305
304 Operator with Operator1 privilege
307
306
308
99
3
300 op2
301 aa.d10HWuKdCo
302 4294843711
303 18
305
304 Operator with Operator2 privilege
307
306
308
99
3
300 op3
301 aa.d10HWuKdCo
302 4294843583
303 19
305
304 Operator with Operator3 privilege
307
306
308
99
3
300 op4
301 aa.d10HWuKdCo
302 4294843327
303 20
305
304 Operator with Operator4 privilege
307
306
308
99
99
99
!**Menu ClassVolumes { //
!**Menu BaseClasses { //
NMps 0.0.1.1 PwrBase
TLog 0.0.1.2 PwrBase
SSAB 0.0.1.3 PwrBase
Remote 0.0.1.4 PwrBase
BaseComponent 0.0.0.10 PwrBase
Profibus 0.0.250.7 PwrBase
OtherManufacturer 0.2.250.1 PwrBase
ABB 0.0.250.2 PwrBase
Siemens 0.0.250.3 PwrBase
Telemecanique 0.0.250.4 PwrBase
SsabOx 0.0.250.5 PwrBase
KlocknerMoeller 0.0.250.6 PwrBase
Inor 0.0.250.8 PwrBase
!**}
!**}
#! /bin/bash
#
#
#
pwra_set_func()
{
local cmd
local baseroot
local project
if [ -z $1 ]; then
echo "Qualifier is missing"
return
fi
cmd="base"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
# Command is "set base"
basename=$2
basename=${basename//\./\\.}
baseroot=`eval cat $pwra_db/pwr_projectlist.dat | grep "\b"$basename"\b" | grep "\b"base"\b" | awk '{print $3}'`
if [ -z $baseroot ]; then
echo "Unable to find base '$2'"
return
fi
baseroot=${baseroot%/}
if [ ! -e "$baseroot" ]; then
echo "Base $baseroot doesn't exist"
elif [ "$3" != "cross" ]; then
if [ ! -e $baseroot/$os/$hw/exp/exe/pwrp_env.sh ]; then
echo "Not a base directory: $baseroot"
return
fi
source $baseroot/$os/$hw/exp/exe/pwrp_env.sh set baseroot $baseroot
fi
return
fi
cmd="baseroot"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
# Command is "set baseroot"
baseroot=$2
baseroot=${baseroot%/}
if [ ! -e "$baseroot" ]; then
echo "Base $baseroot doesn't exist"
else
if [ ! -e $baseroot/$os/$hw/exp/exe/pwrp_env.sh ]; then
echo "Not a base directory: $baseroot"
return
fi
source $baseroot/$os/$hw/exp/exe/pwrp_env.sh set baseroot $baseroot
fi
return
fi
cmd="project"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
# Command is "set project"
project=$2
basename=`eval cat $pwra_db/pwr_projectlist.dat | grep "^"$project"\b" | awk '{print $2}'`
basename=${basename//\./\\.}
if [ -z $basename ]; then
echo "Unable to find project '$2'"
return
fi
baseroot=`eval cat $pwra_db/pwr_projectlist.dat | grep "\b"$basename"\b" | grep "\b"base"\b" | awk '{print $3}'`
if [ -z $baseroot ]; then
echo "Unable to find base '$2'"
return
fi
baseroot=${baseroot%/}
if [ ! -e "$baseroot" ]; then
echo "Base $baseroot doesn't exist"
else
if [ ! -e $baseroot/$os/$hw/exp/exe/pwrp_env.sh ]; then
echo "Not a base directory: $baseroot"
return
fi
source $baseroot/$os/$hw/exp/exe/pwrp_env.sh set baseroot $baseroot
source $baseroot/$os/$hw/exp/exe/pwrp_env.sh set project $project
export PS1='\u@\h/$pwrp_projectname/-.\W> '
fi
return
fi
if [ -z $pwr_exe ]; then
echo "No project is defined"
return
fi
source $pwr_exe/pwrp_env.sh set $1 $2 $3
}
pwra_help_func()
{
source $pwr_exe/pwrp_env.sh $@
cat << EOF
pwra_env.sh - Utilities for pwr project environment
help - Display help
set base 'distribution' - Setup environment to proview base distribution
set baseroot 'root' - Setup environment to proview base distribution
EOF
}
pwra_parse ()
{
unamestr=`eval uname`
machine=`eval uname -m`
if [ $unamestr == "Darwin" ]; then
os="os_macos"
hw="hw_x86_64"
elif [ $unamestr == "FreeBSD" ]; then
os="os_freebsd"
hw="hw_x86_64"
else
if [ $machine != "x86_64" ]; then
machine="x86"
fi
os="os_linux"
hw="hw_"$machine
fi
local cmd
cmd="help"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
pwra_help_func $2 $3
return
fi
cmd="set"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
pwra_set_func $2 $3
return
fi
if [ -z $pwr_exe ]; then
echo "No project is defined"
return
fi
source $pwr_exe/pwrp_env.sh $@
}
pwra_parse $@
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
umask 022
# the rest of this file is commented out.
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
# set PATH so it includes user's private bin if it exists
#if [ -d ~/bin ] ; then
# PATH=~/bin:"${PATH}"
#fi
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files for examples
source /etc/pwrp_profile
# If running interactively, then:
if [ "$PS1" ]; then
# enable color support of ls and also add handy aliases
eval `dircolors -b`
alias ls='ls --color=auto'
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
# set a fancy prompt
PS1='\u@\h:\w\$ '
# If this is an xterm set the title to user@host:dir
#case $TERM in
#xterm*)
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# ;;
#*)
# ;;
#esac
fi
!!
!! Root Menu Description for operator
!!
Menu DefaultRootMenu
{
"Operator Menu" f.title
"XTT OP-bilder" f.exec "~/.xtt_start &"
! "XTT" f.exec "~/.xtt_start &"
! "RTT" f.exec "/usr/bin/X11/xterm -T RTT -e ~/.rtt_start &"
"Xterm" f.exec "/usr/bin/X11/xterm -T XTerm -sb -right &"
"Klocka" f.exec "/usr/bin/X11/xclock &"
"Miniraknare" f.exec "/usr/bin/X11/xcalc &"
! "Shuffle Up" f.circle_up
! "Shuffle Down" f.circle_down
"Refresh" f.refresh
! "Pack Icons" f.pack_icons
! "Toggle Behavior..." f.set_behavior
no-label f.separator
! "Starta om X" f.restart
"Logga ut" f.quit_mwm
"Starta om dator" f.exec "/usr/bin/rebootreq &"
"Stang av dator" f.exec "/usr/bin/haltreq &"
}
!!
!! Default Window Menu
!!
Menu DefaultWindowMenu
{
"Make Pinned" f.toggle_pin_state
no-label f.separator
Restore _R Alt<Key>F5 f.restore
Move _M Alt<Key>F7 f.move
Size _S Alt<Key>F8 f.resize
Minimize _n Alt<Key>F9 f.minimize
Maximize _x Alt<Key>F10 f.maximize
Raise _a Alt<Key>F2 f.raise
Lower _L Alt<Key>F3 f.lower
no-label f.separator
Close _C Alt<Key>F4 f.kill
}
!!
!! Default Key Bindings
!!
Keys DefaultKeyBindings
{
Shift<Key>Escape window|icon f.post_wmenu
Alt<Key>space window|icon f.post_wmenu
Alt<Key>Tab root|icon|window f.next_key
Alt Shift<Key>Tab root|icon|window f.prev_key
Alt<Key>Escape root|icon|window f.circle_down
Alt Shift<Key>Escape root|icon|window f.circle_up
Alt Shift Ctrl<Key>exclam root|icon|window f.set_behavior
Alt<Key>F6 window f.next_key transient
Alt Shift<Key>F6 window f.prev_key transient
Shift<Key>F10 icon f.post_wmenu
Alt Shift<Key>Delete root|icon|window f.restart
}
!!
!! Button Binding Description(s)
!!
!! These can be used anywhere
!!
Buttons DefaultButtonBindings
{
<Btn1Down> icon|frame f.raise
<Btn3Down> icon|frame f.post_wmenu
<Btn3Down> root f.menu DefaultRootMenu
}
!!
!! These are some example bindings that you might use if your
!! keyboardFocusPolicy is "explicit". Note that to use these, you'll
!! have to change the Mwm*buttonBindings resource in Mwm to
!! ExplicitButtonBindings instead of DefaultButtonBindings.
!!
Buttons ExplicitButtonBindings
{
<Btn1Down> frame|icon f.raise
<Btn3Down> frame|icon f.post_wmenu
<Btn3Down> root f.menu DefaultRootMenu
! <Btn1Up> icon f.restore
Alt<Btn1Down> window|icon f.lower
! Alt<Btn2Down> window|icon f.resize
! Alt<Btn3Down> window|icon f.move
}
!! These are some example bindings that you might use if your
!! keyboardFocusPolicy is "pointer". Note that to use these, you'll
!! have to change the Mwm*buttonBindings resource in Mwm to
!! PointerButtonBindings instead of DefaultButtonBindings.
!!
Buttons PointerButtonBindings
{
<Btn1Down> frame|icon f.raise
<Btn3Down> frame|icon f.post_wmenu
<Btn3Down> root f.menu DefaultRootMenu
<Btn1Down> window f.raise
! <Btn1Up> icon f.restore
Alt<Btn1Down> window|icon f.lower
! Alt<Btn2Down> window|icon f.resize
! Alt<Btn3Down> window|icon f.move
}
!include-menu-defs
#Automatically generated file. Do not edit (see /usr/doc/menu/html/index.html)
Menu "/Debian/Apps/Editors"
{
"Editors" f.title
"Emacs 20" f.exec "/usr/bin/emacs20 &"
"NEdit" f.exec "/usr/bin/X11/nedit &"
"Xedit" f.exec "xedit &"
}
Menu "/Debian/Apps/Graphics"
{
"Graphics" f.title
"Bitmap" f.exec "bitmap &"
}
Menu "/Debian/Apps/Math"
{
"Math" f.title
"Xcalc" f.exec "xcalc &"
"bc" f.exec "x-terminal-emulator -T 'bc' -e /usr/bin/bc &"
"dc" f.exec "x-terminal-emulator -T 'dc' -e /usr/bin/dc &"
}
Menu "/Debian/Apps/Net"
{
"Net" f.title
"Lynx" f.exec "x-terminal-emulator -T 'Lynx' -e /usr/bin/lynx &"
"Telnet" f.exec "x-terminal-emulator -T 'Telnet' -e telnet &"
"Xbiff" f.exec "xbiff &"
}
Menu "/Debian/Apps/Programming"
{
"Programming" f.title
"Gdb" f.exec "x-terminal-emulator -T 'Gdb' -e /usr/bin/gdb &"
"Python (v2.1)" f.exec "x-terminal-emulator -T 'Python (v2.1)' -e /usr/bin/python2.1 &"
"Tclsh8.0" f.exec "x-terminal-emulator -T 'Tclsh8.0' -e /usr/bin/tclsh8.0 &"
"Tclsh8.2" f.exec "x-terminal-emulator -T 'Tclsh8.2' -e /usr/bin/tclsh8.2 &"
"Tclsh8.3" f.exec "x-terminal-emulator -T 'Tclsh8.3' -e /usr/bin/tclsh8.3 &"
"TkWish8.0" f.exec "x-terminal-emulator -T 'TkWish8.0' -e /usr/bin/wish8.0 &"
"TkWish8.3" f.exec "/usr/bin/wish8.3 &"
}
Menu "/Debian/Apps/Shells"
{
"Shells" f.title
"Bash" f.exec "x-terminal-emulator -T 'Bash' -e /bin/bash -login &"
"Sh" f.exec "x-terminal-emulator -T 'Sh' -e /bin/sh -login &"
"Tcsh" f.exec "x-terminal-emulator -T 'Tcsh' -e /usr/bin/tcsh &"
}
Menu "/Debian/Apps/System/Admin"
{
"Admin" f.title
"Lilo-config" f.exec "x-terminal-emulator -T 'Lilo-config' -e /usr/sbin/su-to-root -p root -c /usr/sbin/liloconfig &"
"gpm-config" f.exec "x-terminal-emulator -T 'gpm-config' -e /usr/sbin/su-to-root -p root -c /usr/sbin/gpmconfig &"
}
Menu "/Debian/Apps/System"
{
"System" f.title
"Admin" f.menu "/Debian/Apps/System/Admin"
"Task selector" f.exec "x-terminal-emulator -T 'Task selector' -e su-to-root /usr/bin/tasksel &"
"Top" f.exec "x-terminal-emulator -T 'Top' -e /usr/bin/top &"
"Xconsole" f.exec "xconsole &"
"Xload" f.exec "xload &"
"Xvidtune" f.exec "xvidtune &"
"pstree" f.exec "/etc/alternatives/x-terminal-emulator -e /usr/bin/pstree.x11 &"
}
Menu "/Debian/Apps/Tools"
{
"Tools" f.title
"Editres" f.exec "editres &"
"Oclock" f.exec "oclock &"
"X Window Snapshot" f.exec "xwd | xwud &"
"Xclipboard" f.exec "xclipboard &"
"Xclock (analog)" f.exec "xclock -analog &"
"Xclock (digital)" f.exec "xclock -digital -update 1 &"
"Xcutsel" f.exec "xcutsel &"
"Xev" f.exec "x-terminal-emulator -e xev &"
"Xfontsel" f.exec "xfontsel &"
"Xkill" f.exec "xkill &"
"Xmag" f.exec "xmag &"
"Xrefresh" f.exec "xrefresh &"
}
Menu "/Debian/Apps/Viewers"
{
"Viewers" f.title
"GV" f.exec "/usr/bin/X11/gv &"
"XDvi" f.exec "/usr/bin/xdvi &"
"Xditview" f.exec "xditview &"
}
Menu "/Debian/Apps"
{
"Apps" f.title
"Editors" f.menu "/Debian/Apps/Editors"
"Graphics" f.menu "/Debian/Apps/Graphics"
"Math" f.menu "/Debian/Apps/Math"
"Net" f.menu "/Debian/Apps/Net"
"Programming" f.menu "/Debian/Apps/Programming"
"Shells" f.menu "/Debian/Apps/Shells"
"System" f.menu "/Debian/Apps/System"
"Tools" f.menu "/Debian/Apps/Tools"
"Viewers" f.menu "/Debian/Apps/Viewers"
}
Menu "/Debian/Games/Toys"
{
"Toys" f.title
"Xeyes" f.exec "xeyes &"
"Xlogo" f.exec "xlogo &"
}
Menu "/Debian/Games"
{
"Games" f.title
"Toys" f.menu "/Debian/Games/Toys"
}
Menu "/Debian/Help"
{
"Help" f.title
"Info" f.exec "x-terminal-emulator -T 'Info' -e info &"
"Xman" f.exec "xman &"
}
Menu "/Debian/Screen/Root-window"
{
"Root-window" f.title
"Xsetroot" f.exec "xsetroot &"
}
Menu "/Debian/Screen/Save"
{
"Save" f.title
"Beforelight" f.exec "beforelight &"
}
Menu "/Debian/Screen"
{
"Screen" f.title
"Root-window" f.menu "/Debian/Screen/Root-window"
"Save" f.menu "/Debian/Screen/Save"
}
Menu "/Debian/XShells"
{
"XShells" f.title
"XTerm" f.exec "xterm &"
"XTerm (Unicode)" f.exec "uxterm &"
}
Menu "/Debian"
{
"Debian" f.title
"Apps" f.menu "/Debian/Apps"
"Games" f.menu "/Debian/Games"
"Help" f.menu "/Debian/Help"
"Screen" f.menu "/Debian/Screen"
"XShells" f.menu "/Debian/XShells"
}
#!/bin/bash
ource /etc/pwrp_profile
$pwr_exe/rt_rtt
xsetroot -solid darkcyan
xhost +localhost
~/.xtt_start
xset s off s noblank s noexpose -dpms
exec mwm
#!/bin/bash
source /etc/pwrp_profile
$pwr_exe/rt_xtt -u $USER -a &
#!/bin/bash
aroot="/usr/pwrp/adm"
# Get version
if [ -e $pwr_inc/pwr_version.h ]; then
ver=`eval cat $pwr_inc/pwr_version.h | grep "\bpwrv_cWbdbVersionShortStr\b" | awk '{print $3}'`
if [ -z $ver ]; then
echo "Unable to get pwr version"
ver="V00"
fi
ver=${ver:2:2}
fi
# Generate version help file
{
if [ ! -e $pwre_sroot/tools/pkg/deb/pwr/control ]; then
echo "Controlfile not found"
exit 1
fi
datfile=$pwre_sroot/tools/pkg/deb/pwr/control
echo "<topic> version"
d=`eval date +\"%F %X\"`
{
let printout=0
while read line; do
if [ "${line:0:9}" = "Package: " ]; then
package=${line#Package: }
fi
if [ "${line:0:9}" = "Version: " ]; then
version=${line#Version: }
fi
if [ "${line:0:14}" = "Architecture: " ]; then
arch=${line#Architecture: }
fi
if [ "${line:0:12}" = "Description:" ]; then
echo ""
echo "<image> pwr_logga.gif"
echo ""
echo ""
echo ""
echo "<b>Proview V${version:0:3}"
echo "Version V$version"
echo ""
echo "Copyright 2004-${d:0:4} SSAB Oxelsund AB"
echo ""
echo "This program is free software; you can redistribute it and/or"
echo "modify it under the terms of the GNU General Public License as"
echo "published by the Free Software Foundation, either version 2 of"
echo "the License, or (at your option) any later version."
echo ""
echo "This program is distributed in the hope that it will be useful"
echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
echo "For more details, see the"
echo "GNU General Public License. <weblink> http://www.proview.se/gpllicense.html"
echo ""
echo "E-mail postmaster@proview.se"
echo "Internet www.proview.se <link> http://www.proview.se/index.html"
echo ""
echo ""
echo "<b>Package"
echo "Package $package""_""$version""_""$arch"
echo "Build date $d"
echo "Package description:"
echo ""
printout=1
else
if [ $printout -eq 1 ]; then
echo $line
fi
fi
done
} < $datfile
echo "</topic>"
} > $pwr_eexe/wtt_version_help.dat
# Convert to html
co_convert -t -d $pwr_doc $pwr_eexe/wtt_version_help.dat
{
echo "<html><head>"
echo "<meta http-equiv=\"Refresh\" content=\"5;../wtt_version_help_version.html\">"
echo "</head></html>"
} > $pwr_doc/en_us/package_version.html
if [ "$1" == "-v" ]; then
exit
fi
pkgroot=$pwre_broot/$pwre_target/bld/pkg/pwr$ver
pkgsrc=$pwre_sroot/tools/pkg/deb/pwr
echo "-- Building pwr$ver"
# Create directories
mkdir -p $pkgroot/DEBIAN
mkdir -p $pkgroot/usr/share/doc/pwr$ver
mkdir -p $pkgroot/usr/pwrp
mkdir -p $pkgroot/etc
find $pkgroot -type d | xargs chmod 755
# control
cp $pkgsrc/control $pkgroot/DEBIAN
echo "#!/bin/bash" > $pkgroot/DEBIAN/postinst
echo "ver=\"$ver\"" >> $pkgroot/DEBIAN/postinst
echo "pwre_target=\"$pwre_target\"" >> $pkgroot/DEBIAN/postinst
cat $pkgsrc/postinst >> $pkgroot/DEBIAN/postinst
chmod a+x $pkgroot/DEBIAN/postinst
cp $pkgsrc/prerm $pkgroot/DEBIAN
# copyright
cp $pkgsrc/copyright $pkgroot/usr/share/doc/pwr$ver
# changelog
cp $pkgsrc/changelog $pkgroot/usr/share/doc/pwr$ver
gzip -fq --best $pkgroot/usr/share/doc/pwr$ver/changelog
# changelog.Debian
cp $pkgsrc/changelog.Debian $pkgroot/usr/share/doc/pwr$ver
gzip -fq --best $pkgroot/usr/share/doc/pwr$ver/changelog.Debian
# Man pages
mkdir -p $pkgroot/usr/share/man/man1
cp $pkgsrc/pwr.1 $pkgroot/usr/share/man/man1/pwr.1
gzip -fq --best $pkgroot/usr/share/man/man1/pwr.1
# Copy proview
mkdir $pkgroot/usr/pwr$ver
currentdir="`eval pwd`"
tarfile=$pwre_broot/$pwre_target/bld/pkg/pwrtmp.tar
cd $pwre_broot
echo "-- copy release to package tree"
tar -cf $tarfile $pwre_target/exp
cd $pkgroot/usr/pwr$ver
tar -xf $tarfile
rm $tarfile
cd $currentdir
# Remove not needed libraries
rm $pkgroot/usr/pwr$ver/$pwre_target/exp/lib/libpwr_flow.a
rm $pkgroot/usr/pwr$ver/$pwre_target/exp/lib/libpwr_ge.a
rm $pkgroot/usr/pwr$ver/$pwre_target/exp/lib/libpwr_glow.a
rm $pkgroot/usr/pwr$ver/$pwre_target/exp/lib/libpwr_tlog.a
rm $pkgroot/usr/pwr$ver/$pwre_target/exp/lib/libpwr_wb.a
rm $pkgroot/usr/pwr$ver/$pwre_target/exp/lib/libpwr_xtt.a
# Copy configuration files to cnf
cp $pkgsrc/proview.cnf $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
cp $pkgsrc/pwrp_profile $pkgroot/etc
chmod a+x $pkgroot/etc/pwrp_profile
# Copy adm files to cnf
cp $pwre_sroot/tools/pkg/deb/adm/pwr_setup.sh $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
echo "pwrp set base V${ver:0:1}.${ver:1:1}" >> $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/pwr_setup.sh
chmod a+x $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/pwr_setup.sh
cp $pwre_sroot/tools/pkg/deb/adm/pwra_env.sh $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
chmod a+x $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/pwra_env.sh
cp $pwre_sroot/tools/pkg/deb/adm/pwr_volumelist.dat $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
cp $pwre_sroot/tools/pkg/deb/adm/pwr_user2.dat $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
cp $pwre_sroot/tools/pkg/deb/adm/proview_icon.png $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf
# Copy user to cnf
mkdir $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.bashrc $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
echo "source $aroot/db/pwr_setup.sh" >> $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user/.bashrc
cp $pwre_sroot/tools/pkg/deb/user/.bash_profile $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
#cp $pwre_sroot/tools/pkg/deb/user/.mwmrc $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.rtt_start $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.xtt_start $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
#cp $pwre_sroot/tools/pkg/deb/user/.xsession $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/wtt_init.pwr_com $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/wtt_init1.pwr_com $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user
# Generate desktop file
{
echo "[Desktop Entry]"
echo "Version=1.0"
echo "Encoding=UTF-8"
echo "Name=Proview V${version:0:3}"
echo "Type=Application"
echo "Comment=Start Proview"
echo "Exec=xterm -title \"Proview Development Console\" -e 'export pwra_db=$aroot/db;source \$pwra_db/pwra_env.sh set base V""${version:0:3}"";source \$pwra_db/pwra_env.sh set bus;wb -p pwrp pwrp'"
echo "Icon=$aroot/db/proview_icon.png"
echo "Categories=GNOME;GTK;Application;"
} > $pkgroot/usr/pwr$ver/$pwre_target/exp/cnf/user/proview$ver.desktop
# Create package
echo "-- Building package"
if which fakeroot > /dev/null; then
fakeroot dpkg -b $pkgroot $pwre_broot/$pwre_target/bld/pkg
else
dpkg -b $pkgroot $pwre_broot/$pwre_target/bld/pkg
fi
rm -r $pkgroot
Proview V3.4b (3.4.1-1)
\ No newline at end of file
Proview. See also normal changelog file.
\ No newline at end of file
Package: pwr46
Version: 4.6.1-1
Section: base
Priority: optional
Architecture: i386
Depends: libc6 (>= 2.7-18), libgtk2.0-0 (>= 2.12.12-1~lenny1), libasound2 (>= 1.0.16-2), libdb4.6 (>=4.6.21-11), libdb4.6++ (>= 4.6.21-11), libmysqlclient15off (>= 5.0.51a-24+lenny1), g++ (>= 4:4.3.2-2)
Replaces: pwrrt,pwr34,pwr39,pwr40,pwr41,pwr42,pwr43,pwr44,pwr45
Maintainer: Proview <postmaster@proview.se>
Description: Proview development and runtime environment package
Proview development and runtime environment
4.6.1-1 Base release
Proview
Copyright: SSAB Oxelsund AB <ssabox.com>
2003-11-21
The home page of Proview is at:
http://www.proview.se
#!/bin/sh
set -e
# ver=""
# pwre_target=""
echo "Here in postinst..."
# Automatically added by dh_installdocs
if [ "$1" = "configure" ]; then
if [ -d /usr/doc -a ! -e /usr/doc/pwrtest -a -d /usr/share/doc/pwrtest ]; then
ln -sf ../share/doc/pwrtest /usr/doc/pwrtest
fi
fi
# End automatically added section
aroot="/usr/pwrp/adm"
if getent group pwrp > /dev/null; then
echo "-- group pwrp already exist"
else
if groupadd pwrp; then
echo "-- group pwrp added"
fi
fi
if getent passwd pwrp > /dev/null; then
echo "-- user pwrp already exist"
else
new_user=1
if useradd -s /bin/bash -p aaupl/kQs1p3U -g pwrp -d /home/pwrp pwrp; then
echo "-- user pwrp added"
fi
if [ ! -e /home/pwrp ]; then
mkdir /home/pwrp
fi
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.bashrc /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.bash_profile /home/pwrp
# cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.mwmrc /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.rtt_start /home/pwrp
chmod a+x /home/pwrp/.rtt_start
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.xtt_start /home/pwrp
chmod a+x /home/pwrp/.xtt_start
# cp /usr/pwr$ver/$pwre_target/exp/cnf/user/.xsession /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/wtt_init.pwr_com /home/pwrp
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/wtt_init1.pwr_com /home/pwrp
chown -R pwrp /home/pwrp
chgrp -R pwrp /home/pwrp
fi
if [ ! -e /home/pwrp/Desktop ]; then
mkdir /home/pwrp/Desktop
fi
cp /usr/pwr$ver/$pwre_target/exp/cnf/user/proview$ver.desktop /home/pwrp/Desktop
chown pwrp:pwrp /home/pwrp/Desktop/proview$ver.desktop
chmod a+x /home/pwrp/Desktop/proview$ver.desktop
echo "Change owner of files to pwrp"
chown -R pwrp /usr/pwr$ver
chgrp -R pwrp /usr/pwr$ver
chmod u+s /usr/pwr$ver/$pwre_target/exp/exe/rt_ini
chmod u+s /usr/pwr$ver/$pwre_target/exp/exe/rt_rtt
chmod u+s /usr/pwr$ver/$pwre_target/exp/exe/rt_xtt
chmod u+s /usr/pwr$ver/$pwre_target/exp/exe/rt_bck
# Copy configuration files
new_cnf=0
if [ ! -e /etc/proview.cnf ]; then
cp /usr/pwr$ver/$pwre_target/exp/cnf/proview.cnf /etc
new_cnf=1
fi
# Add pwrp_profile to profile
if ! grep -q "/etc/pwrp_profile\b" /etc/profile; then
cat >> /etc/profile <<-EOF
if [ -e /etc/pwrp_profile ]; then
source /etc/pwrp_profile
fi
EOF
fi
# Create and copy adm
if [ ! -e $aroot/db ]; then
mkdir -p $aroot/db
fi
cp /usr/pwr$ver/$pwre_target/exp/cnf/pwra_env.sh $aroot/db
cp /usr/pwr$ver/$pwre_target/exp/cnf/pwr_setup.sh $aroot/db
cp /usr/pwr$ver/$pwre_target/exp/cnf/proview_icon.png $aroot/db
if [ ! -e $aroot/db/pwr_volumelist.dat ]; then
cp /usr/pwr$ver/$pwre_target/exp/cnf/pwr_volumelist.dat $aroot/db
fi
if [ ! -e $aroot/db/pwr_user2.dat ]; then
cp /usr/pwr$ver/$pwre_target/exp/cnf/pwr_user2.dat $aroot/db
fi
# Insert base in projectlist
if [ ! -e $aroot/db/pwr_projectlist.dat ]; then
echo "%base V${ver:0:1}.${ver:1:1} /usr/pwr$ver" > $aroot/db/pwr_projectlist.dat
else
set +e
ptst=`eval grep "^%base" $aroot/db/pwr_projectlist.dat | grep "\bV${ver:0:1}.${ver:1:1}\b"`
set -e
if [ "$ptst" = "" ]; then
echo "%base V${ver:0:1}.${ver:1:1} /usr/pwr$ver" >> $aroot/db/pwr_projectlist.dat
fi
fi
# Change group to pwrp
chgrp pwrp $aroot
chmod g+w $aroot
chgrp -R pwrp $aroot/*
chmod -R g+w $aroot/*
chmod a+w /usr/pwr$ver/$pwre_target/exp/load/*.dbs
# Create project root
if [ ! -e /usr/local/pwrp ]; then
mkdir /usr/local/pwrp
chgrp pwrp /usr/local/pwrp
chmod g+w /usr/local/pwrp
fi
#!/bin/sh
set -e
echo "Here in prerm..."
# Automatically added by dh_installdocs
if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/pwrtest ]; then
rm -f /usr/doc/pwrtest
fi
# End automatically added section
#
# Configuration file for Proview
#
# Default QCOM Bus Id
#
qcomBusId 999
#
# Web directory
#
webDirectory /var/www
#
# Default privileges for SevXtt: Read, Admin or None
#
sevXttDefaultPriv Read
PWR(1) Proview Manuals PWR(1)
NAME
pwr - start and stop Proview runtime environment
SYNOPSIS
pwr [start][stop]
DESCRIPTION
Start and stop command for Proview runtime environment.
OPTIONS
start Start Proview runtime environment.
stop Stop Proview runtime environment.
FILES
/etc/pwrp_profile
The system wide configuration file..
AUTHOR
Written by CS.
SEE ALSO
pwr(5)
Proview Last change: Nov 2003
bus_id=""
if [ -e /etc/proview.cnf ]; then
bus_id=`eval cat /etc/proview.cnf | grep "\\bqcomBusId\\b" | awk '{print $2}'`
fi
if [ -e /etc/proview.cnf ]; then
web_dir=`eval cat /etc/proview.cnf | grep "\\bwebDirectory\\b" | awk '{print $2}'`
fi
export PWR_BUS_ID=$bus_id
export pwrb_root=/usr/pwrrt
export pwrp_root=/pwrp
export pwr_exe=$pwrb_root/exe
export pwr_lib=$pwrb_root/lib
export pwr_obj=$pwrb_root/obj
export pwr_inc=$pwrb_root/inc
export pwr_load=$pwrb_root/load
export pwr_lis=$pwrb_root/lis
export pwrp_exe=$pwrp_root/x86_linux/exe
export pwrp_lib=$pwrp_root/x86_linux/lib
export pwrp_obj=$pwrp_root/x86_linux/obj
export pwrp_lis=$pwrp_root/x86_linux/lis
export pwrp_inc=$pwrp_root/common/inc
export pwrp_load=$pwrp_root/common/load
export pwrp_log=$pwrp_root/common/log
export pwrp_db=$pwrp_root/common/db
export pwrp_web=$web_dir
export pwra_db=/usr/pwrp/adm/db
jdk=`eval ls /usr/local | grep ^jre`
export jdk_home=/usr/local/$jdk/bin
PATH=$PATH:$pwr_exe:$pwrp_exe:$jdk_home
#Set display to remote computer
export DISPLAY=$REMOTEHOST:0.0
#symbols to define start/stop commands for PWR
alias pwr_stop='/etc/init.d/pwr stop'
alias pwr_stop.sh="/etc/init.d/pwr stop"
alias pwr_start="/etc/init.d/pwr start"
alias pwr="/etc/init.d/pwr"
alias boot="/usr/bin/sudo /sbin/reboot"
#!/bin/bash
aroot="/usr/pwrp/adm"
# Get version
if [ -e $pwr_inc/pwr_version.h ]; then
ver=`eval cat $pwr_inc/pwr_version.h | grep "\bpwrv_cWbdbVersionShortStr\b" | awk '{print $3}'`
if [ -z $ver ]; then
echo "Unable to get pwr version"
ver="V00"
fi
ver=${ver:2:2}
fi
proot=/data0/pwrp/pwrdemo$ver
pkgroot=$pwre_broot/$pwre_target/bld/pkg/pwrdemo$ver
pkgsrc=$pwre_sroot/tools/pkg/deb/pwrdemo
echo "-- Building pwrdemo$ver"
# Create directories
mkdir -p $pkgroot/DEBIAN
mkdir -p $pkgroot/usr/share/doc/pwrdemo$ver
mkdir -p $pkgroot/usr/pwrp
find $pkgroot -type d | xargs chmod 755
# control
cp $pkgsrc/control $pkgroot/DEBIAN
echo "#!/bin/bash" > $pkgroot/DEBIAN/postinst
echo "ver=\"$ver\"" >> $pkgroot/DEBIAN/postinst
echo "pwre_target=\"$pwre_target\"" >> $pkgroot/DEBIAN/postinst
cat $pkgsrc/postinst >> $pkgroot/DEBIAN/postinst
chmod a+x $pkgroot/DEBIAN/postinst
echo "#!/bin/sh" > $pkgroot/DEBIAN/prerm
echo "ver=\"$ver\"" >> $pkgroot/DEBIAN/prerm
cat $pkgsrc/prerm >> $pkgroot/DEBIAN/prerm
chmod a+x $pkgroot/DEBIAN/prerm
# copyright
cp $pkgsrc/copyright $pkgroot/usr/share/doc/pwrdemo$ver
# changelog
cp $pkgsrc/changelog $pkgroot/usr/share/doc/pwrdemo$ver
gzip -fq --best $pkgroot/usr/share/doc/pwrdemo$ver/changelog
# changelog.Debian
cp $pkgsrc/changelog.Debian $pkgroot/usr/share/doc/pwrdemo$ver
gzip -fq --best $pkgroot/usr/share/doc/pwrdemo$ver/changelog.Debian
# Man pages
# Copy pwrdemo
mkdir $pkgroot/usr/pwrp/pwrdemo$ver
mkdir $pkgroot/usr/pwrp/pwrdemo$ver/cnf
currentdir="`eval pwd`"
tarfile=$pwre_broot/$pwre_target/bld/pkg/pwrtmp.tar
cd $proot
cd ..
echo "-- copy project to package tree"
tar -cf $tarfile pwrdemo$ver
cd $pkgroot/usr/pwrp
tar -xf $tarfile
rm $tarfile
cd $currentdir
# Generate desktop file
{
echo "[Desktop Entry]"
echo "Version=1.0"
echo "Encoding=UTF-8"
echo "Name=Proview Demo"
echo "Type=Application"
echo "Comment=Start Proview Demo"
echo "Exec=xterm -title \"Proview Demo Console\" -e 'export pwra_db=$aroot/db;source \$pwra_db/pwr_setup.sh;source \$pwra_db/pwra_env.sh set project pwrdemo""$ver"";export PWR_BUS_ID=999;pwr_rtmon'"
echo "Icon=$aroot/db/proview_icon.png"
echo "Categories=GNOME;GTK;Application;"
} > $pkgroot/usr/pwrp/pwrdemo$ver/cnf/proviewdemo$ver.desktop
# Create package
echo "-- Building package"
if which fakeroot > /dev/null; then
fakeroot dpkg -b $pkgroot $pwre_broot/$pwre_target/bld/pkg
else
dpkg -b $pkgroot $pwre_broot/$pwre_target/bld/pkg
fi
rm -r $pkgroot
Proview V3.4b (3.4.1-1)
\ No newline at end of file
Proview. See also normal changelog file.
\ No newline at end of file
Package: pwrdemo46
Version: 4.6.1-1
Section: base
Priority: optional
Architecture: i386
Depends: pwr46 (>= 4.6.1-1)
Maintainer: Proview <postmaster@proview.se>
Description: Proview Demo Project package
Proview Demo Project
4.6.1-1 Base release
Proview
Copyright: SSAB Oxelsund AB <ssabox.com>
2003-11-21
The home page of Proview is at:
http://www.proview.se
set -e
# Added by build.sh :
# ver=""
# pwre_target=""
#
echo "Here in postinst..."
# Automatically added by dh_installdocs
if [ "$1" = "configure" ]; then
if [ -d /usr/doc -a ! -e /usr/doc/pwrtest -a -d /usr/share/doc/pwrtest ]; then
ln -sf ../share/doc/pwrtest /usr/doc/pwrtest
fi
fi
# End automatically added section
aroot="/usr/pwrp/adm"
export pwra_db=$aroot/db
echo "Change owner of files to pwrp"
chown -R pwrp:pwrp /usr/pwrp/pwrdemo$ver
# Register volume
if [ -e $aroot/db/pwr_volumelist.dat ]; then
set +e
ptst=`eval grep "'\bVolPwrDemo\b'" $aroot/db/pwr_volumelist.dat | grep "\bpwrdemo\b"`
set -e
if [ "$ptst" = "" ]; then
echo " VolPwrDemo 0.254.254.200 pwrdemo" >> $aroot/db/pwr_volumelist.dat
fi
fi
# Insert base in projectlist
if [ -e $aroot/db/pwr_projectlist.dat ]; then
set +e
ptst=`eval grep "'\bpwrdemo$ver\b'" $aroot/db/pwr_projectlist.dat`
set -e
if [ "$ptst" = "" ]; then
echo "pwrdemo$ver V${ver:0:1}.${ver:1:1} /usr/pwrp/pwrdemo$ver pwrdemo$ver \"\" " >> $aroot/db/pwr_projectlist.dat
fi
fi
# Insert nodename in DirectoryVolume and create bootfile
nodename=`eval uname -n`
initsh=/tmp/pwrdemo_init.sh
initpwrc=/tmp/pwrdemo_init.pwr_com
# Create a shellscript that attaches to projects and runs wb_cmd
cat > $initsh <<EOF
#!/bin/bash
source $aroot/db/pwr_setup.sh
source \$pwr_exe/pwrp_env.sh set project pwrdemo$ver
wb_cmd @$initpwrc
EOF
chmod a+x $initsh
# Create a wb_cmd script that inserts nodename and creates bootfile
cat > $initpwrc <<EOF
set attr/name=Bus999-DemoNode/attr=NodeName/value="$nodename"/noconf
save
create boot/node=DemoNode
exit
EOF
# Execute shellscript
sudo -u pwrp $initsh
rm $initsh
rm $initpwrc
if [ -e /home/pwrp/Desktop ]; then
cp /usr/pwrp/pwrdemo$ver/cnf/proviewdemo$ver.desktop /home/pwrp/Desktop/
chown pwrp:pwrp /home/pwrp/Desktop/proviewdemo$ver.desktop
chmod a+x /home/pwrp/Desktop/proviewdemo$ver.desktop
fi
#
# ver='version' is added by build.sh
#
set -e
echo "Here in prerm..."
# Automatically added by dh_installdocs
if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/pwrtest ]; then
rm -f /usr/doc/pwrtest
fi
# End automatically added section
if [ -e /usr/pwrp/pwrdemo$ver ]; then
rm -r /usr/pwrp/pwrdemo$ver
fi
#!/bin/bash
# Get version
if [ -e $pwr_inc/pwr_version.h ]; then
ver=`eval cat $pwr_inc/pwr_version.h | grep "\bpwrv_cWbdbVersionShortStr\b" | awk '{print $3}'`
if [ -z $ver ]; then
echo "Unable to get pwr version"
ver="V00"
fi
ver=${ver:2:2}
fi
# Generate version help file
{
if [ ! -e $pwre_sroot/tools/pkg/deb/pwrrt/control ]; then
echo "Controlfile not found"
exit 1
fi
datfile=$pwre_sroot/tools/pkg/deb/pwrrt/control
echo "<topic> version"
d=`eval date +\"%F %X\"`
{
let printout=0
while read line; do
if [ "${line:0:9}" = "Package: " ]; then
package=${line#Package: }
fi
if [ "${line:0:9}" = "Version: " ]; then
version=${line#Version: }
fi
if [ "${line:0:14}" = "Architecture: " ]; then
arch=${line#Architecture: }
fi
if [ "${line:0:12}" = "Description:" ]; then
echo ""
echo "<image> pwr_logga.gif"
echo ""
echo ""
echo ""
echo "<b>Proview V${version:0:3}"
echo "Version V$version"
echo ""
echo "Copyright 2004-${d:0:4} SSAB Oxelsund AB"
echo ""
echo "This program is free software; you can redistribute it and/or"
echo "modify it under the terms of the GNU General Public License as"
echo "published by the Free Software Foundation, either version 2 of"
echo "the License, or (at your option) any later version."
echo ""
echo "This program is distributed in the hope that it will be useful"
echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
echo "For more details, see the"
echo "GNU General Public License. <weblink> http://www.proview.se/gpllicense.html"
echo ""
echo "E-mail postmaster@proview.se <weblink> mailto:postmaster@proview.se"
echo "Internet www.proview.se <weblink> http://www.proview.se"
echo ""
echo ""
echo "<b>Package"
echo "Package $package""_""$version""_""$arch"
echo "Build date $d"
echo "Package description:"
echo ""
printout=1
else
if [ $printout -eq 1 ]; then
echo $line
fi
fi
done
} < $datfile
echo "</topic>"
} > $pwr_eexe/xtt_version_help.dat
# Convert to html
co_convert -t -d $pwr_doc $pwr_eexe/xtt_version_help.dat
{
echo "<html><head>"
echo "<meta http-equiv=\"Refresh\" content=\"5;../xtt_version_help_version.html\">"
echo "</head></html>"
} > $pwr_doc/en_us/package_version.html
# Print rt version file
echo "Version: $version" > $pwr_eexe/rt_version.dat
if [ "$1" == "-v" ]; then
exit
fi
pkgroot=$pwre_broot/$pwre_target/bld/pkg/pwrrt
pkgsrc=$pwre_sroot/tools/pkg/deb/pwrrt
# Create directories
echo "-- Create package tree"
mkdir -p $pkgroot/DEBIAN
mkdir -p $pkgroot/usr/share/doc/pwrrt
mkdir -p $pkgroot/etc/init.d
find $pkgroot -type d | xargs chmod 755
# control
cp $pkgsrc/control $pkgroot/DEBIAN
cp $pkgsrc/postinst $pkgroot/DEBIAN
cp $pkgsrc/prerm $pkgroot/DEBIAN
# copyright
cp $pkgsrc/copyright $pkgroot/usr/share/doc/pwrrt
# changelog
cp $pkgsrc/changelog $pkgroot/usr/share/doc/pwrrt
gzip -fq --best $pkgroot/usr/share/doc/pwrrt/changelog
# changelog.Debian
cp $pkgsrc/changelog.Debian $pkgroot/usr/share/doc/pwrrt
gzip -fq --best $pkgroot/usr/share/doc/pwrrt/changelog.Debian
# Startup files
cp $pkgsrc/pwrp_profile $pkgroot/etc
chmod a+x $pkgroot/etc/pwrp_profile
cp $pkgsrc/pwr $pkgroot/etc/init.d
chmod a+x $pkgroot/etc/init.d/pwr
#cp $pkgsrc/gdhserver $pkgroot/etc/init.d
#chmod a+x $pkgroot/etc/init.d/gdhserver
# Man pages
mkdir -p $pkgroot/usr/share/man/man1
cp $pkgsrc/pwr.1 $pkgroot/usr/share/man/man1/pwr.1
gzip -fq --best $pkgroot/usr/share/man/man1/pwr.1
cp $pkgsrc/rt_ini.1 $pkgroot/usr/share/man/man1/rt_ini.1
gzip -fq --best $pkgroot/usr/share/man/man1/rt_ini.1
cp $pkgsrc/rt_xtt.1 $pkgroot/usr/share/man/man1/rt_xtt.1
gzip -fq --best $pkgroot/usr/share/man/man1/rt_xtt.1
cp $pkgsrc/rt_rtt.1 $pkgroot/usr/share/man/man1/rt_rtt.1
gzip -fq --best $pkgroot/usr/share/man/man1/rt_rtt.1
# Copy proview
mkdir $pkgroot/usr/pwrrt
currentdir="`eval pwd`"
tarfile=$pwre_broot/$pwre_target/bld/pkg/pwrtmp.tar
cd $pwre_broot/$pwre_target/exp
echo "-- Copy release to package tree"
tar -cf $tarfile *
cd $pkgroot/usr/pwrrt
tar -xf $tarfile
rm $tarfile
rm -r $pkgroot/usr/pwrrt/lib/*.a
rm -r $pkgroot/usr/pwrrt/exe/wb*
cp $pwr_eexe/wb_distr_keepboot.sh $pkgroot/usr/pwrrt/exe
cd $currentdir
# Copy configuration files to cnf
cp $pkgsrc/proview.cnf $pkgroot/usr/pwrrt/cnf
# Copy op to cnf
mkdir $pkgroot/usr/pwrrt/cnf/op
cp $pwre_sroot/tools/pkg/deb/op/.bashrc $pkgroot/usr/pwrrt/cnf/op
cp $pwre_sroot/tools/pkg/deb/op/.bash_profile $pkgroot/usr/pwrrt/cnf/op
#cp $pwre_sroot/tools/pkg/deb/op/.mwmrc $pkgroot/usr/pwrrt/cnf/op
cp $pwre_sroot/tools/pkg/deb/op/.rtt_start $pkgroot/usr/pwrrt/cnf/op
cp $pwre_sroot/tools/pkg/deb/op/.xtt_start $pkgroot/usr/pwrrt/cnf/op
#cp $pwre_sroot/tools/pkg/deb/op/.xsession $pkgroot/usr/pwrrt/cnf/op
# Copy user to cnf
mkdir $pkgroot/usr/pwrrt/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.bashrc $pkgroot/usr/pwrrt/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.bash_profile $pkgroot/usr/pwrrt/cnf/user
#cp $pwre_sroot/tools/pkg/deb/user/.mwmrc $pkgroot/usr/pwrrt/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.rtt_start $pkgroot/usr/pwrrt/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.xtt_start $pkgroot/usr/pwrrt/cnf/user
#cp $pwre_sroot/tools/pkg/deb/user/.xsession $pkgroot/usr/pwrrt/cnf/user
# Create package
echo "-- Building package"
if which fakeroot > /dev/null; then
fakeroot dpkg -b $pkgroot $pwre_broot/$pwre_target/bld/pkg
else
dpkg -b $pkgroot $pwre_broot/$pwre_target/bld/pkg
fi
rm -r $pkgroot
Proview V3.4b (3.4.1-1)
\ No newline at end of file
Proview. See also normal changelog file.
\ No newline at end of file
Package: pwrrt
Version: 4.6.1-1
Section: base
Priority: optional
Architecture: i386
Depends: libc6 (>= 2.7-18), libgtk2.0-0 (>= 2.12.12-1~lenny1), libasound2 (>= 1.0.16-2), libdb4.6 (>=4.6.21-11)
Replaces: pwr34,pwr39,pwr40,pwr41,pwr42,pwr43,pwr44,pwr45,pwr46
Maintainer: Proview <postmaster@proview.se>
Description:
Proview runtime environment
4.6.1-1 Base release
Proview
Copyright: SSAB Oxelsund AB <ssabox.com>
2003-11-21
The home page of Proview is at:
http://www.proview.se
#!/bin/bash
#
# Startscript fr PWR av Ulf Ljungdahl
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/jdk1.3/bin/java
. /etc/pwrp_profile
gdh_start()
{
export LD_LIBRARY_PATH=$pwr_exe
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar
sleep 5
sudo -u pwrp $pwr_exe/rt_webmon.sh &
sleep 2
sudo -u pwrp $pwr_exe/rt_webmonmh.sh &
#su pwrp <java jpwr.rt.GdhServer &
#sudo -u pwrp java jpwr.rt.GdhServer &
}
gdh_stop()
{
kill -9 `ps ax | grep "java" | awk '{ print $1}'`
}
case "$1"
in
start)
echo "Startar GDH server..."
#if [ 'test -x ps aux | grep plc | grep -v grep' ]
# then
# echo "PWR kr, stoppar det frst.."
# pwr_stop
# fi
gdh_start
echo "Klar."
;;
stop)
echo "Stoppar GDH server..."
gdh_stop
echo "Klar"
;;
restart)
echo "Startar om GDH server."
echo "Stoppar det frst."
gdh_stop
sleep 1
echo "Startar igen."
gdh_start
echo "Klar."
;;
*)
echo "Usage:{start|stop|restart}" >&2
#echo "Ingen parameter angiven, startar PWR"
#$0 start
exit 1
;;
esac
exit 0
#!/bin/bash
set -e
if [ "$pwrrt_xtrace" != "" ]; then
set -o xtrace
fi
# Automatically added by dh_installdocs
if [ "$1" = "configure" ]; then
if [ -d /usr/doc -a ! -e /usr/doc/pwrtest -a -d /usr/share/doc/pwrtest ]; then
ln -sf ../share/doc/pwrtest /usr/doc/pwrtest
fi
fi
# End automatically added section
proot="/pwrp"
aroot="/usr/pwrp/adm"
# Create users...
new_user=0
if getent group pwrp > /dev/null; then
echo "-- group pwrp already exist"
else
if groupadd pwrp; then
echo "-- group pwrp added"
fi
fi
if getent group b55 > /dev/null; then
echo "-- group b55 already exist"
else
if groupadd b55; then
echo "-- group b55 added"
fi
fi
if getent group b66 > /dev/null; then
echo "-- group b66 already exist"
else
if groupadd b66; then
echo "-- group b66 added"
fi
fi
if getent group skiftel > /dev/null; then
echo "-- group skiftel already exist"
else
if groupadd skiftel; then
echo "-- group skiftel added"
fi
fi
if getent passwd pwrp > /dev/null; then
echo "-- user pwrp already exist"
else
new_user=1
if useradd -s /bin/bash -p aaupl/kQs1p3U -g pwrp -G b55,b66,skiftel -d /home/pwrp pwrp; then
echo "-- user pwrp added"
fi
if [ ! -e /home/pwrp ]; then
mkdir /home/pwrp
cp /usr/pwrrt/cnf/user/.bashrc /home/pwrp
cp /usr/pwrrt/cnf/user/.bash_profile /home/pwrp
# cp /usr/pwrrt/cnf/user/.mwmrc /home/pwrp
cp /usr/pwrrt/cnf/user/.rtt_start /home/pwrp
chmod a+x /home/pwrp/.rtt_start
cp /usr/pwrrt/cnf/user/.xtt_start /home/pwrp
chmod a+x /home/pwrp/.xtt_start
# cp /usr/pwrrt/cnf/user/.xsession /home/pwrp
chown -R pwrp /home/pwrp
chgrp -R pwrp /home/pwrp
fi
# Add to group dialout
if getent group dialout > /dev/null; then
usermod -a -G dialout pwrp
fi
fi
if getent passwd skiftel > /dev/null; then
echo "-- user skiftel already exist"
else
new_user=1
if useradd -s /bin/bash -p aa6NzxS/aBgP6 -g skiftel -G pwrp -d /home/skiftel skiftel; then
echo "-- user skiftel added"
fi
if [ ! -e /home/skiftel ]; then
mkdir /home/skiftel
cp /usr/pwrrt/cnf/user/.bashrc /home/skiftel
cp /usr/pwrrt/cnf/user/.bash_profile /home/skiftel
# cp /usr/pwrrt/cnf/user/.mwmrc /home/skiftel
cp /usr/pwrrt/cnf/user/.rtt_start /home/skiftel
chmod a+x /home/skiftel/.rtt_start
cp /usr/pwrrt/cnf/user/.xtt_start /home/skiftel
chmod a+x /home/skiftel/.xtt_start
# cp /usr/pwrrt/cnf/user/.xsession /home/skiftel
chown -R pwrp /home/skiftel
chgrp -R pwrp /home/skiftel
fi
fi
if getent passwd b55 > /dev/null; then
new_user=1
# Check if group audio exist
if getent group audio > /dev/null; then
groups="pwrp,audio"
else
groups="pwrp"
fi
if useradd -s /bin/bash -p aaQPClsglxJP6 -g b55 -G $groups -d /home/b55 b55; then
echo "-- user b55 added"
fi
if [ ! -e /home/b55 ]; then
mkdir /home/b55
cp /usr/pwrrt/cnf/op/.bashrc /home/b55
cp /usr/pwrrt/cnf/op/.bash_profile /home/b55
# cp /usr/pwrrt/cnf/op/.mwmrc /home/b55
cp /usr/pwrrt/cnf/op/.rtt_start /home/b55
chmod a+x /home/b55/.rtt_start
cp /usr/pwrrt/cnf/op/.xtt_start /home/b55
chmod a+x /home/b55/.xtt_start
# cp /usr/pwrrt/cnf/op/.xsession /home/b55
chown -R b55 /home/b55
chgrp -R pwrp /home/b55
chmod g+rwx /home/b55
fi
fi
if getent passwd b66 > /dev/null; then
new_user=1
# Check if group audio exist
if getent group audio > /dev/null; then
groups="pwrp,audio"
else
groups="pwrp"
fi
if useradd -s /bin/bash -p aae.nHgHbfUpw -g b66 -G $groups -d /home/b66 b66; then
echo "-- user b66 added"
fi
if [ ! -e /home/b66 ]; then
mkdir /home/b66
cp /usr/pwrrt/cnf/op/.bashrc /home/b66
cp /usr/pwrrt/cnf/op/.bash_profile /home/b66
# cp /usr/pwrrt/cnf/op/.mwmrc /home/b66
cp /usr/pwrrt/cnf/op/.rtt_start /home/b66
chmod a+x /home/b66/.rtt_start
cp /usr/pwrrt/cnf/op/.xtt_start /home/b66
chmod a+x /home/b66/.xtt_start
# cp /usr/pwrrt/cnf/op/.xsession /home/b66
chown -R b66 /home/b66
chgrp -R pwrp /home/b66
chmod g+rwx /home/b66
fi
fi
chown -R pwrp /usr/pwrrt
chgrp -R pwrp /usr/pwrrt
chmod u+s /usr/pwrrt/exe/rt_ini
chmod u+s /usr/pwrrt/exe/rt_rtt
#chmod u+s /usr/pwrrt/exe/rt_xtt
chmod u+s /usr/pwrrt/exe/rt_bck
chmod u+s /usr/pwrrt/exe/rt_gdhget
chown root /usr/pwrrt/exe/rs_remote_alcm
chmod u+s /usr/pwrrt/exe/rs_remote_alcm
if getent group dialout > /dev/null; then
chgrp dialout /usr/pwrrt/exe/rs_remote_serial
chmod ug+s /usr/pwrrt/exe/rs_remote_serial
chgrp dialout /usr/pwrrt/exe/rs_remote_3964r
chmod ug+s /usr/pwrrt/exe/rs_remote_3964r
fi
chown root /usr/pwrrt/exe/rt_prio
chmod u+s /usr/pwrrt/exe/rt_prio
chown root /usr/pwrrt/exe/rt_mozilla
chmod u+s /usr/pwrrt/exe/rt_mozilla
# Copy configuration files
new_cnf=0
if [ ! -e /etc/proview.cnf ]; then
cp /usr/pwrrt/cnf/proview.cnf /etc
new_cnf=1
fi
# Add pwrp_profile to profile
if ! grep -q "/etc/pwrp_profile\b" /etc/profile; then
cat >> /etc/profile <<-EOF
if [ -e /etc/pwrp_profile ]; then
source /etc/pwrp_profile
fi
EOF
fi
# Create startup link
set +e
checklink=`eval ls /etc/rc2.d/S90pwr 2>/dev/null`
set -e
if [ "$checklink" != "" ]; then
rm /etc/rc2.d/S90pwr
fi
ln -s /etc/init.d/pwr /etc/rc2.d/S90pwr
set +e
checklink=`eval ls /etc/rc2.d/S91gdhserver 2>/dev/null`
set -e
if [ "$checklink" != "" ]; then
rm /etc/rc2.d/S91gdhserver
fi
# Obsolete
#ln -s /etc/init.d/gdhserver /etc/rc2.d/S91gdhserver
# Create project
new_project=0
if [ ! -e $proot ]; then
new_project=1
mkdir $proot
mkdir $proot/common
mkdir $proot/common/inc
mkdir $proot/common/load
mkdir $proot/common/log
mkdir $proot/common/loghist
mkdir $proot/common/db
mkdir $proot/common/web
mkdir $proot/x86_linux
mkdir $proot/x86_linux/exe
mkdir $proot/x86_linux/lib
mkdir $proot/x86_linux/obj
mkdir $proot/x86_linux/lis
chown -R pwrp $proot
chgrp -R pwrp $proot
fi
if [ ! -e $aroot/db ]; then
mkdir -p $aroot/db
chown -R pwrp $aroot
fi
# Copy jar-files to web directory
if [ -e /etc/proview.cnf ]; then
set +e
web_dir=`eval cat /etc/proview.cnf | grep "\\bwebDirectory\\b" | awk '{print $2}'`
set -e
if [ -e "$web_dir" ]; then
cp /usr/pwrrt/lib/pwr_rt_client.jar $web_dir
chown pwrp $web_dir/pwr_rt_client.jar
cp /usr/pwrrt/lib/pwr_jop.jar $web_dir
chown pwrp $web_dir/pwr_jop.jar
cp /usr/pwrrt/lib/pwr_jopc.jar $web_dir
chown pwrp $web_dir/pwr_jopc.jar
fi
fi
#
# Add proview web directories to Apache
#
if [ -e /etc/apache2/apache2.conf ]; then
if ! egrep -q "Alias[ ]+/pwrp_web/" /etc/apache2/apache2.conf; then
cat >> /etc/apache2/apache2.conf <<-EOF
#
# Proview alias pwrp_web, added by Proview installation
#
Alias /pwrp_web/ /pwrp/common/web/
<Directory /pwrp/common/web>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
EOF
fi
if ! egrep -q "Alias[ ]+/pwrp_log/" /etc/apache2/apache2.conf; then
cat >> /etc/apache2/apache2.conf <<-EOF
#
# Proview alias pwrp_log, added by Proview installation
#
Alias /pwrp_log/ /pwrp/common/log/
<Directory /pwrp/common/log>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
EOF
fi
if ! egrep -q "Alias[ ]+/pwr_doc/" /etc/apache2/apache2.conf; then
cat >> /etc/apache2/apache2.conf <<-EOF
#
# Proview alias pwr_doc, added by Proview installation
#
Alias /pwr_doc/ /usr/pwrrt/doc/
<Directory /usr/pwrrt/doc>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
EOF
fi
fi
#
# Set owner on preinstalled I/O systems
#
if [ -e /lib/udev/devices/qbus ]; then
chown pwrp:pwrp /lib/udev/devices/qbus
fi
if [ -e /lib/udev/devices/pbus1 ]; then
chown pwrp:pwrp /lib/udev/devices/pbus1
fi
if [ -e /lib/udev/devices/pbus2 ]; then
chown pwrp:pwrp /lib/udev/devices/pbus2
fi
changes=0
if [ $new_user -eq 1 ]; then
changes=1
elif [ $new_cnf -eq 1 ]; then
changes=1
elif [ $new_project -eq 1 ]; then
changes=1
fi
if [ $changes -ne 0 ]; then
echo ""
echo ""
echo "***********************************************************"
echo " Don't forget to do this :"
echo ""
fi
if [ $new_cnf -eq 1 ]; then
echo "-- Enter QcomBusId in /etc/proview.cnf"
fi
#if [ $new_user -eq 1 ]; then
# echo "-- Enter OpPlace object as argument to rt_xtt in /home/b55/.xtt_start"
#fi
if [ $new_project -eq 1 ]; then
nodename=`eval uname -n`
echo "-- Create file /home/pwrp/.rhosts"
echo "-- Distribute project to $nodename"
fi
if [ $changes -ne 0 ]; then
echo ""
echo "***********************************************************"
echo ""
fi
#!/bin/sh
set -e
# Automatically added by dh_installdocs
if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/pwrtest ]; then
rm -f /usr/doc/pwrtest
fi
# End automatically added section
proot="/pwrp"
aroot="/usr/pwrp/adm"
echo ""
echo -n "Do you wan't to remove project and users (y/n) [n] "
read remove_all
if [ "$remove_all" = "y" ]; then
# Check that any user that is to be remoted isn't logged in
set +e
user_found=0
currentusers=`eval users`
userstr=""
checkuser=`eval echo $currentusers | grep "\bb55\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" b55"
fi
checkuser=`eval echo $currentusers | grep "\bb66\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" b66"
fi
checkuser=`eval echo $currentusers | grep "\bpwrp\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" pwrp"
fi
checkuser=`eval echo $currentusers | grep "\bskiftel\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" skiftel"
fi
if [ $user_found -eq 1 ]; then
echo "-- Current users: $currentusers"
echo "** Remove user will fail. Logout user $userstr first."
exit -1;
fi
set -e
echo "-- Remove user b55"
if grep -q "\bb55:" /etc/passwd; then
userdel b55
fi
if [ -e /home/b55 ]; then
rm -r /home/b55
fi
echo "-- Remove user b66"
if grep -q "\bb66:" /etc/passwd; then
userdel b66
fi
if [ -e /home/b66 ]; then
rm -r /home/b66
fi
echo "-- Remove user pwrp"
if grep -q "\bpwrp:" /etc/passwd; then
userdel pwrp
fi
if [ -e /home/pwrp ]; then
rm -r /home/pwrp
fi
echo "-- Remove user skiftel"
if grep -q "\bskiftel:" /etc/passwd; then
userdel skiftel
fi
if [ -e /home/skiftel ]; then
rm -r /home/skiftel
fi
if grep -q "\bb55:" /etc/group; then
groupdel b55
fi
if grep -q "\bb66:" /etc/group; then
groupdel b66
fi
if grep -q "\bpwrp:" /etc/group; then
groupdel pwrp
fi
if grep -q "\bskiftel:" /etc/group; then
groupdel skiftel
fi
echo "-- Remove project $proot"
if [ -e $proot ]; then
rm -r $proot
fi
if [ -e $aroot ]; then
rm -r $aroot
fi
fi
# Remove startup
checklink=`eval ls /etc/rc2.d/S90pwr 2>/dev/null`
if [ "$checklink" != "" ]; then
rm /etc/rc2.d/S90pwr
fi
# Remove jar-files on web directory
if [ -e /etc/proview.cnf ]; then
web_dir=`eval cat /etc/proview.cnf | grep "\\bwebDirectory\\b" | awk '{print $2}'`
if [ -e $web_dir/pwr_rt_client.jar ]; then
rm $web_dir/pwr_rt_client.jar
fi
if [ -e $web_dir/pwr_jop.jar ]; then
rm $web_dir/pwr_jop.jar
fi
fi
#
# Configuration file for Proview
#
# Default QCOM Bus Id
#
qcomBusId 517
#
# Web directory
#
webDirectory /pwrp/common/web
#
# Default privileges for SevXtt: Read, Admin or None
#
sevXttDefaultPriv Read
#!/bin/bash
#
# Startscript fr PWR
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
wrapper="/tmp/rt_ini_wrapper"
killer="/tmp/pwr_killer"
. /etc/pwrp_profile
umask 002
create_wrapper()
{
if [ ! -e $wrapper ] ; then
echo "#!/bin/bash" > $wrapper
echo "source /etc/pwrp_profile" >> $wrapper
echo "umask 002" >> $wrapper
echo "\$pwr_exe/rt_ini \$* &" >> $wrapper
chmod a+rx $wrapper
if [ ! -e $wrapper ] ;then
echo "$wrapper not writable, check permissions"
exit
fi
fi
}
create_killer()
{
echo "#!/bin/bash" > $killer
echo "source /etc/pwrp_profile" >> $killer
echo "umask 002" >> $killer
echo "`ps ax | grep "rt_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "rs_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "ra_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "sev_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "opc_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "eval `ipcs -s|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm sem %s;", $2}'`" >> $killer
echo "eval `ipcs -q|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm msg %s;", $2}'`" >> $killer
echo "eval `ipcs -m|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm shm %s;", $2}'`" >> $killer
echo "rm /tmp/pwr*\$PWR_BUS_ID" >> $killer
chmod a+rx $killer
if [ ! -e $killer ] ;then
echo "$killer not writable, check permissions"
exit
fi
}
pwr_start()
{
create_wrapper
if [ `whoami` == "pwrp" ];then
$wrapper
else
sudo -u pwrp $wrapper
fi
}
pwr_stop()
{
create_wrapper
if [ `whoami` == "pwrp" ];then
$wrapper -s
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
source $pwrp_exe/pwrp_stop.sh
fi
else
sudo -u pwrp $wrapper -s
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
sudo -u pwrp source $pwrp_exe/pwrp_stop.sh
fi
fi
while [ "`ps aux | grep -v grep | grep rt_`" != "" ] ; do sleep 1; done
}
pwr_reload()
{
if [ `whoami` == "pwrp" ];then
$pwr_exe/rt_ini_wrapper -r
else
sudo -u pwrp $pwr_exe/rt_ini_wrapper -r
fi
}
pwr_kill()
{
create_killer
if [ `whoami` == "pwrp" ];then
$killer
else
sudo -u pwrp $killer
fi
}
case "$1"
in
start)
echo "Start Proview Runtime Environment."
pwr_start
echo "Done."
;;
stop)
echo "Stop Proveiw Runtime Environment."
pwr_stop
echo "Done."
;;
restart)
echo "Restart Proview Runtime Environment."
echo "Closing down..."
pwr_stop
sleep 1
echo "Starting..."
pwr_start
echo "Done."
;;
reload)
echo "Reload Proview Runtime Environment"
pwr_reload
echo "Done."
;;
kill)
echo "Remove all processes and resources for Proview Storage Environment"
pwr_kill
echo "Done."
;;
reset)
echo "Remove all processes and resources for Proview Storage Environment"
pwr_kill
echo "Done."
;;
*)
echo " pwrsev Start and stop Proview Storage Environment" >&2
echo "" >&2
echo " Usage:" >&2
echo " pwr start|stop|restart|reload|reset" >&2
echo "" >&2
echo " start Start Runtime environment" >&2
echo " stop Stop Runtime environment" >&2
echo " restart First stop and then start Runtime environment" >&2
echo " reload Soft restart of Runtime environment" >&2
echo " reset Remove all processes and resources" >&2
echo "" >&2
exit 1
;;
esac
exit 0
.TH pwr "1" "April 2005" "Proview" "Proview Manual"
.SH NAME
pwr - start and stop Proview runtime environment
.SH SYNOPSIS
.B pwr
[start][stop][restart][reload][reset]
.SH DESCRIPTION
Start and stop command for Proview runtime environment.
.SH OPTIONS
.HP
\fBstart\fR
.IP
Start Proview runtime environment.
.HP
\fBstop\fR
.IP
Stop Proview runtime environment.
.HP
\fBrestart\fR
.IP
First stop and then start the Proview runtime environment.
.HP
\fBreload\fR
.IP
Soft restart of Proview runtime environment.
.HP
\fBreset\fR
.IP
Remove all processes and resources.
.SH FILES
/etc/pwrp_profile
The Proview system wide configuration file.
.SH ENVIRONMENT
.HP
PWR_BUS_ID
.IP
QCOM bus identity.
.SH AUTHOR
Written by UL.
.SH "SEE ALSO"
.BR rt_ini(1)
bus_id=""
if [ -e /etc/proview.cnf ]; then
bus_id=`eval cat /etc/proview.cnf | grep "\\bqcomBusId\\b" | awk '{print $2}'`
fi
if [ -e /etc/proview.cnf ]; then
web_dir=`eval cat /etc/proview.cnf | grep "\\bwebDirectory\\b" | awk '{print $2}'`
fi
export PWR_BUS_ID=$bus_id
export pwrb_root=/usr/pwrrt
export pwrp_root=/pwrp
export pwr_exe=$pwrb_root/exe
export pwr_lib=$pwrb_root/lib
export pwr_obj=$pwrb_root/obj
export pwr_inc=$pwrb_root/inc
export pwr_load=$pwrb_root/load
export pwr_lis=$pwrb_root/lis
export pwr_doc=$pwrb_root/doc
export pwrp_exe=$pwrp_root/x86_linux/exe
export pwrp_lib=$pwrp_root/x86_linux/lib
export pwrp_obj=$pwrp_root/x86_linux/obj
export pwrp_lis=$pwrp_root/x86_linux/lis
export pwrp_inc=$pwrp_root/common/inc
export pwrp_load=$pwrp_root/common/load
export pwrp_log=$pwrp_root/common/log
export pwrp_db=$pwrp_root/common/db
export pwrp_web=$web_dir
export pwra_db=/usr/pwrp/adm/db
jdk=`eval ls /usr/local | grep ^jre`
if [ "$jdk" == "" ]; then
jdk=`eval ls /usr/local | grep ^jdk`
fi
export jdk_home=/usr/local/$jdk/bin
PATH=$PATH:$pwr_exe:$pwrp_exe:$jdk_home
#Set display to remote computer
export DISPLAY=$REMOTEHOST:0.0
#symbols to define start/stop commands for PWR
alias pwr_stop='/etc/init.d/pwr stop'
alias pwr_stop.sh="/etc/init.d/pwr stop"
alias pwr_start="/etc/init.d/pwr start"
alias pwr="/etc/init.d/pwr"
alias boot="/usr/bin/sudo /sbin/reboot"
if [ -e $pwrp_exe/profile ]; then
source $pwrp_exe/profile
fi
.TH rt_ini "1" "April 2005" "Proview" "Proview Manual"
.SH NAME
rt_ini - start, restart or stop the Proview runtime environment
.SH SYNOPSIS
.B rt_ini
[\fIOPTION\fR]
.SH DESCRIPTION
Startup process for the Proview runtime environment.
.SH OPTIONS
.HP
\fB\-a\fR
.IP
Application file. The application file defines the application processes for
the node. The default name is $pwrp_load/ld_appl_'node'_'busid'.txt, where node is
the nodename and busid is the QCOM bus id, for example
$pwrp_load/ld_appl_vwxn1t_507.txt
.HP
\fB\-b\fR
.IP
Boot file. The default bootfile is $pwrp_load/ld_boot_'node'_'busid'.txt, where node
is the nodename and busid the QCOM bus id, for example
$pwrp_load/ld_appl_vwxn1t_0507.txt
.HP
\fB\-c\fR
.IP
Console file. The output of log messages to the console device can be redirected with
the -c option.
.HP
\fB\-d\fR
.IP
Load file directory. Default is $pwrp_load.
.HP
\fB\-e\fR
.IP
Ignore errors.
.HP
\fB\-f\fR
.IP
Ignore fatal errors.
.HP
\fB\-h\fR
.IP
Print help.
.HP
\fB\-i\fR
.IP
Interactive. Print error messages to terminal.
.HP
\fB\-n\fR
.IP
Node name.
.HP
\fB\-p\fR
.IP
Plc file. Default is $pwrp_exe/plc_'node'_'busid' where node id the node name and busid
the QCOM bus id.
.HP
\fB\-q\fR
.IP
QCOM bus id.
.HP
\fB\-r\fR
.IP
Soft restart.
.HP
\fB\-s\fR
.IP
Stop Proview.
.HP
\fB\-v\fR
.IP
Verbose.
.HP
\fB\-w\fR
.IP
Ignore warnings.
.HP
\fB\-A\fR
.IP
Alias file. Default is $pwrp_load/pwrp_alias.dat
.HP
\fB\-?\fR
.IP
Print help.
.SH FILES
/etc/pwrp_profile
The Proview system wide configuration file.
.SH "SEE ALSO"
.BR pwr(1)
.TH rt_rtt "1" "April 2005" "Proview" "Proview Manual"
.SH NAME
rt_rtt - Proview Runtime Terminal Tool
.SH SYNOPSIS
.B rt_rtt
[user] [script] [configuration]
.SH DESCRIPTION
Examine and navigate in the realtime database from a VT100 terminal.
.SH OPTIONS
.HP
\fBuser\fR
.IP
The user of the session. OP for operator, SYS for system manager.
.HP
\fBscript\fR
.IP
A rtt script file.
.HP
\fBconfiguration\fR
.IP
A RttConfig object that configures the session.
.SH AUTHOR
Written by cs.
.SH "SEE ALSO"
.BR rt_xtt(1)
.TH rt_xtt "1" "April 2005" "Proview" "Proview Manual"
.SH NAME
rt_xtt - Proview Operator Environment
.SH SYNOPSIS
.B rt_xtt
[\fIOPTION\fR] [opplace]
.SH DESCRIPTION
The Proview Operator Environment contains a set of utitlities to display information
about the process and the Proview system:
.RS
\- Operator window.
.RE
.RS
\- Process Graphics drawn in the Ge editor.
.RE
.RS
\- Trends and fastcurves.
.RE
.RS
\- Helptexts.
.RE
.RS
\- Navigator for the realtime database.
.RE
.RS
\- Alarms and events.
.RE
.SH OPTIONS
.HP
\fBopplace\fR
.IP
The name of the OpPlace object for the operator place.
.HP
\fB\-l\fR
.IP
Language.
.RS
en_us English
.RE
.RS
sv_se Swedish.
.RE
.RS
de_de German.
.RE
.RS
en_us is default.
.RE
.HP
\fB\-u\fR
.IP
Use opplace object with the same name as the current user.
.HP
\fB\-s\fR
.IP
Show a selection list of available OpPlace objects.
.HP
\fB\-a\fR
.IP
Connect to audio device.
.HP
\fB\-q\fR
.IP
Quiet. Hide license information.
.SH AUTHOR
Written by cs.
.SH "SEE ALSO"
.BR pwr(1),
.BR rt_ini(1)
#!/bin/bash
# Get version
if [ -e $pwr_inc/pwr_version.h ]; then
ver=`eval cat $pwr_inc/pwr_version.h | grep "\bpwrv_cWbdbVersionShortStr\b" | awk '{print $3}'`
if [ -z $ver ]; then
echo "Unable to get pwr version"
ver="V00"
fi
ver=${ver:2:2}
fi
# Generate version help file
{
if [ ! -e $pwre_sroot/tools/pkg/deb/pwrsev/control ]; then
echo "Controlfile not found"
exit 1
fi
datfile=$pwre_sroot/tools/pkg/deb/pwrsev/control
echo "<topic> version"
d=`eval date +\"%F %X\"`
{
let printout=0
while read line; do
if [ "${line:0:9}" = "Package: " ]; then
package=${line#Package: }
fi
if [ "${line:0:9}" = "Version: " ]; then
version=${line#Version: }
fi
if [ "${line:0:14}" = "Architecture: " ]; then
arch=${line#Architecture: }
fi
if [ "${line:0:12}" = "Description:" ]; then
echo ""
echo "<image> pwr_logga.gif"
echo ""
echo ""
echo ""
echo "<b>Proview Storage Environment V${version:0:3}"
echo "Version V$version"
echo ""
echo "Copyright 2004-${d:0:4} SSAB Oxelsund AB"
echo ""
echo "This program is free software; you can redistribute it and/or"
echo "modify it under the terms of the GNU General Public License as"
echo "published by the Free Software Foundation, either version 2 of"
echo "the License, or (at your option) any later version."
echo ""
echo "This program is distributed in the hope that it will be useful"
echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
echo "For more details, see the"
echo "GNU General Public License. <weblink> http://www.proview.se/gpllicense.html"
echo ""
echo "E-mail postmaster@proview.se <weblink> mailto:postmaster@proview.se"
echo "Internet www.proview.se <weblink> http://www.proview.se"
echo ""
echo ""
echo "<b>Package"
echo "Package $package""_""$version""_""$arch"
echo "Build date $d"
echo "Package description:"
echo ""
printout=1
else
if [ $printout -eq 1 ]; then
echo $line
fi
fi
done
} < $datfile
echo "</topic>"
} > $pwr_eexe/sev_xtt_version_help.dat
# Convert to html
co_convert -t -d $pwr_doc $pwr_eexe/sev_xtt_version_help.dat
{
echo "<html><head>"
echo "<meta http-equiv=\"Refresh\" content=\"5;../sev_xtt_version_help_version.html\">"
echo "</head></html>"
} > $pwr_doc/en_us/package_version.html
if [ "$1" == "-v" ]; then
exit
fi
pkgroot=$pwre_broot/$pwre_target/bld/pkg/pwrsev
pkgsrc=$pwre_sroot/tools/pkg/deb/pwrsev
# Create directories
echo "-- Create package tree"
mkdir -p $pkgroot/DEBIAN
mkdir -p $pkgroot/usr/share/doc/pwrsev
mkdir -p $pkgroot/etc/init.d
find $pkgroot -type d | xargs chmod 755
# control
cp $pkgsrc/control $pkgroot/DEBIAN
cp $pkgsrc/postinst $pkgroot/DEBIAN
cp $pkgsrc/prerm $pkgroot/DEBIAN
# copyright
cp $pkgsrc/copyright $pkgroot/usr/share/doc/pwrsev
# changelog
cp $pkgsrc/changelog $pkgroot/usr/share/doc/pwrsev
gzip -fq --best $pkgroot/usr/share/doc/pwrsev/changelog
# changelog.Debian
cp $pkgsrc/changelog.Debian $pkgroot/usr/share/doc/pwrsev
gzip -fq --best $pkgroot/usr/share/doc/pwrsev/changelog.Debian
# Startup files
cp $pkgsrc/pwrp_profile $pkgroot/etc
chmod a+x $pkgroot/etc/pwrp_profile
cp $pkgsrc/pwrsev $pkgroot/etc/init.d
chmod a+x $pkgroot/etc/init.d/pwrsev
# Man pages
mkdir -p $pkgroot/usr/share/man/man1
cp $pkgsrc/pwrsev.1 $pkgroot/usr/share/man/man1/pwrsev.1
gzip -fq --best $pkgroot/usr/share/man/man1/pwrsev.1
cp $pkgsrc/sev_ini.1 $pkgroot/usr/share/man/man1/sev_ini.1
gzip -fq --best $pkgroot/usr/share/man/man1/sev_ini.1
cp $pkgsrc/sev_xtt.1 $pkgroot/usr/share/man/man1/sev_xtt.1
gzip -fq --best $pkgroot/usr/share/man/man1/sev_xtt.1
# Copy proview
mkdir $pkgroot/usr/pwrsev
currentdir="`eval pwd`"
tarfile=$pwre_broot/$pwre_target/bld/pkg/pwrtmp.tar
cd $pwre_broot/$pwre_target/exp
echo "-- Copy release to package tree"
tar -cf $tarfile exe/rt_qmon exe/rt_prio exe/sev_ini exe/sev_xtt exe/sev_xtt_gtk exe/sev_server exe/*.gif exe/*.png exe/sev_xtt_version_help.dat exe/pwr_pkg.sh exe/en_us/*.txt doc/*
cd $pkgroot/usr/pwrsev
mkdir cnf
tar -xf $tarfile
rm $tarfile
#rm -r $pkgroot/usr/pwrsev/lib/*.a
#rm -r $pkgroot/usr/pwrsev/exe/wb*
cp $pwr_eexe/wb_distr_keepboot.sh $pkgroot/usr/pwrsev/exe
cd $currentdir
# Copy configuration files to cnf
cp $pkgsrc/proview.cnf $pkgroot/usr/pwrsev/cnf
# Copy op to cnf
mkdir $pkgroot/usr/pwrsev/cnf/op
cp $pwre_sroot/tools/pkg/deb/op/.bashrc $pkgroot/usr/pwrsev/cnf/op
cp $pwre_sroot/tools/pkg/deb/op/.bash_profile $pkgroot/usr/pwrsev/cnf/op
#cp $pwre_sroot/tools/pkg/deb/op/.mwmrc $pkgroot/usr/pwrsev/cnf/op
cp $pwre_sroot/tools/pkg/deb/op/.rtt_start $pkgroot/usr/pwrsev/cnf/op
cp $pwre_sroot/tools/pkg/deb/op/.xtt_start $pkgroot/usr/pwrsev/cnf/op
#cp $pwre_sroot/tools/pkg/deb/op/.xsession $pkgroot/usr/pwrsev/cnf/op
# Copy user to cnf
mkdir $pkgroot/usr/pwrsev/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.bashrc $pkgroot/usr/pwrsev/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.bash_profile $pkgroot/usr/pwrsev/cnf/user
#cp $pwre_sroot/tools/pkg/deb/user/.mwmrc $pkgroot/usr/pwrsev/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.rtt_start $pkgroot/usr/pwrsev/cnf/user
cp $pwre_sroot/tools/pkg/deb/user/.xtt_start $pkgroot/usr/pwrsev/cnf/user
#cp $pwre_sroot/tools/pkg/deb/user/.xsession $pkgroot/usr/pwrsev/cnf/user
# Create package
echo "-- Building package"
if which fakeroot > /dev/null; then
fakeroot dpkg -b $pkgroot $pwre_broot/$pwre_target/bld/pkg
else
dpkg -b $pkgroot $pwre_broot/$pwre_target/bld/pkg
fi
rm -r $pkgroot
Proview V3.4b (3.4.1-1)
\ No newline at end of file
Proview. See also normal changelog file.
\ No newline at end of file
Package: pwrsev
Version: 4.6.1-1
Section: base
Priority: optional
Architecture: i386
Depends: libc6 (>= 2.7-18), libgtk2.0-0 (>= 2.12.12-1~lenny1), libasound2 (>= 1.0.16-2), libdb4.6 (>=4.6.21-11), libmysqlclient15off (>= 5.0.51a-24+lenny1)
Replaces: pwr34,pwr39,pwr40,pwr41,pwr42,pwr43,pwr44,pwr45
Maintainer: Proview <postmaster@proview.se>
Description:
Proview storage environment
4.6.1-1 Base release
Proview
Copyright: SSAB Oxelsund AB <ssabox.com>
2003-11-21
The home page of Proview is at:
http://www.proview.se
#!/bin/bash
set -e
if [ "$pwrrt_xtrace" != "" ]; then
set -o xtrace
fi
# Automatically added by dh_installdocs
if [ "$1" = "configure" ]; then
if [ -d /usr/doc -a ! -e /usr/doc/pwrtest -a -d /usr/share/doc/pwrtest ]; then
ln -sf ../share/doc/pwrtest /usr/doc/pwrtest
fi
fi
# End automatically added section
proot="/pwrp"
aroot="/usr/pwrp/adm"
# Create users...
new_user=0
if getent group pwrp > /dev/null; then
echo "-- group pwrp already exist"
else
if groupadd pwrp; then
echo "-- group pwrp added"
fi
fi
if getent group b55 > /dev/null; then
echo "-- group b55 already exist"
else
if groupadd b55; then
echo "-- group b55 added"
fi
fi
if getent group b66 > /dev/null; then
echo "-- group b66 already exist"
else
if groupadd b66; then
echo "-- group b66 added"
fi
fi
if getent group skiftel > /dev/null; then
echo "-- group skiftel already exist"
else
if groupadd skiftel; then
echo "-- group skiftel added"
fi
fi
if getent passwd pwrp > /dev/null; then
echo "-- user pwrp already exist"
else
new_user=1
if useradd -s /bin/bash -p aaupl/kQs1p3U -g pwrp -G b55,b66,skiftel -d /home/pwrp pwrp; then
echo "-- user pwrp added"
fi
if [ ! -e /home/pwrp ]; then
mkdir /home/pwrp
cp /usr/pwrsev/cnf/user/.bashrc /home/pwrp
cp /usr/pwrsev/cnf/user/.bash_profile /home/pwrp
# cp /usr/pwrsev/cnf/user/.mwmrc /home/pwrp
cp /usr/pwrsev/cnf/user/.rtt_start /home/pwrp
chmod a+x /home/pwrp/.rtt_start
cp /usr/pwrsev/cnf/user/.xtt_start /home/pwrp
chmod a+x /home/pwrp/.xtt_start
# cp /usr/pwrsev/cnf/user/.xsession /home/pwrp
chown -R pwrp /home/pwrp
chgrp -R pwrp /home/pwrp
fi
# Add to group dialout
if getent group dialout > /dev/null; then
usermod -a -G dialout pwrp
fi
fi
if getent passwd skiftel > /dev/null; then
echo "-- user skiftel already exist"
else
new_user=1
if useradd -s /bin/bash -p aa6NzxS/aBgP6 -g skiftel -G pwrp -d /home/skiftel skiftel; then
echo "-- user skiftel added"
fi
if [ ! -e /home/skiftel ]; then
mkdir /home/skiftel
cp /usr/pwrsev/cnf/user/.bashrc /home/skiftel
cp /usr/pwrsev/cnf/user/.bash_profile /home/skiftel
# cp /usr/pwrsev/cnf/user/.mwmrc /home/skiftel
cp /usr/pwrsev/cnf/user/.rtt_start /home/skiftel
chmod a+x /home/skiftel/.rtt_start
cp /usr/pwrsev/cnf/user/.xtt_start /home/skiftel
chmod a+x /home/skiftel/.xtt_start
# cp /usr/pwrsev/cnf/user/.xsession /home/skiftel
chown -R pwrp /home/skiftel
chgrp -R pwrp /home/skiftel
fi
fi
if getent passwd b55 > /dev/null; then
new_user=1
# Check if group audio exist
if getent group audio > /dev/null; then
groups="pwrp,audio"
else
groups="pwrp"
fi
if useradd -s /bin/bash -p aaQPClsglxJP6 -g b55 -G $groups -d /home/b55 b55; then
echo "-- user b55 added"
fi
if [ ! -e /home/b55 ]; then
mkdir /home/b55
cp /usr/pwrsev/cnf/op/.bashrc /home/b55
cp /usr/pwrsev/cnf/op/.bash_profile /home/b55
# cp /usr/pwrsev/cnf/op/.mwmrc /home/b55
cp /usr/pwrsev/cnf/op/.rtt_start /home/b55
chmod a+x /home/b55/.rtt_start
cp /usr/pwrsev/cnf/op/.xtt_start /home/b55
chmod a+x /home/b55/.xtt_start
# cp /usr/pwrsev/cnf/op/.xsession /home/b55
chown -R b55 /home/b55
chgrp -R pwrp /home/b55
chmod g+rwx /home/b55
fi
fi
if getent passwd b66 > /dev/null; then
new_user=1
# Check if group audio exist
if getent group audio > /dev/null; then
groups="pwrp,audio"
else
groups="pwrp"
fi
if useradd -s /bin/bash -p aae.nHgHbfUpw -g b66 -G $groups -d /home/b66 b66; then
echo "-- user b66 added"
fi
if [ ! -e /home/b66 ]; then
mkdir /home/b66
cp /usr/pwrsev/cnf/op/.bashrc /home/b66
cp /usr/pwrsev/cnf/op/.bash_profile /home/b66
# cp /usr/pwrsev/cnf/op/.mwmrc /home/b66
cp /usr/pwrsev/cnf/op/.rtt_start /home/b66
chmod a+x /home/b66/.rtt_start
cp /usr/pwrsev/cnf/op/.xtt_start /home/b66
chmod a+x /home/b66/.xtt_start
# cp /usr/pwrsev/cnf/op/.xsession /home/b66
chown -R b66 /home/b66
chgrp -R pwrp /home/b66
chmod g+rwx /home/b66
fi
fi
chown -R pwrp /usr/pwrsev
chgrp -R pwrp /usr/pwrsev
chmod u+s /usr/pwrsev/exe/sev_ini
chown root /usr/pwrsev/exe/rt_prio
chmod u+s /usr/pwrsev/exe/rt_prio
# Copy configuration files
new_cnf=0
if [ ! -e /etc/proview.cnf ]; then
cp /usr/pwrsev/cnf/proview.cnf /etc
new_cnf=1
fi
# Add pwrp_profile to profile
if ! grep -q "/etc/pwrp_profile\b" /etc/profile; then
cat >> /etc/profile <<-EOF
if [ -e /etc/pwrp_profile ]; then
source /etc/pwrp_profile
fi
EOF
fi
# Create startup link
set +e
checklink=`eval ls /etc/rc2.d/S90pwrsev 2>/dev/null`
set -e
if [ "$checklink" != "" ]; then
rm /etc/rc2.d/S90pwrsev
fi
ln -s /etc/init.d/pwrsev /etc/rc2.d/S90pwrsev
# Create project
new_project=0
if [ ! -e $proot ]; then
new_project=1
mkdir $proot
mkdir $proot/common
mkdir $proot/common/inc
mkdir $proot/common/load
mkdir $proot/common/log
mkdir $proot/common/loghist
mkdir $proot/common/db
mkdir $proot/common/web
mkdir $proot/x86_linux
mkdir $proot/x86_linux/exe
mkdir $proot/x86_linux/lib
mkdir $proot/x86_linux/obj
mkdir $proot/x86_linux/lis
chown -R pwrp $proot
chgrp -R pwrp $proot
fi
if [ ! -e $aroot/db ]; then
mkdir -p $aroot/db
chown -R pwrp $aroot
fi
#
changes=0
if [ $new_user -eq 1 ]; then
changes=1
elif [ $new_cnf -eq 1 ]; then
changes=1
elif [ $new_project -eq 1 ]; then
changes=1
fi
if [ $changes -ne 0 ]; then
echo ""
echo ""
echo "***********************************************************"
echo " Don't forget to do this :"
echo ""
fi
if [ $new_cnf -eq 1 ]; then
echo "-- Enter QcomBusId in /etc/proview.cnf"
fi
#if [ $new_user -eq 1 ]; then
# echo "-- Enter OpPlace object as argument to rt_xtt in /home/b55/.xtt_start"
#fi
if [ $new_project -eq 1 ]; then
nodename=`eval uname -n`
echo "-- Create file /home/pwrp/.rhosts"
echo "-- Distribute project to $nodename"
fi
if [ $changes -ne 0 ]; then
echo ""
echo "***********************************************************"
echo ""
fi
#!/bin/sh
set -e
# Automatically added by dh_installdocs
if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/pwrtest ]; then
rm -f /usr/doc/pwrtest
fi
# End automatically added section
proot="/pwrp"
aroot="/usr/pwrp/adm"
echo ""
echo -n "Do you wan't to remove project and users (y/n) [n] "
read remove_all
if [ "$remove_all" = "y" ]; then
# Check that any user that is to be remoted isn't logged in
set +e
user_found=0
currentusers=`eval users`
userstr=""
checkuser=`eval echo $currentusers | grep "\bb55\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" b55"
fi
checkuser=`eval echo $currentusers | grep "\bb66\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" b66"
fi
checkuser=`eval echo $currentusers | grep "\bpwrp\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" pwrp"
fi
checkuser=`eval echo $currentusers | grep "\bskiftel\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" skiftel"
fi
if [ $user_found -eq 1 ]; then
echo "-- Current users: $currentusers"
echo "** Remove user will fail. Logout user $userstr first."
exit -1;
fi
set -e
echo "-- Remove user b55"
if grep -q "\bb55:" /etc/passwd; then
userdel b55
fi
if [ -e /home/b55 ]; then
rm -r /home/b55
fi
echo "-- Remove user b66"
if grep -q "\bb66:" /etc/passwd; then
userdel b66
fi
if [ -e /home/b66 ]; then
rm -r /home/b66
fi
echo "-- Remove user pwrp"
if grep -q "\bpwrp:" /etc/passwd; then
userdel pwrp
fi
if [ -e /home/pwrp ]; then
rm -r /home/pwrp
fi
echo "-- Remove user skiftel"
if grep -q "\bskiftel:" /etc/passwd; then
userdel skiftel
fi
if [ -e /home/skiftel ]; then
rm -r /home/skiftel
fi
if grep -q "\bb55:" /etc/group; then
groupdel b55
fi
if grep -q "\bb66:" /etc/group; then
groupdel b66
fi
if grep -q "\bpwrp:" /etc/group; then
groupdel pwrp
fi
if grep -q "\bskiftel:" /etc/group; then
groupdel skiftel
fi
echo "-- Remove project $proot"
if [ -e $proot ]; then
rm -r $proot
fi
if [ -e $aroot ]; then
rm -r $aroot
fi
fi
# Remove startup
checklink=`eval ls /etc/rc2.d/S90pwrsev 2>/dev/null`
if [ "$checklink" != "" ]; then
rm /etc/rc2.d/S90pwrsev
fi
# Remove jar-files on web directory
if [ -e /etc/proview.cnf ]; then
web_dir=`eval cat /etc/proview.cnf | grep "\\bwebDirectory\\b" | awk '{print $2}'`
if [ -e $web_dir/pwr_rt_client.jar ]; then
rm $web_dir/pwr_rt_client.jar
fi
if [ -e $web_dir/pwr_jop.jar ]; then
rm $web_dir/pwr_jop.jar
fi
fi
#
# Configuration file for Proview
#
# Default QCOM Bus Id
#
qcomBusId 517
#
# Web directory
#
webDirectory /pwrp/common/web
#
# Default privileges for SevXtt: Read, Admin or None
#
sevXttDefaultPriv Read
bus_id=""
if [ -e /etc/proview.cnf ]; then
bus_id=`eval cat /etc/proview.cnf | grep "\\bqcomBusId\\b" | awk '{print $2}'`
fi
if [ -e /etc/proview.cnf ]; then
web_dir=`eval cat /etc/proview.cnf | grep "\\bwebDirectory\\b" | awk '{print $2}'`
fi
export PWR_BUS_ID=$bus_id
export pwrb_root=/usr/pwrsev
export pwrp_root=/pwrp
export pwr_exe=$pwrb_root/exe
export pwr_lib=$pwrb_root/lib
export pwr_obj=$pwrb_root/obj
export pwr_inc=$pwrb_root/inc
export pwr_load=$pwrb_root/load
export pwr_lis=$pwrb_root/lis
export pwr_doc=$pwrb_root/doc
export pwrp_exe=$pwrp_root/x86_linux/exe
export pwrp_lib=$pwrp_root/x86_linux/lib
export pwrp_obj=$pwrp_root/x86_linux/obj
export pwrp_lis=$pwrp_root/x86_linux/lis
export pwrp_inc=$pwrp_root/common/inc
export pwrp_load=$pwrp_root/common/load
export pwrp_log=$pwrp_root/common/log
export pwrp_db=$pwrp_root/common/db
export pwrp_web=$web_dir
export pwra_db=/usr/pwrp/adm/db
jdk=`eval ls /usr/local | grep ^jre`
export jdk_home=/usr/local/$jdk/bin
PATH=$PATH:$pwr_exe:$pwrp_exe:$jdk_home
#Set display to remote computer
export DISPLAY=$REMOTEHOST:0.0
#symbols to define start/stop commands for PWR
alias pwr_stop='/etc/init.d/pwrsvestop'
alias pwr_stop.sh="/etc/init.d/pwrsev stop"
alias pwr_start="/etc/init.d/pwrsev start"
alias pwrsev="/etc/init.d/pwrsev"
alias pwr="/etc/init.d/pwrsev"
alias boot="/usr/bin/sudo /sbin/reboot"
if [ -e $pwrp_exe/profile ]; then
source $pwrp_exe/profile
fi
#!/bin/bash
#
# Startscript fr PWR
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
wrapper="/tmp/sev_ini_wrapper"
killer="/tmp/pwr_killer"
. /etc/pwrp_profile
umask 002
create_wrapper()
{
if [ ! -e $wrapper ] ; then
echo "#!/bin/bash" > $wrapper
echo "source /etc/pwrp_profile" >> $wrapper
echo "umask 002" >> $wrapper
echo "\$pwr_exe/sev_ini \$* &" >> $wrapper
chmod a+rx $wrapper
if [ ! -e $wrapper ] ;then
echo "$wrapper not writable, check permissions"
exit
fi
fi
}
create_killer()
{
echo "#!/bin/bash" > $killer
echo "source /etc/pwrp_profile" >> $killer
echo "umask 002" >> $killer
echo "`ps ax | grep "rt_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "sev_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "eval `ipcs -s|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm sem %s;", $2}'`" >> $killer
echo "eval `ipcs -q|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm msg %s;", $2}'`" >> $killer
echo "eval `ipcs -m|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm shm %s;", $2}'`" >> $killer
echo "rm /tmp/pwr*\$PWR_BUS_ID" >> $killer
chmod a+rx $killer
if [ ! -e $killer ] ;then
echo "$killer not writable, check permissions"
exit
fi
}
pwr_start()
{
create_wrapper
if [ `whoami` == "pwrp" ];then
$wrapper
else
sudo -u pwrp $wrapper
fi
}
pwr_stop()
{
create_wrapper
if [ `whoami` == "pwrp" ];then
$wrapper -s
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
source $pwrp_exe/pwrp_stop.sh
fi
else
sudo -u pwrp $wrapper -s
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
sudo -u pwrp source $pwrp_exe/pwrp_stop.sh
fi
fi
while [ "`ps aux | grep -v grep | grep rt_`" != "" ] ; do sleep 1; done
}
pwr_reload()
{
if [ `whoami` == "pwrp" ];then
$pwr_exe/sev_ini_wrapper -r
else
sudo -u pwrp $pwr_exe/sev_ini_wrapper -r
fi
}
pwr_kill()
{
create_killer
if [ `whoami` == "pwrp" ];then
$killer
else
sudo -u pwrp $killer
fi
}
case "$1"
in
start)
echo "Start Proview Storage Environment."
pwr_start
echo "Done."
;;
stop)
echo "Stop Proveiw Storage Environment."
pwr_stop
echo "Done."
;;
restart)
echo "Restart Proview Storage Environment."
echo "Closing down..."
pwr_stop
sleep 1
echo "Starting..."
pwr_start
echo "Done."
;;
reload)
echo "Restart Proview Storage Environment."
echo "Closing down..."
pwr_stop
sleep 1
echo "Starting..."
pwr_start
echo "Done."
;;
kill)
echo "Remove all processes and resources for Proview Storage Environment"
pwr_kill
echo "Done."
;;
reset)
echo "Remove all processes and resources for Proview Storage Environment"
pwr_kill
echo "Done."
;;
*)
echo " pwrsev Start and stop Proview Storage Environment" >&2
echo "" >&2
echo " Usage:" >&2
echo " pwrsev start|stop|restart|reset" >&2
echo "" >&2
echo " start Start Storage environment" >&2
echo " stop Stop Storage environment" >&2
echo " restart First stop and then start Storage environment" >&2
echo " reset Remove all processes and resources" >&2
echo "" >&2
exit 1
;;
esac
exit 0
.TH pwr "1" "April 2005" "Proview" "Proview Manual"
.SH NAME
pwrsev - start and stop Proview Storage Environment
.SH SYNOPSIS
.B pwrsev
[start][stop][restart][reset]
.SH DESCRIPTION
Start and stop command for Proview Storage Environment.
.SH OPTIONS
.HP
\fBstart\fR
.IP
Start Proview storage environment.
.HP
\fBstop\fR
.IP
Stop Proview storage environment.
.HP
\fBrestart\fR
.IP
Stop and start the Proview storage environment.
.HP
\fBreset\fR
.IP
Remove all processes and resources.
.SH FILES
/etc/pwrp_profile
The Proview system wide configuration file.
.SH ENVIRONMENT
.HP
PWR_BUS_ID
.IP
QCOM bus identity.
.SH AUTHOR
Written by cs.
.SH "SEE ALSO"
.BR sev_ini(1)
.TH sev_ini "1" "April 2005" "Proview" "Proview Manual"
.SH NAME
sev_ini - start or stop the Proview storage environment
.SH SYNOPSIS
.B sev_ini
[\fIOPTION\fR]
.SH DESCRIPTION
Startup process for the Proview storage environment.
.SH OPTIONS
.HP
\fB\-a\fR
.IP
Application file. The application file defines the application processes for
the node. The default name is $pwrp_load/ld_appl_'node'_'busid'.txt, where node is
the nodename and busid is the QCOM bus id, for example
$pwrp_load/ld_appl_vwxn1t_507.txt
.HP
\fB\-c\fR
.IP
Console file. The output of log messages to the console device can be redirected with
the -c option.
.HP
\fB\-d\fR
.IP
Load file directory. Default is $pwrp_load.
.HP
\fB\-e\fR
.IP
Ignore errors.
.HP
\fB\-f\fR
.IP
Ignore fatal errors.
.HP
\fB\-h\fR
.IP
Print help.
.HP
\fB\-i\fR
.IP
Interactive. Print error messages to terminal.
.HP
\fB\-n\fR
.IP
Node name.
.HP
\fB\-q\fR
.IP
QCOM bus id.
.HP
\fB\-s\fR
.IP
Stop Proview.
.HP
\fB\-v\fR
.IP
Verbose.
.HP
\fB\-w\fR
.IP
Ignore warnings.
.HP
\fB\-?\fR
.IP
Print help.
.SH FILES
/etc/pwrp_profile
The Proview system wide configuration file.
.SH "SEE ALSO"
.BR pwrsev(1)
.TH sev_xtt "1" "April 2005" "Proview" "Proview Manual"
.SH NAME
sev_xtt - Proview Storage Operator
.SH SYNOPSIS
.B sev_xtt
[\fIOPTION\fR] [opplace]
.SH DESCRIPTION
The Proview Storage Operator Environment contains a set of utitlities to handle the
the stored data.
.SH OPTIONS
.HP
\fBopplace\fR
.IP
The name of the OpPlace object for the operator place.
.HP
\fB\-l\fR
.IP
Language.
.RS
en_us English
.RE
.RS
sv_se Swedish.
.RE
.RS
de_de German.
.RE
.RS
en_us is default.
.RE
.HP
\fB\-q\fR
.IP
Quiet. Hide license information.
.SH AUTHOR
Written by cs.
.SH "SEE ALSO"
.BR sevpwr(1),
.BR sev_ini(1)
include $(pwre_dir_symbols)
ifndef variables_mk
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef variables_mk
include $(pwre_sroot)/tools/bld/src/$(os_name)/variables.mk
endif
ifndef rules_mk
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
endif
ifndef rules_mk
include $(pwre_sroot)/tools/bld/src/$(os_name)/rules.mk
endif
.SUFFIXES:
.PHONY : all init copy lib exe clean realclean \
$(clean_ge)
all : init copy lib exe
init : dirs
copy :
lib :
exe : $(bld_dir)/control_pwrrt $(bld_dir)/control_pwr $(bld_dir)/control_pwrdemo $(bld_dir)/control_pwrsev
clean :
realclean :
dirs : $(bld_dir)$(dir_ext)
$(bld_dir)$(dir_ext) :
@ $(mkdir) -p $(mkdirflags) $(basename $@)
$(bld_dir)/control_pwrrt : ../../../pwrrt/control
@ echo "build $(target)"
@ ../../../pwrrt/build.sh
@ cp $(source) $(target)
$(bld_dir)/control_pwr : ../../../pwr/control
@ echo "build $(target)"
@ ../../../pwr/build.sh
@ cp $(source) $(target)
$(bld_dir)/control_pwrdemo : ../../../pwrdemo/control
@ echo "build $(target)"
@ ../../../pwrdemo/build.sh
@ cp $(source) $(target)
$(bld_dir)/control_pwrsev : ../../../pwrsev/control
@ echo "build $(target)"
@ ../../../pwrsev/build.sh
@ cp $(source) $(target)
#!/bin/bash
#
# Startscript fr PWR av Ulf Ljungdahl
#
#test -x /sbin/ipchains || exit 0
#test -x /sbin/ipchains-restore || exit 0
#test -x /sbin/ipchains-save || exit 0
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
. /etc/pwrp_profile
save ()
{
echo -n "Saving IP chains: "
TEMPFILE="`tempfile`"
echo "${SAVEFILEHEADER}" >"${TEMPFILE}" && /sbin/ipchains-save >>"${TEMPFILE}" 2>/dev/null
cat "${TEMPFILE}" >/etc/ipchains.save
rm "${TEMPFILE}"
}
pwr_start()
{
$pwr_exe/rt_ini &
sleep 5
/usr/sbin/setrtprio `ps ax | grep "plc" | grep -v "grep" | awk '{ print $1}'`
}
pwr_stop()
{
kill -9 `ps ax | grep "rt_neth_acp" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_neth" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_qmon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_emon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_tmon" | awk '{ print $1}'`
kill -9 `ps ax | grep "rt_\|/pwr/exe/rs" | awk '{ print $1}'`
kill -9 `ps ax | grep "\[rt_" | awk '{ print $1}'`
kill -9 `ps ax | grep "plc_" | awk '{ print $1}'`
kill -9 `ps ax | grep "jpwr.rt" | awk '{ print $1}'`
kill -9 `ps ax | grep "rs_nmps" | awk '{ print $1}'`
kill -9 `ps ax | grep "rs_remote" | awk '{ print $1}'`
if [ -u $pwr_exe/rt_ini ]; then
user=`ls -al $pwr_exe/rt_ini | awk '{ print $3}'`
else
user=$USER
fi
echo "User $user"
eval `ipcs -s|grep ^0x|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm sem %s;", $2
}'`
# remove message queues
eval `ipcs -q|grep ^0x|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm msg %s;", $2
}'`
# remove shared memory
eval `ipcs -m|grep ^0x|grep "[ \t]$user[ \t]"|awk '{printf "ipcrm shm %s;", $2
}'`
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
source $pwrp_exe/pwrp_stop.sh
fi
rm /tmp/pwr*$PWR_BUS_ID
#rm -f /tmp/pwr*
#id=`ipcs -s | grep $user | awk '{print $2}'`
#id1=`echo $id | awk '{print $1}'`
#id2=`echo $id | awk '{print $2}'`
#id3=`echo $id | awk '{print $3}'`
#ipcrm sem $id1
#ipcrm sem $id2
#ipcrm sem $id3
#id=`ipcs -q | grep $user | awk '{print $2}'`
#id1=`echo $id | awk '{print $1}'`
#id2=`echo $id | awk '{print $2}'`
#id3=`echo $id | awk '{print $3}'`
#ipcrm msg $id1
#ipcrm msg $id2
#ipcrm msg $id3
}
case "$1"
in
start)
echo "Startar PWR..."
#if [ 'test -x ps aux | grep plc | grep -v grep' ]
# then
# echo "PWR kr, stoppar det frst.."
# pwr_stop
# fi
pwr_start
echo "Klar."
;;
stop)
echo "Stoppar PWR..."
pwr_stop
# if [ "${SAVEONCE}" != "yes" ]
# then
# save
# echo -n "ipchains-save"
# else
# echo -n "Clearing IP chains:"
# fi
echo "Klar"
;;
restart)
echo "Startar om PWR."
echo "Stoppar det frst."
pwr_stop
sleep 1
echo "Startar igen."
pwr_start
echo "Klar."
;;
*)
echo "Usage:{start|stop|restart}" >&2
#echo "Ingen parameter angiven, startar PWR"
#$0 start
exit 1
;;
esac
exit 0
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
umask 022
# the rest of this file is commented out.
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
# set PATH so it includes user's private bin if it exists
#if [ -d ~/bin ] ; then
# PATH=~/bin:"${PATH}"
#fi
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files for examples
source /etc/pwrp_profile
# If running interactively, then:
if [ "$PS1" ]; then
# enable color support of ls and also add handy aliases
eval `dircolors -b`
alias ls='ls --color=auto'
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
# set a fancy prompt
PS1='\u@\h:\w\$ '
# If this is an xterm set the title to user@host:dir
#case $TERM in
#xterm*)
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# ;;
#*)
# ;;
#esac
fi
!!
!! Root Menu Description for users
!!
Menu DefaultRootMenu
{
"User Menu" f.title
! "XTT OP-bilder" f.exec "~/.xtt_start &"
"XTT" f.exec "~/.xtt_start &"
"RTT" f.exec "/usr/bin/X11/xterm -T RTT -e ~/.rtt_start &"
"PSS-kort" f.exec "/usr/bin/X11/xterm -T PSS_Kort -e /usr/bin/minicom &"
"Xterm" f.exec "/usr/bin/X11/xterm -T XTerm -sb -right &"
"Klocka" f.exec "/usr/bin/X11/xclock &"
"Miniraknare" f.exec "/usr/bin/X11/xcalc &"
! "Shuffle Up" f.circle_up
! "Shuffle Down" f.circle_down
"Refresh" f.refresh
! "Pack Icons" f.pack_icons
! "Toggle Behavior..." f.set_behavior
no-label f.separator
! "Starta om X" f.restart
"Logga ut" f.quit_mwm
"Starta om dator" f.exec "/usr/bin/rebootreq &"
"Stang av dator" f.exec "/usr/bin/haltreq &"
}
!!
!! Default Window Menu
!!
Menu DefaultWindowMenu
{
"Make Pinned" f.toggle_pin_state
no-label f.separator
Restore _R Alt<Key>F5 f.restore
Move _M Alt<Key>F7 f.move
Size _S Alt<Key>F8 f.resize
Minimize _n Alt<Key>F9 f.minimize
Maximize _x Alt<Key>F10 f.maximize
Raise _a Alt<Key>F2 f.raise
Lower _L Alt<Key>F3 f.lower
no-label f.separator
Close _C Alt<Key>F4 f.kill
}
!!
!! Default Key Bindings
!!
Keys DefaultKeyBindings
{
Shift<Key>Escape window|icon f.post_wmenu
Alt<Key>space window|icon f.post_wmenu
Alt<Key>Tab root|icon|window f.next_key
Alt Shift<Key>Tab root|icon|window f.prev_key
Alt<Key>Escape root|icon|window f.circle_down
Alt Shift<Key>Escape root|icon|window f.circle_up
Alt Shift Ctrl<Key>exclam root|icon|window f.set_behavior
Alt<Key>F6 window f.next_key transient
Alt Shift<Key>F6 window f.prev_key transient
Shift<Key>F10 icon f.post_wmenu
Alt Shift<Key>Delete root|icon|window f.restart
}
!!
!! Button Binding Description(s)
!!
!! These can be used anywhere
!!
Buttons DefaultButtonBindings
{
<Btn1Down> icon|frame f.raise
<Btn3Down> icon|frame f.post_wmenu
<Btn3Down> root f.menu DefaultRootMenu
}
!!
!! These are some example bindings that you might use if your
!! keyboardFocusPolicy is "explicit". Note that to use these, you'll
!! have to change the Mwm*buttonBindings resource in Mwm to
!! ExplicitButtonBindings instead of DefaultButtonBindings.
!!
Buttons ExplicitButtonBindings
{
<Btn1Down> frame|icon f.raise
<Btn3Down> frame|icon f.post_wmenu
<Btn3Down> root f.menu DefaultRootMenu
! <Btn1Up> icon f.restore
Alt<Btn1Down> window|icon f.lower
! Alt<Btn2Down> window|icon f.resize
! Alt<Btn3Down> window|icon f.move
}
!! These are some example bindings that you might use if your
!! keyboardFocusPolicy is "pointer". Note that to use these, you'll
!! have to change the Mwm*buttonBindings resource in Mwm to
!! PointerButtonBindings instead of DefaultButtonBindings.
!!
Buttons PointerButtonBindings
{
<Btn1Down> frame|icon f.raise
<Btn3Down> frame|icon f.post_wmenu
<Btn3Down> root f.menu DefaultRootMenu
<Btn1Down> window f.raise
! <Btn1Up> icon f.restore
Alt<Btn1Down> window|icon f.lower
! Alt<Btn2Down> window|icon f.resize
! Alt<Btn3Down> window|icon f.move
}
!include-menu-defs
#Automatically generated file. Do not edit (see /usr/doc/menu/html/index.html)
Menu "/Debian/Apps/Editors"
{
"Editors" f.title
"Emacs 20" f.exec "/usr/bin/emacs20 &"
"NEdit" f.exec "/usr/bin/X11/nedit &"
"Xedit" f.exec "xedit &"
}
Menu "/Debian/Apps/Graphics"
{
"Graphics" f.title
"Bitmap" f.exec "bitmap &"
}
Menu "/Debian/Apps/Math"
{
"Math" f.title
"Xcalc" f.exec "xcalc &"
"bc" f.exec "x-terminal-emulator -T 'bc' -e /usr/bin/bc &"
"dc" f.exec "x-terminal-emulator -T 'dc' -e /usr/bin/dc &"
}
Menu "/Debian/Apps/Net"
{
"Net" f.title
"Lynx" f.exec "x-terminal-emulator -T 'Lynx' -e /usr/bin/lynx &"
"Telnet" f.exec "x-terminal-emulator -T 'Telnet' -e telnet &"
"Xbiff" f.exec "xbiff &"
}
Menu "/Debian/Apps/Programming"
{
"Programming" f.title
"Gdb" f.exec "x-terminal-emulator -T 'Gdb' -e /usr/bin/gdb &"
"Python (v2.1)" f.exec "x-terminal-emulator -T 'Python (v2.1)' -e /usr/bin/python2.1 &"
"Tclsh8.0" f.exec "x-terminal-emulator -T 'Tclsh8.0' -e /usr/bin/tclsh8.0 &"
"Tclsh8.2" f.exec "x-terminal-emulator -T 'Tclsh8.2' -e /usr/bin/tclsh8.2 &"
"Tclsh8.3" f.exec "x-terminal-emulator -T 'Tclsh8.3' -e /usr/bin/tclsh8.3 &"
"TkWish8.0" f.exec "x-terminal-emulator -T 'TkWish8.0' -e /usr/bin/wish8.0 &"
"TkWish8.3" f.exec "/usr/bin/wish8.3 &"
}
Menu "/Debian/Apps/Shells"
{
"Shells" f.title
"Bash" f.exec "x-terminal-emulator -T 'Bash' -e /bin/bash -login &"
"Sh" f.exec "x-terminal-emulator -T 'Sh' -e /bin/sh -login &"
"Tcsh" f.exec "x-terminal-emulator -T 'Tcsh' -e /usr/bin/tcsh &"
}
Menu "/Debian/Apps/System/Admin"
{
"Admin" f.title
"Lilo-config" f.exec "x-terminal-emulator -T 'Lilo-config' -e /usr/sbin/su-to-root -p root -c /usr/sbin/liloconfig &"
"gpm-config" f.exec "x-terminal-emulator -T 'gpm-config' -e /usr/sbin/su-to-root -p root -c /usr/sbin/gpmconfig &"
}
Menu "/Debian/Apps/System"
{
"System" f.title
"Admin" f.menu "/Debian/Apps/System/Admin"
"Task selector" f.exec "x-terminal-emulator -T 'Task selector' -e su-to-root /usr/bin/tasksel &"
"Top" f.exec "x-terminal-emulator -T 'Top' -e /usr/bin/top &"
"Xconsole" f.exec "xconsole &"
"Xload" f.exec "xload &"
"Xvidtune" f.exec "xvidtune &"
"pstree" f.exec "/etc/alternatives/x-terminal-emulator -e /usr/bin/pstree.x11 &"
}
Menu "/Debian/Apps/Tools"
{
"Tools" f.title
"Editres" f.exec "editres &"
"Oclock" f.exec "oclock &"
"X Window Snapshot" f.exec "xwd | xwud &"
"Xclipboard" f.exec "xclipboard &"
"Xclock (analog)" f.exec "xclock -analog &"
"Xclock (digital)" f.exec "xclock -digital -update 1 &"
"Xcutsel" f.exec "xcutsel &"
"Xev" f.exec "x-terminal-emulator -e xev &"
"Xfontsel" f.exec "xfontsel &"
"Xkill" f.exec "xkill &"
"Xmag" f.exec "xmag &"
"Xrefresh" f.exec "xrefresh &"
}
Menu "/Debian/Apps/Viewers"
{
"Viewers" f.title
"GV" f.exec "/usr/bin/X11/gv &"
"XDvi" f.exec "/usr/bin/xdvi &"
"Xditview" f.exec "xditview &"
}
Menu "/Debian/Apps"
{
"Apps" f.title
"Editors" f.menu "/Debian/Apps/Editors"
"Graphics" f.menu "/Debian/Apps/Graphics"
"Math" f.menu "/Debian/Apps/Math"
"Net" f.menu "/Debian/Apps/Net"
"Programming" f.menu "/Debian/Apps/Programming"
"Shells" f.menu "/Debian/Apps/Shells"
"System" f.menu "/Debian/Apps/System"
"Tools" f.menu "/Debian/Apps/Tools"
"Viewers" f.menu "/Debian/Apps/Viewers"
}
Menu "/Debian/Games/Toys"
{
"Toys" f.title
"Xeyes" f.exec "xeyes &"
"Xlogo" f.exec "xlogo &"
}
Menu "/Debian/Games"
{
"Games" f.title
"Toys" f.menu "/Debian/Games/Toys"
}
Menu "/Debian/Help"
{
"Help" f.title
"Info" f.exec "x-terminal-emulator -T 'Info' -e info &"
"Xman" f.exec "xman &"
}
Menu "/Debian/Screen/Root-window"
{
"Root-window" f.title
"Xsetroot" f.exec "xsetroot &"
}
Menu "/Debian/Screen/Save"
{
"Save" f.title
"Beforelight" f.exec "beforelight &"
}
Menu "/Debian/Screen"
{
"Screen" f.title
"Root-window" f.menu "/Debian/Screen/Root-window"
"Save" f.menu "/Debian/Screen/Save"
}
Menu "/Debian/XShells"
{
"XShells" f.title
"XTerm" f.exec "xterm &"
"XTerm (Unicode)" f.exec "uxterm &"
}
Menu "/Debian"
{
"Debian" f.title
"Apps" f.menu "/Debian/Apps"
"Games" f.menu "/Debian/Games"
"Help" f.menu "/Debian/Help"
"Screen" f.menu "/Debian/Screen"
"XShells" f.menu "/Debian/XShells"
}
#!/bin/bash
ource /etc/pwrp_profile
$pwr_exe/rt_rtt
xsetroot -solid darkcyan
xhost +localhost
~/.xtt_start
xset s off s noblank s noexpose -dpms
exec mwm
#!/bin/bash
source /etc/pwrp_profile
$pwr_exe/rt_xtt &
!** Description: Wtt initialization file
! This file is generated at 'Set settings'
! Dont make any changes, use the symbolfile for application setup
if ( IsW1())
set window /width=600 /height=600
two
set inputfocus w1
endif
if ( IsW1())
set noadvanceduser /local
set noalltoplevel /local
set showclass /local
set noshowalias /local
set show description/local
set noshowobjref /local
set noshowobjxref /local
set noshowattrref /local
set noshowattrxref /local
endif
if ( IsW2())
set noadvanceduser /local
set noalltoplevel /local
set showclass /local
set noshowalias /local
set show description/local
set noshowobjref /local
set noshowobjxref /local
set noshowattrref /local
set noshowattrxref /local
endif
!** Description: Wtt initialization file
! This file is generated at 'Set settings'
! Dont make any changes, use the symbolfile for application setup
if ( IsW1())
set window /width=600 /height=600
two
set inputfocus w1
endif
if ( IsW1())
set noadvanceduser /local
set noalltoplevel /local
set showclass /local
set noshowalias /local
set show description/local
set noshowobjref /local
set noshowobjxref /local
set noshowattrref /local
set noshowattrxref /local
endif
if ( IsW2())
set noadvanceduser /local
set noalltoplevel /local
set showclass /local
set noshowalias /local
set show description/local
set noshowobjref /local
set noshowobjxref /local
set noshowattrref /local
set noshowattrxref /local
endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment