Commit 00315406 authored by Claes Sjofors's avatar Claes Sjofors

Merge branch 'master'

parents f2b57547 dfb721fd
......@@ -20,7 +20,7 @@ Optional:
Mandatory if you want to build the QT version of ProviewR:
> apt-get install qt4-dev-tools libphonon-dev
> apt-get install libqt4-dev libphonon-dev
Mandatory if you want to build the GTK version of ProviewR:
......@@ -39,15 +39,15 @@ Optional if you build the GTK version of ProviewR:
Unpack the source package
> tar -xzvf pwrsrc_4.8.0.tar.gz
> tar -xzvf pwrsrc_5.6.1.tar.gz
Enter the sourcecode root directory
> cd pwr_4.8.0
> cd pwr_5.6.1
Execute the makefile
Execute the build script
> make
> ./build.sh
When the compilation is finished, follow the instructions to insert the three lines in your .bashrc file.
......@@ -69,15 +69,15 @@ Replace /home/robert/x5-6-1 with the directory where you unpacked the sources.
### 3.2 Creating the environment
Creating and handling your environment is done with the pwre-function (added by sourcing $pwre_bin/pwre_function). See section "Cross-compiling" below about compiling a 32-bit version of ProviewR on a 64-bit machine.
Creating and handling your environment is done with the pwre-function (added by sourcing $pwre_bin/pwre_function). If you want to compile a 32-bit version of ProviewR on a 64-bit machine, see section "Cross-compiling" below.
> pwre
shows all possibilites of the pwre build script.
Add an environment named 'x561x86' (choose any name you like).
Add an environment named 'x561x86_64' (choose any name you like).
> pwre add x561x86
> pwre add x561x86_64
> Source root [...] ? /home/robert/x5-6-1/src (where /home/robert/x5-6-1 is replaced with the directory where you unpacked the sources)
Import root [] ?
......@@ -92,12 +92,12 @@ List all existing environments:
> pwre list
> -- Defined environments:
x460x86
x561x86_64
--
Initiate your new environment:
> pwre init x561x86
> pwre init x561x86_64
Now, create the build tree
......
The core of ProviewR consists of three modules:
1. The WorkBench (WB) used to create PLC programs and graphical interfaces for operators
2. The command-line RunTime (RT) used to start and stop PLC programs
3. The Runtime Viewer (XTT) used to monitor and operate running PLC programs
The source code for ProviewR is organised in layers, where each layers is built on top of, and adds additional functionality to, the layer below. These layers are:
0. src/exp/inc: Basic type definitions and macros.
1. src/lib/co: Library of common (CO) functionality used by all other parts of ProviewR.
2. src/lib/rt: Library of functionality used by the ProviewR RunTime (RT).
3. xtt/lib/cow: Library of common widgets (COW) used by all graphical parts of ProviewR.
4. xtt/lib/flow and xtt/lib/glow: These are small GUI widget libraries. Flow is used by ProviewR itself to draw the WorkBench and Runtime Viewer, while Glow is used to draw the user-created graphical interfaces for operators.
5. xtt/lib/ge: GE is used to create graphical interfaces for operators.
6. xtt/lib/xtt and wb/lib/wb: These libraries contain the graphical widgets used by the xtt/exe and wb/exe executables respectively.
7. src/exe, xtt/exe and wb/exe: These folders contain the code for the actual executables. src/exe contain the command-line RunTime executables, wb/exe contain the executables for the WorkBench (WB), and xtt/exe contain the executables for the Runtime Viewer.
In addition to these, ProviewR comes with a number of plugins that adds support for various hardware, for example: the profibus folder adds support for profibus, etc.
......@@ -1203,23 +1203,19 @@ void FlowDrawGtk::pixmaps_delete(void* pixmaps)
}
void FlowDrawGtk::pixmap(int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx)
void* pixmaps, flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx)
{
flow_sPixmapDataElem* pdata = (flow_sPixmapDataElem*)pixmap_data + idx;
draw_sPixmap* pms = (draw_sPixmap*)pixmaps;
flow_eDrawType gc2 = (gc_type == flow_eDrawType_Line) ?
flow_eDrawType_LineErase : flow_eDrawType_Line;
gdk_draw_rectangle(
w->buffer, gcs[gc2][idx], 1, x, y, pdata->width, pdata->height);
gdk_gc_set_clip_mask(gcs[gc_type][idx], pms->pixmap[idx]);
gdk_gc_set_clip_origin(gcs[gc_type][idx], x, y);
gdk_draw_rectangle(w->buffer, gcs[gc_type][idx], 1, x, y,
w->buffer, gcs[gc_bg][idx], 1, x, y, pdata->width, pdata->height);
gdk_gc_set_clip_mask(gcs[gc_fg][idx], pms->pixmap[idx]);
gdk_gc_set_clip_origin(gcs[gc_fg][idx], x, y);
gdk_draw_rectangle(w->buffer, gcs[gc_fg][idx], 1, x, y,
pdata->width, pdata->height);
gdk_gc_set_clip_mask(gcs[gc_type][idx], NULL);
gdk_gc_set_clip_origin(gcs[gc_type][idx], 0, 0);
gdk_gc_set_clip_mask(gcs[gc_fg][idx], NULL);
gdk_gc_set_clip_origin(gcs[gc_fg][idx], 0, 0);
}
void FlowDrawGtk::image(int x, int y, int width, int height,
......
......@@ -110,7 +110,7 @@ public:
void pixmaps_create(flow_sPixmapData* pixmap_data, void** pixmaps);
void pixmaps_delete(void* pixmaps);
void pixmap(int x, int y, flow_sPixmapData* pixmap_data, void* pixmaps,
flow_eDrawType gc_type, int idx);
flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx);
void set_timer(FlowCtx* ctx, int time_ms, void (*callback_func)(FlowCtx* ctx),
void** id);
......
......@@ -187,6 +187,7 @@ FlowDrawQt::FlowDrawQt(QWidget* x_toplevel, void** flow_ctx,
: toplevel(x_toplevel), closing_down(0)
{
timer_id = new QTimer(this);
draw_timer_id = new QTimer(this);
if (type == flow_eCtxType_Brow) {
ctx = (FlowCtx*)new BrowCtx("Claes context", 20);
......@@ -965,23 +966,18 @@ void FlowDrawQt::pixmaps_delete(void* pixmaps)
delete ((draw_sPixmap*)pixmaps);
}
void FlowDrawQt::pixmap(int x, int y,
flow_sPixmapData* pixmap_data, void* pixmaps, flow_eDrawType painter_type,
int idx)
void FlowDrawQt::pixmap(int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx)
{
flow_sPixmapDataElem* pdata = (flow_sPixmapDataElem*)pixmap_data + idx;
draw_sPixmap* pms = (draw_sPixmap*)pixmaps;
flow_eDrawType gc2 = (painter_type == flow_eDrawType_Line) ?
flow_eDrawType_LineErase : flow_eDrawType_Line;
{
unique_ptr<QPainter> painter = get_painter(gc2, idx);
unique_ptr<QPainter> painter = get_painter(gc_bg, idx);
painter->fillRect(x, y, pdata->width, pdata->height, painter->brush());
}
unique_ptr<QPainter> painter = get_painter(painter_type, idx);
unique_ptr<QPainter> painter = get_painter(gc_fg, idx);
QRegion clipRegion = QRegion(pms->pixmap[idx].createMaskFromColor(Qt::black));
painter->setClipRegion(clipRegion.translated(x, y));
......@@ -1029,13 +1025,9 @@ void FlowDrawQt::set_window_size(DrawWind *wind, int width, int height)
bool FlowDrawQt::draw_timer_cb()
{
FlowDrawQt* draw_ctx = (FlowDrawQt*)timer_cb->ctx->fdraw;
(timer_cb->callback_func)(timer_cb->ctx);
draw_ctx->toplevel->update();
delete timer_cb->timer_id;
delete timer_cb;
draw_timer_id->stop();
(draw_timer_callback_func)(ctx);
toplevel->update();
return FALSE;
}
......@@ -1070,21 +1062,16 @@ void FlowDrawQt::event_timer(FlowCtx* ctx, QMouseEvent* event, QWidget *target)
void FlowDrawQt::set_timer(FlowCtx* ctx, int time_ms,
void (*callback_func)(FlowCtx* ctx), void** id)
{
timer_cb = new flow_draw_sTimerCb();
timer_cb->ctx = ctx;
timer_cb->callback_func = callback_func;
timer_cb->timer_id = new QTimer(this);
initOneShotTimer(timer_cb->timer_id, SLOT(draw_timer_cb()), time_ms);
*id = (void*)timer_cb;
draw_timer_callback_func = callback_func;
initOneShotTimer(draw_timer_id, SLOT(draw_timer_cb()), time_ms);
*id = (void*)draw_timer_id;
}
void FlowDrawQt::cancel_timer(void* id)
void FlowDrawQt::cancel_timer(void* ctx)
{
delete (((flow_draw_sTimerCb*)id)->timer_id);
delete ((char*)id);
if (draw_timer_id) {
draw_timer_id->stop();
}
}
void FlowDrawQt::set_cursor(DrawWind *wind, draw_eCursor cursor)
......
......@@ -52,12 +52,6 @@ public:
QImage* buffer = NULL;
};
typedef struct {
FlowCtx* ctx;
void (*callback_func)(FlowCtx* ctx);
QTimer* timer_id;
} flow_draw_sTimerCb;
class FlowDrawQt : private QObject, public FlowDraw {
Q_OBJECT
......@@ -106,7 +100,7 @@ public:
void image(int x, int y, int width, int height,
flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask);
void pixmap(int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx);
void* pixmaps, flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx);
void pixmaps_create(
flow_sPixmapData* pixmap_data, void** pixmaps);
......@@ -148,11 +142,12 @@ private:
void event_timer(FlowCtx* ctx, QMouseEvent *event, QWidget *target);
void cancel_event_timer(FlowCtx* ctx);
flow_draw_sTimerCb* timer_cb;
void (*draw_timer_callback_func)(FlowCtx* ctx);
QTimer* draw_timer_id;
public slots:
bool event_timer_cb();
bool draw_timer_cb();
};
#endif
\ No newline at end of file
#endif
......@@ -125,7 +125,7 @@ void FlowAnnotPixmap::draw(
ctx->fdraw->pixmap(x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps,
flow_eDrawType_LineErase, idx);
draw_type, flow_eDrawType_LineErase, idx);
}
void FlowAnnotPixmap::draw_inverse(void* pos, int hot, void* node)
......@@ -147,8 +147,8 @@ void FlowAnnotPixmap::draw_inverse(void* pos, int hot, void* node)
x = p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x;
ctx->fdraw->pixmap(x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, ctx->inverse_color,
idx);
((FlowNode*)node)->annotpixmapv[number]->pixmaps,
flow_eDrawType_LineErase, ctx->inverse_color, idx);
}
void FlowAnnotPixmap::erase(void* pos, int hot, void* node)
......@@ -186,7 +186,8 @@ void FlowAnnotPixmap::nav_draw(void* pos, int highlight, void* node)
ctx->fdraw->pixmap(p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, draw_type, idx);
((FlowNode*)node)->annotpixmapv[number]->pixmaps, draw_type,
flow_eDrawType_LineErase, idx);
}
void FlowAnnotPixmap::nav_erase(void* pos, void* node)
......
......@@ -76,7 +76,7 @@ public:
virtual void image(int x, int y, int width, int height, flow_tImImage image,
flow_tPixmap pixmap, flow_tPixmap clip_mask) = 0;
virtual void pixmap(int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx) = 0;
void* pixmaps, flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx) = 0;
virtual void pixmaps_create(flow_sPixmapData* pixmap_data, void** pixmaps) = 0;
virtual void pixmaps_delete(void* pixmaps) = 0;
......
......@@ -107,7 +107,7 @@ void FlowPixmap::draw(void* pos, int highlight, int dimmed, int hot, void* node)
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->pixmap(p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, &pixmap_data, pixmaps,
flow_eDrawType_LineErase, idx);
draw_type, flow_eDrawType_LineErase, idx);
}
void FlowPixmap::draw_inverse(void* pos, int hot, void* node)
......@@ -119,7 +119,7 @@ void FlowPixmap::draw_inverse(void* pos, int hot, void* node)
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->pixmap(p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, &pixmap_data, pixmaps,
flow_eDrawType_Line, idx);
flow_eDrawType_LineErase, draw_type, idx);
}
void FlowPixmap::erase(void* pos, int hot, void* node)
......@@ -144,7 +144,7 @@ void FlowPixmap::nav_draw(void* pos, int highlight, void* node)
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->pixmap(p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y, &pixmap_data,
pixmaps, draw_type, idx);
pixmaps, draw_type, flow_eDrawType_LineErase, idx);
}
void FlowPixmap::nav_erase(void* pos, void* node)
......
......@@ -2202,6 +2202,7 @@ int GeDyn::scan(grow_tObject object)
|| sts == GLOW__SUBTERMINATED || sts == GLOW__SWAPTERMINATED)
return sts;
}
grow_RedrawDefered(graph->grow->ctx);
return 1;
}
......
......@@ -256,6 +256,7 @@ GlowDrawQt::GlowDrawQt(QWidget* toplevel, void** glow_ctx,
: click_sensitivity(0), closing_down(0), customcolors_cnt(0)
{
timer_id = new QTimer(this);
draw_timer_id = new QTimer(this);
memset(customcolors, 0, sizeof(customcolors));
......@@ -1169,13 +1170,9 @@ void GlowDrawQt::set_window_size(DrawWind* wind, int width, int height)
bool GlowDrawQt::draw_timer_cb()
{
GlowDrawQt* draw_ctx = (GlowDrawQt*)timer_cb->ctx->gdraw;
(timer_cb->callback_func)(timer_cb->ctx);
draw_ctx->m_wind.window->update();
delete timer_cb->timer_id;
delete timer_cb;
draw_timer_id->stop();
(draw_timer_callback_func)(ctx);
m_wind.window->update();
return FALSE;
}
......@@ -1208,21 +1205,16 @@ void GlowDrawQt::event_timer(QMouseEvent* event, QWidget *target)
void GlowDrawQt::set_timer(GlowCtx* paintertx, int time_ms,
void (*callback_func)(GlowCtx* ctx), void** id)
{
timer_cb = new glow_draw_sTimerCb();
timer_cb->ctx = paintertx;
timer_cb->callback_func = callback_func;
timer_cb->timer_id = new QTimer(this);
initOneShotTimer(timer_cb->timer_id, SLOT(draw_timer_cb()), time_ms);
*id = (void*)timer_cb;
draw_timer_callback_func = callback_func;
initOneShotTimer(draw_timer_id, SLOT(draw_timer_cb()), time_ms);
*id = (void*)draw_timer_id;
}
void GlowDrawQt::remove_timer(void* id)
{
delete (((glow_draw_sTimerCb*)id)->timer_id);
delete ((char*)id);
if (draw_timer_id) {
draw_timer_id->stop();
}
}
void GlowDrawQt::set_cursor(DrawWind* wind, glow_eDrawCursor cursor)
......
......@@ -69,12 +69,6 @@ public:
QPixmap* background_pixmap = NULL;
};
typedef struct {
GlowCtx* ctx;
void (*callback_func)(GlowCtx* ctx);
QTimer* timer_id;
} glow_draw_sTimerCb;
class GlowCustomColorsQt;
class GlowDrawQt : private QObject, public GlowDraw {
......@@ -196,7 +190,8 @@ private:
void event_timer(QMouseEvent *event, QWidget *target);
void cancel_event_timer();
glow_draw_sTimerCb* timer_cb;
void (*draw_timer_callback_func)(GlowCtx* ctx);
QTimer* draw_timer_id;
public slots:
bool event_timer_cb();
......
......@@ -323,7 +323,7 @@ void GrowWindow::draw(DrawWind* w, GlowTransform* t, int highlight, int hot,
ctx->gdraw->rect(
ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fill_drawtype, 1, 0);
window_ctx->draw(w, ll_x, ll_y, ur_x, ur_y);
window_ctx->draw(window_ctx->mw, ll_x, ll_y, ur_x, ur_y);
ctx->gdraw->pop_customcolors();
}
......
......@@ -153,9 +153,7 @@ void GlowPolyLine::open(std::ifstream& fp)
void GlowPolyLine::get_borders(double pos_x, double pos_y, double* x_right,
double* x_left, double* y_high, double* y_low, void* node)
{
int i;
for (i = 0; i < a_points.a_size - 1; i++) {
for (int i = 0; i < a_points.a_size - 1; i++) {
if (pos_x + ((GlowPoint*)a_points[i])->x < *x_left)
*x_left = pos_x + ((GlowPoint*)a_points[i])->x;
if (pos_x + ((GlowPoint*)a_points[i + 1])->x < *x_left)
......@@ -178,19 +176,16 @@ void GlowPolyLine::get_borders(double pos_x, double pos_y, double* x_right,
void GlowPolyLine::add_points(
void* pos, glow_sPoint* pointarray, int point_cnt, int highlight, int hot)
{
int i;
if (points) {
// erase( pos, hot, NULL);
// nav_erase( pos, NULL);
free((char*)points);
}
points = (glow_sPointX*)calloc(
a_points.a_size + point_cnt, sizeof(glow_sPointX));
for (i = 0; i < point_cnt; i++) {
for (int i = 0; i < point_cnt; i++) {
GlowPoint* p = new GlowPoint(ctx, pointarray[i].x, pointarray[i].y);
a_points.insert(p);
}
zoom();
nav_zoom();
ctx->set_dirty();
}
......@@ -64,14 +64,17 @@ public:
void set_fill(int fillval)
{
fill = fillval;
ctx->set_dirty();
}
void set_drawtype(glow_eDrawType drawtype)
{
draw_type = drawtype;
ctx->set_dirty();
}
void set_linewidth(int linewidth)
{
line_width = linewidth;
ctx->set_dirty();
}
void add_points(void* pos, glow_sPoint* pointarray, int point_cnt,
int highlight, int hot);
......
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