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

parent d52f5710
......@@ -1817,16 +1817,29 @@ void Ge::activate_confirm_cancel()
int Ge::colorpalette_cb( GlowCtx *ctx, glow_tEvent event)
{
Ge *gectx;
colpal_eActive active;
colpal_GetCtxUserData( (ColPalCtx *)ctx, (void **) &gectx);
switch ( event->event) {
case glow_eEvent_MB1Click:
if ( event->any.type == glow_eEventType_ColorTone) {
gectx->graph->set_select_color_tone( event->colortone.tone);
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);
else
gectx->graph->set_select_fill_color();
break;
case colpal_eActive_BorderColor:
gectx->graph->set_select_border_color();
break;
case colpal_eActive_TextColor:
gectx->graph->set_select_text_color();
break;
}
else
gectx->graph->set_select_fill_color();
break;
case glow_eEvent_MB1ClickShift:
gectx->graph->set_select_text_color();
......
......@@ -72,3 +72,8 @@ void colpal_SetCurrentColors( colpal_tCtx ctx, glow_eDrawType fill_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;
void colpal_SetCurrentColors( colpal_tCtx ctx, glow_eDrawType fill_color,
glow_eDrawType border_color, glow_eDrawType text_color);
colpal_eActive colpal_GetActive( colpal_tCtx ctx);
/*@}*/
#if defined __cplusplus
}
......
This diff is collapsed.
......@@ -32,6 +32,13 @@
/*! \addtogroup Glow */
/*@{*/
typedef enum {
colpal_eActive_FillColor,
colpal_eActive_BorderColor,
colpal_eActive_TextColor
} colpal_eActive;
//! Context for the color palette.
/*! The color palette consists of 300 colors, where the bordercolor, fillcolor and the textcolor
......@@ -50,10 +57,11 @@ class ColPalCtx : public GrowCtx {
\param zoom_fact Initial zoomfactor.
*/
ColPalCtx( const char *ctx_name, double zoom_fact = 100) :
GrowCtx( ctx_name, zoom_fact), columns(30),
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)
{ ctx_type = glow_eCtxType_ColPal; grid_on = 0; };
GrowCtx( ctx_name, zoom_fact), columns(30),
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),
active(colpal_eActive_FillColor)
{ ctx_type = glow_eCtxType_ColPal; grid_on = 0; };
//! Destructor
~ColPalCtx() {};
......@@ -95,6 +103,10 @@ class ColPalCtx : public GrowCtx {
*/
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.
glow_eDrawType current_fill; //!< The currently selected fill color.
glow_eDrawType current_border; //!< The currently selected border color.
......@@ -102,9 +114,16 @@ class ColPalCtx : public GrowCtx {
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_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_height; //!< Height of a color palette entry.
double display_entry_width; //!< Width of a display entry.
colpal_eActive active; //!< Active colortype (fill, border or text).
};
//! Scroll horizontal.
......
......@@ -348,7 +348,7 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
{
int sts;
pwr_tObjid child;
pwr_tClassId classid;
pwr_tClassId classid, cid;
pwr_sAttrRef deftrend;
pwr_tAName name;
pwr_sAttrRef *objar;
......@@ -358,10 +358,10 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
else
objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
sts = gdh_GetAttrRefTid( objar, &classid);
sts = gdh_GetAttrRefTid( objar, &cid);
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;
}
......@@ -381,6 +381,9 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
}
// Check if object has a DsTrend as child
if ( cid == pwr_eClass_PlantHier)
return XNAV__INVISIBLE;
if ( !objar->Flags.b.Object)
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