Urgent: 5000 Euro Reward

message unavailable

5000 Euro Belohnung / 5000 Euro Reward --------------------------------------Ich biete eine Belohnung von 5000 Euro wenn mir jemand verraetwie ein Streetgame (International Money Game) die Leute um den Spieler herrum beeinflusst.Ich stecke in genau diesem Unfug drin und irgendjemand manipuliertalle Leute, denen ich begegne und Radio bzw. Fernsehprogramme, dieich beobachte.I offer a reward of 5000 Euro if anybody tells me how a streetgame(International Money Game) manipulates the people around the player.I’m currently trapped in something like that and somebody manipulateseverybody I meet and radio or TV programs I watch or listen to.http://www.fastenrath.net/, http://slashdot.org/~fastenrath/Bernhard FastenrathSteinfelder Gasse 1, 50670 Koeln, Germanyfon: +49-173-5166326fax: +49-69-13306976636email: fasten@hrs.com

Warren Peece <warren@nospam.com> wrote:
WP > Bill,

WP > I had run into an issue where the PostScript printer driver was
WP > EXTENDING clipping regions under certain circumstances. I never got it
WP > to truncate anything, but it sounds like a vaguely similar sort of
WP > clipping issue. There was a fix for the truncation thing with text, but
WP > there was still a lingering clipping issue that was not addressed to the
WP > best of my knowledge. The clipping appeared to get “confused” at times,
WP > then would self-correct a number of line draws later. Over all the
WP > printing thing seems to mostly work, but there are a few “gotchas”
WP > waiting to byte you in the widget. :-0

WP > What printer driver are you using? If possible, try a different one
WP > (eg: try a PCL driver if you were using PostScript). You can also save
WP > the PostScript output to a file and see what the driver is doing or not
WP > doing, if you like to read that sort of thing.

I am using the PCL driver. I’m printing to a network printer. but, remember
all does work when I use Snapshot to print to the same printer.

I don’t have access to a Postscript printer but I guess I’ll look around
for one.

Also, it’s only the longer strings, or the strings with the larger font that
aer getting clipped.

I tried to upload the PHS files, but I can’t seem to generate valid PHS
files. Again, I don’t know why.

What can I use to look at a PHS file?

Bill,

I had run into an issue where the PostScript printer driver was
EXTENDING clipping regions under certain circumstances. I never got it
to truncate anything, but it sounds like a vaguely similar sort of
clipping issue. There was a fix for the truncation thing with text, but
there was still a lingering clipping issue that was not addressed to the
best of my knowledge. The clipping appeared to get “confused” at times,
then would self-correct a number of line draws later. Over all the
printing thing seems to mostly work, but there are a few “gotchas”
waiting to byte you in the widget. :-0

What printer driver are you using? If possible, try a different one
(eg: try a PCL driver if you were using PostScript). You can also save
the PostScript output to a file and see what the driver is doing or not
doing, if you like to read that sort of thing.

Cheers,
-Warren “WYSIWYMG” Peece
(M = might)



Bill Caroselli wrote:

I have been working on an application that prints text and graphics to a
PtRaw widget. It is now working as expected.

I added a “Print” button under the PtRaw widget and when clicked on it
sets a switch and calls the same draw function as the PtWidget calls.

This is essentially working, but . . .

many of the longer text strings are being truncated in the middle of
characters.

Also, some of the text strings have what looks like a portion of a character
before the first character to be printed. The first character to be printed
IS in the correct place, there’s just a pen stroke in front of it.

This is my first attempt to write a photon app that prints to paper. So
far I’m impressed at how easy it was. But I’m at a complete loss to explain
the text string issues.

What have I not yet learned about printing text to a print context?

P.S. I also tried to print both with the snap shot utility and from my
application to a PHS file to upload them so that you can see what I see. But
both PHS files were invalid.

I can use the snap shot utility to print to paper and it looks just fine.

Bill Caroselli <qtps@earthlink.net> wrote:
BC > Warren Peece <warren@nospam.com> wrote:
BC > WP > Bill,

BC > WP > I had run into an issue where the PostScript printer driver was
BC > WP > EXTENDING clipping regions under certain circumstances. I never got it
BC > WP > to truncate anything, but it sounds like a vaguely similar sort of
BC > WP > clipping issue. There was a fix for the truncation thing with text, but
BC > WP > there was still a lingering clipping issue that was not addressed to the
BC > WP > best of my knowledge. The clipping appeared to get “confused” at times,
BC > WP > then would self-correct a number of line draws later. Over all the
BC > WP > printing thing seems to mostly work, but there are a few “gotchas”
BC > WP > waiting to byte you in the widget. :-0

BC > WP > What printer driver are you using? If possible, try a different one
BC > WP > (eg: try a PCL driver if you were using PostScript). You can also save
BC > WP > the PostScript output to a file and see what the driver is doing or not
BC > WP > doing, if you like to read that sort of thing.

BC > I am using the PCL driver. I’m printing to a network printer. but, remember
BC > all does work when I use Snapshot to print to the same printer.

BC > I don’t have access to a Postscript printer but I guess I’ll look around
BC > for one.

BC > Also, it’s only the longer strings, or the strings with the larger font that
BC > aer getting clipped.

BC > I tried to upload the PHS files, but I can’t seem to generate valid PHS
BC > files. Again, I don’t know why.

BC > What can I use to look at a PHS file?


Bill Caroselli – Q-TPS Consulting
1-(708) 308-4956 <== Note: New Number
qtps@earthlink.net

The only way I know to look at a PHS file is to use one of the
phs_to_xxx filters. If the PostScript output looks different than the
PCL output, that would indicate something in the printer driver/filter.
I don’t know if snapshot sends an image of the screen as a bitmap or
not, but the PHS file is actually a sequence of draw commands that the
filter then renders to the printer. If there were some documentation on
the draw stream data in a PHS file then in theory you could write your
own printer driver. I wonder if there’s source code for the whole
shabang in the printer DDK that might document things better?

When I was tracking down my printing issue, I’d save the PHS file then
run it through the various filters to compare the output on different
printers. I never bothered to try to analyze the PHS file.

The printing thing is just whacky enough that I still consider going
native and writing my own printing library. Of course all I’m doing is
reports, basically text and lines, no actual “widget” printing. I’ve
decided to stick with PostScript as the actual amount of data that goes
to the printer is significantly smaller and quicker to generate than
either the PCL or Epson formats.

Cheers,
-Warren “rasterfarian” Peece



Bill Caroselli wrote:

Warren Peece <> warren@nospam.com> > wrote:
WP > Bill,

WP > I had run into an issue where the PostScript printer driver was
WP > EXTENDING clipping regions under certain circumstances. I never got it
WP > to truncate anything, but it sounds like a vaguely similar sort of
WP > clipping issue. There was a fix for the truncation thing with text, but
WP > there was still a lingering clipping issue that was not addressed to the
WP > best of my knowledge. The clipping appeared to get “confused” at times,
WP > then would self-correct a number of line draws later. Over all the
WP > printing thing seems to mostly work, but there are a few “gotchas”
WP > waiting to byte you in the widget. :-0

WP > What printer driver are you using? If possible, try a different one
WP > (eg: try a PCL driver if you were using PostScript). You can also save
WP > the PostScript output to a file and see what the driver is doing or not
WP > doing, if you like to read that sort of thing.

I am using the PCL driver. I’m printing to a network printer. but, remember
all does work when I use Snapshot to print to the same printer.

I don’t have access to a Postscript printer but I guess I’ll look around
for one.

Also, it’s only the longer strings, or the strings with the larger font that
aer getting clipped.

I tried to upload the PHS files, but I can’t seem to generate valid PHS
files. Again, I don’t know why.

What can I use to look at a PHS file?

Hi Bill,

You can use the preview app to look at a phs file.
So run “preview <app_name>.phs”

Regards
Brenda


“Bill Caroselli” <qtps@earthlink.net> wrote in message
news:c49kst$bnj$1@inn.qnx.com

Bill Caroselli <> qtps@earthlink.net> > wrote:
BC > Warren Peece <> warren@nospam.com> > wrote:
BC > WP > Bill,

BC > WP > I had run into an issue where the PostScript printer driver was
BC > WP > EXTENDING clipping regions under certain circumstances. I never
got it
BC > WP > to truncate anything, but it sounds like a vaguely similar sort
of
BC > WP > clipping issue. There was a fix for the truncation thing with
text, but
BC > WP > there was still a lingering clipping issue that was not
addressed to the
BC > WP > best of my knowledge. The clipping appeared to get “confused” at
times,
BC > WP > then would self-correct a number of line draws later. Over all
the
BC > WP > printing thing seems to mostly work, but there are a few
“gotchas”
BC > WP > waiting to byte you in the widget. :-0

BC > WP > What printer driver are you using? If possible, try a different
one
BC > WP > (eg: try a PCL driver if you were using PostScript). You can
also save
BC > WP > the PostScript output to a file and see what the driver is doing
or not
BC > WP > doing, if you like to read that sort of thing.

BC > I am using the PCL driver. I’m printing to a network printer. but,
remember
BC > all does work when I use Snapshot to print to the same printer.

BC > I don’t have access to a Postscript printer but I guess I’ll look
around
BC > for one.

BC > Also, it’s only the longer strings, or the strings with the larger
font that
BC > aer getting clipped.

BC > I tried to upload the PHS files, but I can’t seem to generate valid
PHS
BC > files. Again, I don’t know why.

BC > What can I use to look at a PHS file?


Bill Caroselli – Q-TPS Consulting
1-(708) 308-4956 <== Note: New Number
qtps@earthlink.net

GUI <gui@qnx.com> wrote:
G > Hi Bill,

G > You can use the preview app to look at a phs file.
G > So run “preview <app_name>.phs”

G > Regards
G > Brenda

Hi Brenda

Thanks. I didn’t know about preview.

So I was finally able to create a PHS. I looked at it with preview and it
looks fine.

When I tried to print that same file (from preview) it does exhibit the same
problems that I mentioned previously.

Again:

  1. On the chart title where it is suppoed to say “LACS Calibration” the
    string is cut short in the ‘C’ in Calibration.
  2. There appears to be a curvedf line before the ‘L’ in LACS in the title.
  3. Where it says “Driver Vertical Test - Sept 02, 1969 at 11:20 by Bill
    Caroselli” that string is cut short after “Driver Vertical Test”.
  4. In the left hand margin where it says “Target” there is a little ‘r’
    before the Target.
  5. On the bottom where is says “Standard Load Cells (Kips)” that is clipped
    in the middle of the ‘e’ in Cells.
  6. On the bottom where is says “Unit # 479 (S/N 3.141592654) -
    LACS-19690902-1120.dat” it prints as “Unit # 479 (S/N 969” with the ‘9’
    being clipped. (Note: that string was multiple PpDrawText() calls.)

I’m not sure how to attach a file using tin. I will e-mail the print1.phs
file to you.

Where is the best place to read documentation on all of the PpSetPC()
members. I’ve seen the helpviewer page for PpSetPC(). It falls short.

What I’m looking for is the definition of all of the members
and what the expected values should be.

I’ve even looked for header files for help but haven’t found any.

Bill Caroselli <qtps@earthlink.net> wrote:
BC > Where is the best place to read documentation on all of the PpSetPC()
BC > members. I’ve seen the helpviewer page for PpSetPC(). It falls short.

BC > What I’m looking for is the definition of all of the members
BC > and what the expected values should be.

BC > I’ve even looked for header files for help but haven’t found any.

I have discovered the helpviewer page for PpPrintContext_t.
This help a lot.

What is the difference between Pp_PC_MARGINS
and Pp_PC_NONPRINT_MARGINS ?

BC > What is the difference between Pp_PC_MARGINS
BC > and Pp_PC_NONPRINT_MARGINS ?

I was still looking for an answer to this.
Are the margins added together?

New Question:

Is there a way to dup a print context?

What I want to do is to allow the first page to start printing while I
am still generating the second page. But I don’t want to make the user
have to go to the printer dialog a second time. I want to use all of the
same parameters that they entered the first time on the second page. I
know I can copy each field seperately but I was hoping there was a
convienence function to just create a new print context with the same
parameters.

Crossposted to qnx.gui, since no answer in qnx.sysadmin …

Perhaps Wojtek has an idea … :slight_smile:

Karsten P. Hoffmann wrote:

Hi NG,

does anybody know, how I can make Photon able to switch between two
keyboard layouts directly after start up the ALT-SHIFT key stroke?

What I found out is, that I can switch between e.g. russian and german
layout, when I select both layouts one after the other in ‘phlocale’.
Pressing ALT-SHIFT toggles between both.
If I select another layout (e.g.french) I can toggle between all three.

But how can I achieve this by a simple configuration turing startup?

Another question: is this documented somewhere? We found the ALT-SHIFT
thing by chance > :slight_smile:> )

TIA,

Karsten.

PS: I’m specially interested in switching between US-keyboard and russian
layout.


Karsten P. Hoffmann <karsten.p.hoffmann@web.de>
“I love deadlines. I especially like the whooshing sound
they make as they go flying by.”
[In memoriam Douglas Adams, 1952-2001]

Karsten P. Hoffmann wrote:

Crossposted to qnx.gui, since no answer in qnx.sysadmin …

Perhaps Wojtek has an idea … > :slight_smile:

I have to admit that I have never heard of this feature before. And I
hate to say this, but it looks like a bit of a bug to me, or at least a
misunderstading.

Phlocale sends an message to devi-hirun that used to just set a new
keyboard layout. But, apparently, devi-hirun has changed, and now keeps
the old layout on a list of all layouts that it has ever seen, and lets
you cycle through that list using Alt-Shift. It’s a great thing to have
such a list and to be able to cycle through it using a keychord, but
like you noticed, it’s not very useful without a decent UI to maintain
the list and a way to preserve it across reboots.

Karsten P. Hoffmann wrote:

Hi NG,

does anybody know, how I can make Photon able to switch between two
keyboard layouts directly after start up the ALT-SHIFT key stroke?

What I found out is, that I can switch between e.g. russian and german
layout, when I select both layouts one after the other in ‘phlocale’.
Pressing ALT-SHIFT toggles between both.
If I select another layout (e.g.french) I can toggle between all three.

But how can I achieve this by a simple configuration turing startup?

Another question: is this documented somewhere? We found the ALT-SHIFT
thing by chance > :slight_smile:> )

TIA,

Karsten.

PS: I’m specially interested in switching between US-keyboard and russian
layout.

Wojtek Lerch wrote:

Phlocale sends an message to devi-hirun that used to just set a new
keyboard layout. But, apparently, devi-hirun has changed, and now keeps
the old layout on a list of all layouts that it has ever seen, and lets
you cycle through that list using Alt-Shift. It’s a great thing to have
such a list and to be able to cycle through it using a keychord, but
like you noticed, it’s not very useful without a decent UI to maintain
the list and a way to preserve it across reboots.

FYI: I have just found out that this is already being worked on.

Wojtek Lerch wrote:

FYI: I have just found out that this is already being worked on.

Does this mean, the ‘bug-feature’ is going to be removed
or will it get a UI :slight_smile:


\

MBS GmbH E-Mail: karsten.hoffmann@mbs-software.de
Römerstraße 15 Tel: +49 / 2151 / 72 94-38
D-47809 Krefeld Fax: +49 / 2151 / 72 94-50
http://www.mbs-software.de Mobil: +49 / 172 / 38 12 373

Karsten P. Hoffmann wrote:

Does this mean, the ‘bug-feature’ is going to be removed
or will it get a UI > :slight_smile:

Get a UI. I can’t promise you when though.

Hallo Karsten,

Information about international keyboard is readed from file
/etc/system/trap/.KEYBOARD.host_name when start inputtrap ( devi-hirun
have some option like ‘filter keyboard -k kbd_file’ )

If you want use more keyboard layouts after start up, modify this file
(add names of keyboard files ).

Example for 3 keyboard layouts:
en_US_101.kbd
sk_SK_102.kbd
de_DE_102.kbd

Disadvantage - phlocale utility modify this file after you change
Language, Keyboard or Timezone setting. ( You can check this file when
start computer )

My be it can help to you.

Regards
Marian.

Marian Oklapek wrote:

If you want use more keyboard layouts after start up, modify this file
(add names of keyboard files ).

Example for 3 keyboard layouts:
en_US_101.kbd
sk_SK_102.kbd
de_DE_102.kbd

That’s exactly the UI, we need :slight_smile:))

Disadvantage - phlocale utility modify this file after you change
Language, Keyboard or Timezone setting. ( You can check this file when
start computer )

No problems, since we don’t use phlocale for our customer’s machine setups.

I hope, this ‘undocumented feature’ will persist the ongoing change and will
be available in QNX6.3, too.

Thanks a lot!


Mit freundlichen Grüßen aus Krefeld,
With best regards from Krefeld,

MBS GmbH
Karsten Hoffmann


MBS GmbH E-Mail: karsten.hoffmann@mbs-software.de
Römerstraße 15 Tel: +49 / 2151 / 72 94-38
D-47809 Krefeld Fax: +49 / 2151 / 72 94-50
http://www.mbs-software.de Mobil: +49 / 172 / 38 12 373

Rodney Dowdall wrote:

Can you please post the code where you added the extra widget? You have
to make sure that the mapping in the Display class is correct. If it is
off it will cause this problem.

I added widgets as this article recommends:

http://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm

By the way I moved all native calls for printing in separate library
so that I don’t need to recompile SWT native but printing also doesn’t
work. At first photon call (PpCreatePC) j9 throws unhandeled exception.

This is the widget class:
package org.eclipse.swt.widgets;

import org.eclipse.swt.internal.;
import org.eclipse.swt.internal.photon.
;
import org.eclipse.swt.;
import org.eclipse.swt.graphics.
;
import org.eclipse.swt.events.*;

/**

  • Wrapper around Photon PtTrend widget
    */
    public class Trend extends Composite {
    int handleTrend;
    private static final int Pt_ARG_TREND_FLAGS = 0x11D2F;
    private static final int Pt_ARG_TREND_GRID_COLOR = 0x11D30;
    private static final int Pt_ARG_TREND_GRID_X = 0x11D29;
    private static final int Pt_ARG_TREND_GRID_Y = 0x11D2A;
    private static final int Pt_ARG_TREND_COUNT = 0x11D2B;
    private static final int Pt_ARG_TREND_COLOR_LIST = 0x11D31;
    private static final int Pt_ARG_TREND_ATTRIBUTES = 0x11D32;
    private static final int Pt_ARG_TREND_DATA = 0x11D28;
    private static final int Pt_ARG_TREND_MAX = 0x11D2C;
    private static final int Pt_ARG_TREND_MIN = 0x11D2D;

private static final int Pt_GRID = 2;
private static final int Pt_GRID_IS_TRANSLUCENT = 0x400;
private static final int Pt_GRID_FORCE = 0x800;
private static final int Pt_RESULT_GRID = (Pt_GRID |
Pt_GRID_IS_TRANSLUCENT | Pt_GRID_FORCE);

private double min = 0,max = 100;
private short trendMin, trendMax;
private int [] handles = new int[2];

static { System.loadLibrary(“jinf”); }

public Trend(Composite parent, int style) {
// create parent composite
super(parent,style);

// create native widget
// PtOSContainer → handles[0]
// PtTrend → handles[1]
createControl(handle,handles);
handleTrend = handles[1];
if(handleTrend==0) SWT.error(SWT.ERROR_NO_HANDLES);
OS.PtSetResource(handleTrend,Pt_ARG_TREND_COUNT,1,0);
addControlListener(new ControlAdapter(){
public void controlResized(ControlEvent e) {
Rectangle rect = getClientArea();
resizeControl(handles[0], rect.x, rect.y, rect.width, rect.height);
}
});

addFocusListener( new FocusAdapter() {
public void focusGained(FocusEvent e) {
setFocus(handles[0]);
}
});

/* Get min/mx biunds from trend */
int [] args = new int[] {Pt_ARG_TREND_MIN,0,0};
OS.PtGetResources(handleTrend,args.length / 3,args);
trendMin = (short) args[1];

args = new int[] {Pt_ARG_TREND_MAX,0,0};
OS.PtGetResources(handleTrend,args.length / 3,args);
trendMax = (short) args[1];
}


public Point computeSize(int wHint, int hHint, boolean changed) {
checkWidget();
int [] result = new int[2];
computeSize(handles[0], result);
if (wHint != SWT.DEFAULT) result[0] = wHint;
if (hHint != SWT.DEFAULT) result[1] = hHint;
int border = getBorderWidth();
return new Point(result[0] + border2, result[1] + border2);
}


/** Enables the graphic widget to draw grid if argument is
true

  • and disabes it otherwise.
  • @param flag the new grid state /
    public void setGrid(boolean flag) {
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_FLAGS, ((flag) ? -1 :
    0), Pt_RESULT_GRID);
    }


    /
    *
  • Set grid’s lines color
    /
    public void setGridColor(Color c){
    int color = (c.getRed() & 0xff) << 16 | (c.getGreen() & 0xff) << 8 |
    (c.getBlue() & 0xff);
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_GRID_COLOR, color, 0);
    }


    /
    *
  • Set grid dimensions
    /
    public void setGridSize(int x,int y){
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_GRID_X, x, 0);
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_GRID_Y, y, 0);
    }


    /
    *
  • Set min/max boundaries for the trend
    /
    public void setMinMaxBounds(double min,double max){
    this.min = min; this.max = max;
    }


    /
    *
  • Set pen’s color
    */
    public void setPenColor(Color c){
    int color = (c.getRed() & 0xff) << 16 | (c.getGreen() & 0xff) << 8 |
    (c.getBlue() & 0xff);
    int [] jarray = new int[] {color};
    int ptr = OS.malloc(4);
    OS.memmove(ptr,jarray,4);
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_COLOR_LIST, ptr, 1);

jarray[0] = 1; // number of color here
OS.memset(ptr,0,4);
OS.memmove(ptr,jarray,4);

OS.PtSetResource(handleTrend,Pt_ARG_TREND_ATTRIBUTES,ptr,1);
OS.free(ptr);
}


/**

  • Push data at end of trend
    */
    public void pushData(double v){
    if(v>max) v = max;
    if(v<min) v = min;
    short data = (short)(v * (trendMax-trendMin)/(max-min) + trendMin);
    int [] jarray = new int[] {data};
    int ptr = OS.malloc(4);
    OS.memmove(ptr,jarray,4);
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_DATA,ptr,1);
    OS.free(ptr);
    }

static final native int createControl(int handleParent,int [] res);
static final native void resizeControl(int handle, int x, int y, int
width, int height);
static final native void setFocus(int handle);
static final native void computeSize(int handle, int [] result);
}

This is the native code:

#include <unistd.h>
#include <jni.h>
#include <math.h>

#include <Ph.h>
#include <Pt.h>

#define NATIVE(func) Java_org_eclipse_swt_widgets_Trend_##func

/**

  • PtOSContainer → [0]
  • PtTrend → [1]
    */
    JNIEXPORT jint JNICALL NATIVE(createControl)(JNIEnv *env, jclass that,
    jint parent, jintArray handles) {
    jint *result = (*env)->GetIntArrayElements(env, handles, NULL);

result[0] = (jint) PtCreateWidget(PtOSContainer,(PtWidget_t*)
parent,0,NULL);
result[1] = (jint) PtCreateWidget(PtTrend,(PtWidget_t*)
result[0],0,NULL);

PtSetResource((PtWidget_t*) result[1], Pt_ARG_ANCHOR_FLAGS, Pt_TRUE,
Pt_LEFT_ANCHORED_LEFT |
Pt_RIGHT_ANCHORED_RIGHT | Pt_TOP_ANCHORED_TOP |
Pt_BOTTOM_ANCHORED_BOTTOM );
(env)->ReleaseIntArrayElements(env, handles, result, 0);
return result[0];
}


JNIEXPORT void JNICALL NATIVE(resizeControl)(JNIEnv
env,jclass
that,jint handle,jint x,jint y,jint width,jint height){
PhArea_t area;
area.pos.x = x;
area.pos.y = y;
area.size.w = width;
area.size.h = height;
PtSetResource((PtWidget_t*)handle,Pt_ARG_AREA,&area,0);
PtUnrealizeWidget((PtWidget_t*)handle);
PtRealizeWidget((PtWidget_t*)handle);
}

JNIEXPORT void JNICALL NATIVE(setFocus)(JNIEnv *env, jclass that, jint
handle){}


JNIEXPORT void JNICALL NATIVE(computeSize)(JNIEnv *env, jclass that,
jint handle, jintArray result){
jint *result1 = (*env)->GetIntArrayElements(env,result,NULL);
PhDim_t dim;

PtWidgetPreferredSize((PtWidget_t*) handle,&dim);
result1[0] = dim.w;
result1[1] = dim.h;
(*env)->ReleaseIntArrayElements(env,result,result1,0);
}

Sergiy Uvarov wrote:

Hi, All.

I use SWT to build gui applications and added some extra widgets to
SWT as eclipse recommending. In QNX6.2.1 all my applications work well
but in QNX6.3 during any photon call in JNI j9 is stopped by
unhandeled exception.

What have changed that I can’t create widget in JNI?


Sergiy Uvarov

Rodney Dowdall wrote:

Can you please post the code where you added the extra widget? You have
to make sure that the mapping in the Display class is correct. If it is
off it will cause this problem.

I added widgets as this article recommends:

http://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm

By the way I moved all native calls for printing in separate library
so that I don’t need to recompile SWT native but printing also doesn’t
work. At first photon call (PpCreatePC) j9 throws unhandeled exception.

This is the widget class:
package org.eclipse.swt.widgets;

import org.eclipse.swt.internal.;
import org.eclipse.swt.internal.photon.
;
import org.eclipse.swt.;
import org.eclipse.swt.graphics.
;
import org.eclipse.swt.events.*;

/**

  • Wrapper around Photon PtTrend widget
    */
    public class Trend extends Composite {
    int handleTrend;
    private static final int Pt_ARG_TREND_FLAGS = 0x11D2F;
    private static final int Pt_ARG_TREND_GRID_COLOR = 0x11D30;
    private static final int Pt_ARG_TREND_GRID_X = 0x11D29;
    private static final int Pt_ARG_TREND_GRID_Y = 0x11D2A;
    private static final int Pt_ARG_TREND_COUNT = 0x11D2B;
    private static final int Pt_ARG_TREND_COLOR_LIST = 0x11D31;
    private static final int Pt_ARG_TREND_ATTRIBUTES = 0x11D32;
    private static final int Pt_ARG_TREND_DATA = 0x11D28;
    private static final int Pt_ARG_TREND_MAX = 0x11D2C;
    private static final int Pt_ARG_TREND_MIN = 0x11D2D;

private static final int Pt_GRID = 2;
private static final int Pt_GRID_IS_TRANSLUCENT = 0x400;
private static final int Pt_GRID_FORCE = 0x800;
private static final int Pt_RESULT_GRID = (Pt_GRID |
Pt_GRID_IS_TRANSLUCENT | Pt_GRID_FORCE);

private double min = 0,max = 100;
private short trendMin, trendMax;
private int [] handles = new int[2];

static { System.loadLibrary(“jinf”); }

public Trend(Composite parent, int style) {
// create parent composite
super(parent,style);

// create native widget
// PtOSContainer → handles[0]
// PtTrend → handles[1]
createControl(handle,handles);
handleTrend = handles[1];
if(handleTrend==0) SWT.error(SWT.ERROR_NO_HANDLES);
OS.PtSetResource(handleTrend,Pt_ARG_TREND_COUNT,1,0);
addControlListener(new ControlAdapter(){
public void controlResized(ControlEvent e) {
Rectangle rect = getClientArea();
resizeControl(handles[0], rect.x, rect.y, rect.width, rect.height);
}
});

addFocusListener( new FocusAdapter() {
public void focusGained(FocusEvent e) {
setFocus(handles[0]);
}
});

/* Get min/mx biunds from trend */
int [] args = new int[] {Pt_ARG_TREND_MIN,0,0};
OS.PtGetResources(handleTrend,args.length / 3,args);
trendMin = (short) args[1];

args = new int[] {Pt_ARG_TREND_MAX,0,0};
OS.PtGetResources(handleTrend,args.length / 3,args);
trendMax = (short) args[1];
}


public Point computeSize(int wHint, int hHint, boolean changed) {
checkWidget();
int [] result = new int[2];
computeSize(handles[0], result);
if (wHint != SWT.DEFAULT) result[0] = wHint;
if (hHint != SWT.DEFAULT) result[1] = hHint;
int border = getBorderWidth();
return new Point(result[0] + border2, result[1] + border2);
}


/** Enables the graphic widget to draw grid if argument is
true

  • and disabes it otherwise.
  • @param flag the new grid state /
    public void setGrid(boolean flag) {
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_FLAGS, ((flag) ? -1 :
    0), Pt_RESULT_GRID);
    }


    /
    *
  • Set grid’s lines color
    /
    public void setGridColor(Color c){
    int color = (c.getRed() & 0xff) << 16 | (c.getGreen() & 0xff) << 8 |
    (c.getBlue() & 0xff);
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_GRID_COLOR, color, 0);
    }


    /
    *
  • Set grid dimensions
    /
    public void setGridSize(int x,int y){
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_GRID_X, x, 0);
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_GRID_Y, y, 0);
    }


    /
    *
  • Set min/max boundaries for the trend
    /
    public void setMinMaxBounds(double min,double max){
    this.min = min; this.max = max;
    }


    /
    *
  • Set pen’s color
    */
    public void setPenColor(Color c){
    int color = (c.getRed() & 0xff) << 16 | (c.getGreen() & 0xff) << 8 |
    (c.getBlue() & 0xff);
    int [] jarray = new int[] {color};
    int ptr = OS.malloc(4);
    OS.memmove(ptr,jarray,4);
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_COLOR_LIST, ptr, 1);

jarray[0] = 1; // number of color here
OS.memset(ptr,0,4);
OS.memmove(ptr,jarray,4);

OS.PtSetResource(handleTrend,Pt_ARG_TREND_ATTRIBUTES,ptr,1);
OS.free(ptr);
}


/**

  • Push data at end of trend
    */
    public void pushData(double v){
    if(v>max) v = max;
    if(v<min) v = min;
    short data = (short)(v * (trendMax-trendMin)/(max-min) + trendMin);
    int [] jarray = new int[] {data};
    int ptr = OS.malloc(4);
    OS.memmove(ptr,jarray,4);
    OS.PtSetResource(handleTrend, Pt_ARG_TREND_DATA,ptr,1);
    OS.free(ptr);
    }

static final native int createControl(int handleParent,int [] res);
static final native void resizeControl(int handle, int x, int y, int
width, int height);
static final native void setFocus(int handle);
static final native void computeSize(int handle, int [] result);
}

This is the native code:

#include <unistd.h>
#include <jni.h>
#include <math.h>

#include <Ph.h>
#include <Pt.h>

#define NATIVE(func) Java_org_eclipse_swt_widgets_Trend_##func

/**

  • PtOSContainer → [0]
  • PtTrend → [1]
    */
    JNIEXPORT jint JNICALL NATIVE(createControl)(JNIEnv *env, jclass that,
    jint parent, jintArray handles) {
    jint *result = (*env)->GetIntArrayElements(env, handles, NULL);

result[0] = (jint) PtCreateWidget(PtOSContainer,(PtWidget_t*)
parent,0,NULL);
result[1] = (jint) PtCreateWidget(PtTrend,(PtWidget_t*)
result[0],0,NULL);

PtSetResource((PtWidget_t*) result[1], Pt_ARG_ANCHOR_FLAGS, Pt_TRUE,
Pt_LEFT_ANCHORED_LEFT |
Pt_RIGHT_ANCHORED_RIGHT | Pt_TOP_ANCHORED_TOP |
Pt_BOTTOM_ANCHORED_BOTTOM );
(env)->ReleaseIntArrayElements(env, handles, result, 0);
return result[0];
}


JNIEXPORT void JNICALL NATIVE(resizeControl)(JNIEnv
env,jclass
that,jint handle,jint x,jint y,jint width,jint height){
PhArea_t area;
area.pos.x = x;
area.pos.y = y;
area.size.w = width;
area.size.h = height;
PtSetResource((PtWidget_t*)handle,Pt_ARG_AREA,&area,0);
PtUnrealizeWidget((PtWidget_t*)handle);
PtRealizeWidget((PtWidget_t*)handle);
}

JNIEXPORT void JNICALL NATIVE(setFocus)(JNIEnv *env, jclass that, jint
handle){}


JNIEXPORT void JNICALL NATIVE(computeSize)(JNIEnv *env, jclass that,
jint handle, jintArray result){
jint *result1 = (*env)->GetIntArrayElements(env,result,NULL);
PhDim_t dim;

PtWidgetPreferredSize((PtWidget_t*) handle,&dim);
result1[0] = dim.w;
result1[1] = dim.h;
(*env)->ReleaseIntArrayElements(env,result,result1,0);
}

Sergiy Uvarov wrote:

Hi, All.

I use SWT to build gui applications and added some extra widgets to
SWT as eclipse recommending. In QNX6.2.1 all my applications work well
but in QNX6.3 during any photon call in JNI j9 is stopped by
unhandeled exception.

What have changed that I can’t create widget in JNI?


Sergiy Uvarov