Ge color palette: select of fill, border and textcolor changed

parent d52f5710
...@@ -1817,17 +1817,30 @@ void Ge::activate_confirm_cancel() ...@@ -1817,17 +1817,30 @@ void Ge::activate_confirm_cancel()
int Ge::colorpalette_cb( GlowCtx *ctx, glow_tEvent event) int Ge::colorpalette_cb( GlowCtx *ctx, glow_tEvent event)
{ {
Ge *gectx; Ge *gectx;
colpal_eActive active;
colpal_GetCtxUserData( (ColPalCtx *)ctx, (void **) &gectx); colpal_GetCtxUserData( (ColPalCtx *)ctx, (void **) &gectx);
switch ( event->event) { switch ( event->event) {
case glow_eEvent_MB1Click: case glow_eEvent_MB1Click:
if ( event->any.type == glow_eEventType_ColorTone) {
active = colpal_GetActive( gectx->colorpalette_ctx);
switch ( active) {
case colpal_eActive_FillColor:
if ( event->any.type == glow_eEventType_ColorTone)
gectx->graph->set_select_color_tone( event->colortone.tone); gectx->graph->set_select_color_tone( event->colortone.tone);
}
else else
gectx->graph->set_select_fill_color(); gectx->graph->set_select_fill_color();
break; break;
case colpal_eActive_BorderColor:
gectx->graph->set_select_border_color();
break;
case colpal_eActive_TextColor:
gectx->graph->set_select_text_color();
break;
}
break;
case glow_eEvent_MB1ClickShift: case glow_eEvent_MB1ClickShift:
gectx->graph->set_select_text_color(); gectx->graph->set_select_text_color();
break; break;
......
...@@ -72,3 +72,8 @@ void colpal_SetCurrentColors( colpal_tCtx ctx, glow_eDrawType fill_color, ...@@ -72,3 +72,8 @@ void colpal_SetCurrentColors( colpal_tCtx ctx, glow_eDrawType fill_color,
ctx->current_text = text_color; ctx->current_text = text_color;
} }
colpal_eActive colpal_GetActive( colpal_tCtx ctx)
{
return ctx->get_active();
}
...@@ -98,6 +98,8 @@ typedef ColPalCtx *colpal_tCtx; ...@@ -98,6 +98,8 @@ typedef ColPalCtx *colpal_tCtx;
void colpal_SetCurrentColors( colpal_tCtx ctx, glow_eDrawType fill_color, void colpal_SetCurrentColors( colpal_tCtx ctx, glow_eDrawType fill_color,
glow_eDrawType border_color, glow_eDrawType text_color); glow_eDrawType border_color, glow_eDrawType text_color);
colpal_eActive colpal_GetActive( colpal_tCtx ctx);
/*@}*/ /*@}*/
#if defined __cplusplus #if defined __cplusplus
} }
......
This diff is collapsed.
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
/*! \addtogroup Glow */ /*! \addtogroup Glow */
/*@{*/ /*@{*/
typedef enum {
colpal_eActive_FillColor,
colpal_eActive_BorderColor,
colpal_eActive_TextColor
} colpal_eActive;
//! Context for the color palette. //! Context for the color palette.
/*! The color palette consists of 300 colors, where the bordercolor, fillcolor and the textcolor /*! The color palette consists of 300 colors, where the bordercolor, fillcolor and the textcolor
...@@ -52,7 +59,8 @@ class ColPalCtx : public GrowCtx { ...@@ -52,7 +59,8 @@ class ColPalCtx : public GrowCtx {
ColPalCtx( const char *ctx_name, double zoom_fact = 100) : ColPalCtx( const char *ctx_name, double zoom_fact = 100) :
GrowCtx( ctx_name, zoom_fact), columns(30), GrowCtx( ctx_name, zoom_fact), columns(30),
current_fill( glow_eDrawType_LineGray), current_border( glow_eDrawType_Line), current_fill( glow_eDrawType_LineGray), current_border( glow_eDrawType_Line),
current_text(glow_eDrawType_Line), entry_width(0.3), entry_height(1), display_entry_width(3) current_text(glow_eDrawType_Line), entry_width(0.3), entry_height(1), display_entry_width(3),
active(colpal_eActive_FillColor)
{ ctx_type = glow_eCtxType_ColPal; grid_on = 0; }; { ctx_type = glow_eCtxType_ColPal; grid_on = 0; };
//! Destructor //! Destructor
...@@ -95,6 +103,10 @@ class ColPalCtx : public GrowCtx { ...@@ -95,6 +103,10 @@ class ColPalCtx : public GrowCtx {
*/ */
int event_handler( glow_eEvent event, int x, int y, int w, int h); int event_handler( glow_eEvent event, int x, int y, int w, int h);
void set_active( colpal_eActive a);
colpal_eActive get_active() { return active;}
void set_colors();
int columns; //!< Number of columns in the color palette. int columns; //!< Number of columns in the color palette.
glow_eDrawType current_fill; //!< The currently selected fill color. glow_eDrawType current_fill; //!< The currently selected fill color.
glow_eDrawType current_border; //!< The currently selected border color. glow_eDrawType current_border; //!< The currently selected border color.
...@@ -102,9 +114,16 @@ class ColPalCtx : public GrowCtx { ...@@ -102,9 +114,16 @@ class ColPalCtx : public GrowCtx {
GlowArrayElem *display_fill; //!< The rectangle object to display the current fillcolor. GlowArrayElem *display_fill; //!< The rectangle object to display the current fillcolor.
GlowArrayElem *display_border; //!< The rectangle object to display the current border color. GlowArrayElem *display_border; //!< The rectangle object to display the current border color.
GlowArrayElem *display_text; //!< The rectangle object to display the current text color. GlowArrayElem *display_text; //!< The rectangle object to display the current text color.
GlowArrayElem *active_fill; //!< The rectangle object to mark fill color active.
GlowArrayElem *active_border; //!< The rectangle object to mark border color active.
GlowArrayElem *active_text; //!< The rectangle object to mark text color active.
GlowArrayElem *text_fill; //!< The fill color text object.
GlowArrayElem *text_border; //!< The border color text object.
GlowArrayElem *text_text; //!< The text color text object.
double entry_width; //!< Width of a color palette entry. double entry_width; //!< Width of a color palette entry.
double entry_height; //!< Height of a color palette entry. double entry_height; //!< Height of a color palette entry.
double display_entry_width; //!< Width of a display entry. double display_entry_width; //!< Width of a display entry.
colpal_eActive active; //!< Active colortype (fill, border or text).
}; };
//! Scroll horizontal. //! Scroll horizontal.
......
...@@ -348,7 +348,7 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip) ...@@ -348,7 +348,7 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
{ {
int sts; int sts;
pwr_tObjid child; pwr_tObjid child;
pwr_tClassId classid; pwr_tClassId classid, cid;
pwr_sAttrRef deftrend; pwr_sAttrRef deftrend;
pwr_tAName name; pwr_tAName name;
pwr_sAttrRef *objar; pwr_sAttrRef *objar;
...@@ -358,10 +358,10 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip) ...@@ -358,10 +358,10 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
else else
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
sts = gdh_GetAttrRefTid( objar, &classid); sts = gdh_GetAttrRefTid( objar, &cid);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( classid == pwr_cClass_DsTrend || classid == pwr_cClass_PlotGroup) { if ( cid == pwr_cClass_DsTrend || cid == pwr_cClass_PlotGroup) {
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
...@@ -381,6 +381,9 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip) ...@@ -381,6 +381,9 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
} }
// Check if object has a DsTrend as child // Check if object has a DsTrend as child
if ( cid == pwr_eClass_PlantHier)
return XNAV__INVISIBLE;
if ( !objar->Flags.b.Object) if ( !objar->Flags.b.Object)
return XNAV__INVISIBLE; return XNAV__INVISIBLE;
......
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