Commit e5fb3375 authored by Claes Sjofors's avatar Claes Sjofors

Ge, new script functions and colortheme fix for subwindows

parent 34491186
......@@ -685,9 +685,12 @@ void Graph::update_color_theme( int ct)
int sts;
sprintf( color_theme_file, "pwr_colortheme%d", ct);
sts = grow_ReadCustomColorFile( grow->ctx, color_theme_file);
sts = grow_ReadCustomColorFile( grow->base_ctx(), color_theme_file);
if ( EVEN(sts)) return;
grow_SetDefaultColorTheme( color_theme_file);
color_theme = ct;
if ( update_colorpalette_cb)
......@@ -1591,19 +1594,19 @@ int Graph::get_attr_items( grow_tObject object, attr_sItem **itemlist,
"Scale9", "Folder9.Scale",
"VerticalScrollbar9", "Folder9.VerticalScrollbar",
"HorizontalScrollbar9", "Folder9.HorizontalScrollbar",
"Owner10", "Folder9.Object",
"Owner9", "Folder9.Object",
"FileName10", "Folder10.FileName",
"Text10", "Folder10.Text",
"Scale10", "Folder10.Scale",
"VerticalScrollbar10", "Folder10.VerticalScrollbar",
"HorizontalScrollbar10","Folder10.HorizontalScrollbar",
"Owner11", "Folder10.Object",
"Owner10", "Folder10.Object",
"FileName11", "Folder11.FileName",
"Text11", "Folder11.Text",
"Scale11", "Folder11.Scale",
"VerticalScrollbar11", "Folder11.VerticalScrollbar",
"HorizontalScrollbar11","Folder11.HorizontalScrollbar",
"Owner12", "Folder11.Object",
"Owner11", "Folder11.Object",
"FileName12", "Folder12.FileName",
"Text12", "Folder12.Text",
"Scale12", "Folder12.Scale",
......
......@@ -399,6 +399,12 @@ class GraphGrow {
if ( stack_cnt > 0)
ctx = ctx_stack[--stack_cnt];
}
GrowCtx *base_ctx() {
if ( stack_cnt > 0)
return ctx_stack[0];
else
return ctx;
}
};
......
......@@ -3183,6 +3183,26 @@ static int graph_setextern_func(
return 1;
}
static int graph_setexternall_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
Graph *graph;
if ( arg_count != 0)
return CCM__ARGMISM;
graph_get_stored_graph( &graph);
grow_SetNodeClassExternAll( graph->grow->ctx, 1);
return 1;
}
static int graph_setintern_func(
void *filectx,
ccm_sArg *arg_list,
......@@ -3218,6 +3238,26 @@ static int graph_setintern_func(
return 1;
}
static int graph_setinternall_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
Graph *graph;
if ( arg_count != 0)
return CCM__ARGMISM;
graph_get_stored_graph( &graph);
grow_SetNodeClassExternAll( graph->grow->ctx, 0);
return 1;
}
static int graph_true_func(
void *filectx,
ccm_sArg *arg_list,
......@@ -3594,6 +3634,34 @@ static int graph_getobjectgradient_func(
return 1;
}
static int graph_setobjectgradient_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
Graph *graph;
ccm_sArg *arg_p2;
if ( arg_count != 2)
return CCM__ARGMISM;
arg_p2 = arg_list->next;
if ( arg_list->value_decl != CCM_DECL_INT)
return CCM__ARGMISM;
if ( arg_p2->value_decl != CCM_DECL_INT)
return CCM__ARGMISM;
graph_get_stored_graph( &graph);
grow_SetObjectGradient( (grow_tObject)arg_list->value_int, (glow_eGradient)arg_p2->value_int);
return 1;
}
static int graph_getobjectfillcolor_func(
void *filectx,
ccm_sArg *arg_list,
......@@ -4274,6 +4342,7 @@ static int graph_getobjectattribute_func(
type == glow_eObjectType_GrowFolder ||
type == glow_eObjectType_GrowBar ||
type == glow_eObjectType_GrowTrend ||
type == glow_eObjectType_GrowRect ||
type == glow_eObjectType_GrowAxis) {
attr_sItem *itemlist;
attr_sItem *item_p;
......@@ -4509,6 +4578,268 @@ static int graph_setrgbcolor_func(
return 1;
}
static int graph_measureobject_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
Graph *graph;
ccm_sArg *arg_p2; // ll_x
ccm_sArg *arg_p3; // ll_y
ccm_sArg *arg_p4; // ur_x
ccm_sArg *arg_p5; // ur_y
double ll_x, ll_y, ur_x, ur_y;
if ( arg_count != 5)
return CCM__ARGMISM;
arg_p2 = arg_list->next;
arg_p3 = arg_p2->next;
arg_p4 = arg_p3->next;
arg_p5 = arg_p4->next;
if ( arg_list->value_decl != CCM_DECL_INT)
return CCM__ARGMISM;
if ( arg_p2->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
if ( arg_p3->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
if ( arg_p4->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
if ( arg_p5->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
graph_get_stored_graph( &graph);
grow_MeasureNode( (grow_tObject)arg_list->value_int, &ll_x, &ll_y, &ur_x, &ur_y);
arg_p2->value_float = (float)ll_x;
arg_p3->value_float = (float)ll_y;
arg_p4->value_float = (float)ur_x;
arg_p5->value_float = (float)ur_y;
arg_p2->value_returned = 1;
arg_p3->value_returned = 1;
arg_p4->value_returned = 1;
arg_p5->value_returned = 1;
return 1;
}
static int graph_deleteobject_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
Graph *graph;
if ( arg_count != 1)
return CCM__ARGMISM;
if ( arg_list->value_decl != CCM_DECL_INT)
return CCM__ARGMISM;
graph_get_stored_graph( &graph);
grow_DeleteObject( graph->grow->ctx, (grow_tObject)arg_list->value_int);
return 1;
}
static int graph_setobjectclass_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
Graph *graph;
ccm_sArg *arg_p2; // Class
int sts;
grow_tNodeClass nc;
pwr_tFileName cname;
if ( arg_count != 2)
return CCM__ARGMISM;
arg_p2 = arg_list->next;
if ( arg_list->value_decl != CCM_DECL_INT)
return CCM__ARGMISM;
if ( arg_p2->value_decl != CCM_DECL_STRING)
return CCM__ARGMISM;
graph_get_stored_graph( &graph);
sts = grow_FindNodeClassByName( graph->grow->ctx, arg_p2->value_string, &nc);
if ( EVEN(sts)) {
// Load the subgraph
strcpy( cname, "$pwrp_exe/");
strncat( cname, arg_p2->value_string, sizeof(cname));
strncat( cname, ".pwsg", sizeof(cname));
sts = grow_OpenSubGraph( graph->grow->ctx, cname);
if ( EVEN(sts)) {
strcpy( cname, "$pwr_exe/");
strncat( cname, arg_p2->value_string, sizeof(cname));
strncat( cname, ".pwsg", sizeof(cname));
sts = grow_OpenSubGraph( graph->grow->ctx, cname);
}
}
sts = grow_FindNodeClassByName( graph->grow->ctx, arg_p2->value_string, &nc);
if ( EVEN(sts)) {
*return_int = sts;
*return_decl = CCM_DECL_INT;
return 1;
}
sts = grow_SetObjectClass( (grow_tNode)arg_list->value_int, nc);
*return_int = sts;
*return_decl = CCM_DECL_INT;
return 1;
}
static int graph_scaleobject_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
Graph *graph;
ccm_sArg *arg_p2; // scale x
ccm_sArg *arg_p3; // scale y
double scalex, scaley;
glow_eScaleType scale_type;
grow_tObject oid = (grow_tObject)arg_list->value_int;
if ( oid == 0)
return 1;
if ( arg_count != 3)
return CCM__ARGMISM;
arg_p2 = arg_list->next;
arg_p3 = arg_p2->next;
if ( arg_list->value_decl != CCM_DECL_INT)
return CCM__ARGMISM;
if ( arg_p2->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
if ( arg_p3->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
graph_get_stored_graph( &graph);
scalex = (double)arg_p2->value_float;
scaley = (double)arg_p3->value_float;
scale_type = glow_eScaleType_LowerLeft;
grow_StoreTransform( oid);
grow_SetObjectScale( oid, scalex, scaley,
0, 0, scale_type);
return 1;
}
static int graph_moveobject_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
Graph *graph;
ccm_sArg *arg_p2; // scale x
ccm_sArg *arg_p3; // scale y
double x0, y0;
grow_tObject oid = (grow_tObject)arg_list->value_int;
if ( oid == 0)
return 1;
if ( arg_count != 3)
return CCM__ARGMISM;
arg_p2 = arg_list->next;
arg_p3 = arg_p2->next;
if ( arg_list->value_decl != CCM_DECL_INT)
return CCM__ARGMISM;
if ( arg_p2->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
if ( arg_p3->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
graph_get_stored_graph( &graph);
x0 = (double)arg_p2->value_float;
y0 = (double)arg_p3->value_float;
grow_MoveObject( oid, x0, y0);
return 1;
}
static int graph_moveabsobject_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
Graph *graph;
ccm_sArg *arg_p2; // scale x
ccm_sArg *arg_p3; // scale y
double x0, y0;
double ll_x, ll_y, ur_x, ur_y;
grow_tObject oid = (grow_tObject)arg_list->value_int;
if ( oid == 0)
return 1;
if ( arg_count != 3)
return CCM__ARGMISM;
arg_p2 = arg_list->next;
arg_p3 = arg_p2->next;
if ( arg_list->value_decl != CCM_DECL_INT)
return CCM__ARGMISM;
if ( arg_p2->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
if ( arg_p3->value_decl != CCM_DECL_FLOAT)
return CCM__ARGMISM;
graph_get_stored_graph( &graph);
grow_MeasureNode( oid, &ll_x, &ll_y, &ur_x, &ur_y);
x0 = (double)arg_p2->value_float - ll_x;
y0 = (double)arg_p3->value_float - ll_y;
grow_MoveObject( oid, x0, y0);
return 1;
}
static int graph_ccm_deffilename_func( char *outfile, char *infile, void *client_data)
{
......@@ -4618,6 +4949,10 @@ int Graph::readcmdfile( char *incommand)
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "SetIntern", graph_setintern_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "SetExternAll", graph_setexternall_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "SetInternAll", graph_setinternall_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "SetDraw", graph_setdraw_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "IsW1", graph_true_func);
......@@ -4646,6 +4981,8 @@ int Graph::readcmdfile( char *incommand)
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "GetObjectGradient", graph_getobjectgradient_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "SetObjectGradient", graph_setobjectgradient_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "GetObjectFillColor", graph_getobjectfillcolor_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "SetObjectFillColor", graph_setobjectfillcolor_func);
......@@ -4682,6 +5019,18 @@ int Graph::readcmdfile( char *incommand)
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "SetRgbColor", graph_setrgbcolor_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "MeasureObject", graph_measureobject_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "DeleteObject", graph_deleteobject_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "SetObjectClass", graph_setobjectclass_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "ScaleObject", graph_scaleobject_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "MoveObject", graph_moveobject_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "MoveAbsObject", graph_moveabsobject_func);
if ( EVEN(sts)) return sts;
ccm_func_registred = 1;
......@@ -4792,6 +5141,7 @@ int Graph::readcmdfile( char *incommand)
sprintf( varname, "eDrawType_Color%d", i);
sts = ccm_create_external_var( varname, CCM_DECL_INT, 0, i-1, 0);
}
sts = ccm_create_external_var( "eDrawType_LineErase", CCM_DECL_INT, 0, 300, 0);
for ( int i = 1; i <= 90; i++) {
sprintf( varname, "eDrawType_CustomColor%d", i);
sts = ccm_create_external_var( varname, CCM_DECL_INT, 0, 310 + 4 * (i - 1), 0);
......
......@@ -2025,7 +2025,7 @@ void GlowDrawGtk::clear( GlowWind *wind)
if ( !w->double_buffer_on)
gdk_window_clear( w->window);
else
buffer_background( w);
buffer_background( w, 0);
}
void GlowDrawGtk::copy_buffer( GlowWind *wind,
......@@ -2410,7 +2410,7 @@ void GlowDrawGtk::set_background( GlowWind *wind, glow_eDrawType drawtype, glow_
gtk_widget_modify_bg( w->toplevel, GTK_STATE_NORMAL, &background);
if ( w->buffer)
buffer_background( w);
buffer_background( w, 0);
}
else {
GdkBitmap *mask;
......@@ -2425,7 +2425,7 @@ void GlowDrawGtk::set_background( GlowWind *wind, glow_eDrawType drawtype, glow_
w->background_pixmap_height = pixmap_height;
gdk_window_set_back_pixmap( w->window, w->background_pixmap, FALSE);
if ( w->buffer)
buffer_background( w);
buffer_background( w, 0);
}
}
......@@ -2622,7 +2622,7 @@ int GlowDrawGtk::create_buffer( GlowWind *wind)
w->buffer_width = window_width;
w->buffer_height = window_height;
buffer_background( w);
buffer_background( w, 0);
return 1;
}
......@@ -2637,7 +2637,7 @@ void GlowDrawGtk::delete_buffer( GlowWind *wind)
w->buffer_height = 0;
}
void GlowDrawGtk::buffer_background( DrawWind *wind)
void GlowDrawGtk::buffer_background( DrawWind *wind, GlowCtx *cctx)
{
DrawWindGtk *w = (DrawWindGtk *) wind;
int window_width, window_height, subwindow_x, subwindow_y;
......@@ -2687,14 +2687,21 @@ void GlowDrawGtk::buffer_background( DrawWind *wind)
reset_clip( w, get_gc( this, glow_eDrawType_Line, 0));
}
else {
glow_eDrawType bg;
if ( cctx)
bg = ((GrowCtx *)cctx)->background_color;
else
bg = ((GrowCtx *)ctx)->background_color;
//glow_eDrawType bg = glow_eDrawType_CustomColor1;
//glow_eDrawType bg = glow_eDrawType_LineErase;
if ( w->clip_on)
set_clip( w, get_gc( this, glow_eDrawType_LineErase, 0));
set_clip( w, get_gc( this, bg, 0));
gdk_draw_rectangle( w->buffer,
get_gc( this, glow_eDrawType_LineErase, 0), 1,
get_gc( this, bg, 0), 1,
subwindow_x, subwindow_y, window_width, window_height);
if ( w->clip_on)
reset_clip( w, get_gc( this, glow_eDrawType_LineErase, 0));
reset_clip( w, get_gc( this, bg, 0));
}
}
......
......@@ -191,7 +191,7 @@ class GlowDrawGtk : public GlowDraw {
virtual void draw_background( GlowWind *wind, int x, int y, int w, int h);
virtual int create_buffer( GlowWind *w);
virtual void delete_buffer( GlowWind *w);
virtual void buffer_background( DrawWind *w);
virtual void buffer_background( DrawWind *w, GlowCtx *cctx);
virtual int print( char *filename, double x0, double x1, int end);
virtual int export_image( char *filename);
void set_clip( DrawWind *w, GdkGC *gc);
......
......@@ -1938,7 +1938,7 @@ void GlowDrawXLib::clear( GlowWind *wind)
if ( !w->double_buffer_on)
XClearWindow( display, w->window);
else
buffer_background( w);
buffer_background( w, 0);
}
void GlowDrawXLib::copy_buffer( GlowWind *wind,
......@@ -2341,7 +2341,7 @@ void GlowDrawXLib::set_background( GlowWind *wind, glow_eDrawType drawtype, glow
XtSetValues( w->toplevel, args, i);
if ( w->buffer)
buffer_background( w);
buffer_background( w, 0);
}
else {
if ( w->background_pixmap)
......@@ -2352,7 +2352,7 @@ void GlowDrawXLib::set_background( GlowWind *wind, glow_eDrawType drawtype, glow
w->background_pixmap_height = pixmap_height;
XSetWindowBackgroundPixmap( display, w->window, (Pixmap)pixmap);
if ( w->buffer)
buffer_background( w);
buffer_background( w, 0);
}
}
......@@ -2580,7 +2580,7 @@ int GlowDrawXLib::create_buffer( GlowWind *wind)
w->buffer_width = window_width;
w->buffer_height = window_height;
buffer_background( w);
buffer_background( w, 0);
return 1;
}
......@@ -2595,7 +2595,7 @@ void GlowDrawXLib::delete_buffer( GlowWind *wind)
w->buffer_height = 0;
}
void GlowDrawXLib::buffer_background( DrawWind *wind)
void GlowDrawXLib::buffer_background( DrawWind *wind, GlowCtx *cctx)
{
DrawWindXLib *w = (DrawWindXLib *) wind;
int window_width, window_height, subwindow_x, subwindow_y;
......
......@@ -212,7 +212,7 @@ class GlowDrawXLib : public GlowDraw {
virtual void draw_background( GlowWind *wind, int x, int y, int w, int h);
virtual int create_buffer( GlowWind *w);
virtual void delete_buffer( GlowWind *w);
virtual void buffer_background( DrawWind *w);
virtual void buffer_background( DrawWind *w, GlowCtx *cctx);
virtual int print( char *filename, double x0, double x1, int end);
void set_clip( DrawWind *w, GC gc);
void reset_clip( DrawWind *w, GC gc);
......
......@@ -222,6 +222,7 @@ class GlowArrayElem {
virtual glow_eDrawType get_border_color() { return glow_eDrawType_No;}
virtual glow_eDrawType get_text_color() { return glow_eDrawType_No;}
virtual glow_eGradient get_gradient() { return glow_eGradient_No;}
virtual void get_gradient( glow_eGradient gradient) {}
virtual void set_colortheme_lightness() {}
virtual ~GlowArrayElem() {};
......
......@@ -562,6 +562,41 @@ int ColPalCtx::event_handler( glow_eEvent event, int x, int y, int w, int h)
event_callback[event]( this, &e);
}
}
else if ( strcmp( name, "ColorEntryBg") == 0) {
if ( event_callback[event]) {
static glow_sEvent e;
e.event = event;
e.any.type = glow_eEventType_ColorTone;
e.any.x_pixel = x;
e.any.y_pixel = y;
e.any.x = 1.0 * (x + mw.offset_x) / mw.zoom_factor_x;
e.any.y = 1.0 * (y + mw.offset_y) / mw.zoom_factor_y;
e.colortone.tone = (glow_eDrawTone) glow_eDrawType_LineErase;
event_callback[event]( this, &e);
}
}
}
else if ( callback_object->type() == glow_eObjectType_GrowText) {
GrowText *text;
char name[32];
text = (GrowText *)callback_object;
text->get_object_name( name);
if ( strcmp( name, "ColorEntryBg") == 0) {
if ( event_callback[event]) {
static glow_sEvent e;
e.event = event;
e.any.type = glow_eEventType_ColorTone;
e.any.x_pixel = x;
e.any.y_pixel = y;
e.any.x = 1.0 * (x + mw.offset_x) / mw.zoom_factor_x;
e.any.y = 1.0 * (y + mw.offset_y) / mw.zoom_factor_y;
e.colortone.tone = (glow_eDrawTone) glow_eDrawType_LineErase;
event_callback[event]( this, &e);
}
}
}
}
break;
......
......@@ -140,7 +140,7 @@ class GlowDraw {
virtual void draw_background( GlowWind *wind, int x, int y, int w, int h) {}
virtual int create_buffer( GlowWind *w) {return 1;}
virtual void delete_buffer( GlowWind *w) {}
virtual void buffer_background( DrawWind *w) {}
virtual void buffer_background( DrawWind *w, GlowCtx *cctx) {}
virtual int export_image( char *filename) { return 1;}
virtual int print( char *filename, double x0, double x1, int end) { return 1;}
//virtual void set_clip( DrawWind *w, GC gc) {}
......
......@@ -4945,6 +4945,16 @@ void grow_SetNodeClassExtern( grow_tNodeClass nodeclass, int ext)
((GlowNodeClass *)nodeclass)->set_extern( ext);
}
void grow_SetNodeClassExternAll( grow_tCtx ctx, int ext)
{
GlowNodeClass **nc_list;
int num;
ctx->get_nodeclasslist( (GlowArrayElem ***)&nc_list, &num);
for ( int i = 0; i < num; i++)
nc_list[i]->set_extern( ext);
}
int grow_GetBackgroundObjectLimits( grow_tCtx ctx, glow_eTraceType type,
double x, double y, grow_tObject *background,
double *min, double *max, glow_eDirection *direction)
......@@ -5497,6 +5507,11 @@ glow_eGradient grow_GetObjectGradient( grow_tObject o)
return ((GlowArrayElem *)o)->get_gradient();
}
void grow_SetObjectGradient( grow_tObject o, glow_eGradient gradient)
{
((GlowArrayElem *)o)->set_gradient( gradient);
}
int grow_GetObjectShadow( grow_tObject o)
{
return ((GlowArrayElem *)o)->get_shadow();
......@@ -5532,6 +5547,22 @@ void grow_ResetObjectBackgroundColor( grow_tObject object)
((GlowArrayElem *)object)->reset_background_color();
}
int grow_SetObjectClass( grow_tObject object, grow_tNodeClass nodeclass)
{
if ( ((GlowArrayElem *)object)->type() == glow_eObjectType_GrowNode ||
((GlowArrayElem *)object)->type() == glow_eObjectType_GrowSlider ||
((GlowArrayElem *)object)->type() == glow_eObjectType_GrowConGlue ||
((GlowArrayElem *)object)->type() == glow_eObjectType_GrowGroup) {
((GrowNode *)object)->nc = (GlowNodeClass *)nodeclass;
((GrowNode *)object)->nc_root = (GlowNodeClass *)nodeclass;
((GrowNode *)object)->get_node_borders();
}
else
return 0;
return 1;
}
/*@}*/
......
......@@ -2754,6 +2754,8 @@ extern "C" {
*/
void grow_SetNodeClassExtern( grow_tNodeClass nodeclass, int ext);
void grow_SetNodeClassExternAll( grow_tCtx ctx, int ext);
//! Get the limits configured in a background object for a slider.
/*!
\param ctx Grow context.
......@@ -3114,6 +3116,7 @@ extern "C" {
glow_eDrawType grow_GetObjectBorderColor( grow_tObject o);
glow_eDrawType grow_GetObjectTextColor( grow_tObject o);
glow_eGradient grow_GetObjectGradient( grow_tObject o);
void grow_SetObjectGradient( grow_tObject o, glow_eGradient gradient);
int grow_GetObjectShadow( grow_tObject o);
void grow_SetObjectOriginalFillColor( grow_tObject o, glow_eDrawType color);
void grow_SetObjectOriginalBorderColor( grow_tObject o, glow_eDrawType color);
......@@ -3121,6 +3124,7 @@ extern "C" {
void grow_SetObjectBackgroundColor( grow_tObject o, glow_eDrawType color);
void grow_SetObjectOriginalBackgroundColor( grow_tObject o, glow_eDrawType color);
void grow_ResetObjectBackgroundColor( grow_tObject object);
int grow_SetObjectClass( grow_tObject object, grow_tNodeClass nodeclass);
/*@}*/
......
......@@ -99,11 +99,13 @@ class NextElem {
GrowCtx::~GrowCtx()
{
if ( gdraw)
if ( gdraw) {
set_nodraw();
clear_all( 0);
}
if ( dynamic)
free( dynamic);
if ( ctx_type == glow_eCtxType_Grow && customcolors) {
if ( gdraw && ctx_type == glow_eCtxType_Grow && customcolors) {
gdraw->reset_customcolors( customcolors);
free( customcolors);
}
......@@ -2528,6 +2530,7 @@ void GrowCtx::clear_all( int keep_paste)
nav_clear();
set_nodraw();
reset_custom_colors();
zoom_absolute( mw.base_zoom_factor);
mw.offset_x = 0;
mw.offset_y = 0;
......@@ -2571,11 +2574,11 @@ void GrowCtx::clear_all( int keep_paste)
}
}
}
reset_custom_colors();
reset_nodraw();
// if ( show_grid)
// draw_grid( 0, 0, mw.window_width, mw.window_height);
draw( &mw, mw.subwindow_x, mw.subwindow_y, mw.subwindow_x + mw.window_width, mw.subwindow_y + mw.window_height);
reset_custom_colors();
}
void GrowCtx::redraw_defered()
......@@ -2615,7 +2618,7 @@ void GrowCtx::draw( GlowWind *w, int ll_x, int ll_y, int ur_x, int ur_y)
if ( redraw_callback)
(redraw_callback) ( redraw_data);
if ( w->double_buffer_on())
gdraw->buffer_background( w->window);
gdraw->buffer_background( w->window, this);
for ( i = 0; i < a.a_size; i++) {
if ( a.a[i]->type() == glow_eObjectType_Con)
a.a[i]->draw( w, ll_x, ll_y, ur_x, ur_y);
......@@ -4692,11 +4695,21 @@ int GrowCtx::read_customcolor_file( char *name)
{
int sts;
if ( environment == glow_eEnv_Runtime && strcmp( color_theme, "$default") != 0)
return 0;
if ( customcolors) {
sts = customcolors->read_colorfile( this, name);
if ( ODD(sts)) {
set_background( background_color);
}
for ( int i = 0; i < a.a_size; i++) {
if ( a[i]->type() == glow_eObjectType_GrowWindow ||
a[i]->type() == glow_eObjectType_GrowFolder) {
((GrowWindow *)a[i])->window_ctx->read_customcolor_file( name);
}
}
return sts;
}
else
......
......@@ -99,7 +99,7 @@ class GrowCtx : public GlowCtx {
is_javaapplication(0), cycle(glow_eCycle_Slow),
mb3_action(glow_eMB3Action_PopupMenu), scale_equal(0), translate_on(0),
input_focus_mark(glow_eInputFocusMark_Relief), background_disabled(0),
redraw_callback(0), redraw_data(0), has_subwindows(-1), bitmap_fonts(0),
redraw_callback(0), redraw_data(0), has_subwindows(-1), is_subwindow(0), bitmap_fonts(0),
environment(glow_eEnv_Runtime), text_coding(glow_eTextCoding_ISO8859_1), recursive_trace(0),
edit_set_mode(glow_eEditSetMode_None)
{ ctx_type = glow_eCtxType_Grow;
......@@ -964,6 +964,7 @@ class GrowCtx : public GlowCtx {
void (*redraw_callback)( void *); //!< Backcall function before drawing (if ctx is window component).
void *redraw_data; //!< Data for redraw callback.
int has_subwindows; //!< Graph contains subwindow objects (GrowWindow or GrowFolder)
int is_subwindow; //!< Is a subwindow context.
char owner[256]; //!< Owner, used by application
int bitmap_fonts; //!< Use bitmap fonts
glow_eEnv environment; //!< Environment Development or Runtime.
......
......@@ -298,10 +298,10 @@ void GrowWindow::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, vo
window_ctx->mw.zoom_factor_y = window_ctx->mw.subwindow_scale * w->zoom_factor_y;
// window_ctx->draw_buffer_only = ctx->draw_buffer_only;
ctx->gdraw->push_customcolors( window_ctx->customcolors);
if ( fill)
ctx->gdraw->fill_rect( w, ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fill_drawtype);
ctx->gdraw->push_customcolors( window_ctx->customcolors);
window_ctx->draw( &window_ctx->mw, ll_x, ll_y, ur_x, ur_y);
ctx->gdraw->pop_customcolors();
}
......@@ -903,6 +903,7 @@ void GrowWindow::new_ctx()
window_ctx = new GrowCtx( "WindowComponent", ctx->mw.zoom_factor_x * window_scale);
window_ctx->gdraw = ctx->gdraw;
window_ctx->is_subwindow = 1;
window_ctx->mw.window = ctx->mw.window;
window_ctx->navw.window = ctx->navw.window;
window_ctx->userdata_save_callback = ctx->userdata_save_callback;
......
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