|
// --- Interface tools ---
static Boxs box_box ;
// --- for Brush Selection Tool ---
static Boxs box_brush ;
static Tool_Brush tool_brush ;
...
extern "C" __declspec(dllexport) int Ctrl_Resize( HWND wnd, int width, int height )
{
short p_x, p_y, d_x, d_y ;
// -----------------------------------------------------------------------
// In the "Config" menu, the user can change the interface's size.
// This action change a number of variables that are used to compute
// the size of the tool in the intearface. We now load a few of these
// variables and use them to compute the dimension of our interface tools.
// -----------------------------------------------------------------------
char * Tools_Font_Name = (char *) Fct_Variable_Value( "$INTERFACE_TOOL_FONT_NAME" ) ;
char * Tools_Font_Weigth = (char *) Fct_Variable_Value( "$INTERFACE_TOOL_FONT_WEIGHT" ) ;
short Tools_Font_Scale = (short) Fct_Variable_Value( "$INTERFACE_TOOL_FONT_SCALE" ) ;
short Space_Dim = (short) Fct_Variable_Value( "$INTERFACE_SPACE_DIM" ) ;
short Border_Dim = (short) Fct_Variable_Value( "$INTERFACE_BORDER_DIM" ) ;
...
// ===========================================================================
// --- Brush_Selection Tool
// ===========================================================================
p_x = box_box.Pos_X + Space_Dim ;
p_y = box_box.Pos_Y + Space_Dim ;
d_x = box_box.Dim_X - 2*Space_Dim ;
d_y = tool_brush.Height() ;
// --- The tool will be inside this box ---
box_brush.Flag = OUTIL_EMPTY ;
box_brush.Pos_X = p_x ;
box_brush.Pos_Y = p_y ;
box_brush.Dim_X = d_x ;
box_brush.Dim_Y = d_y ;
box_brush.color = box_box.color ;
box_brush.border = Border_Dim;
box_brush.Font_Name = Tools_Font_Name ;
box_brush.Font_Weight = Tools_Font_Weigth ;
box_brush.Font_Scale = Tools_Font_Scale ;
box_brush.Init( wnd ) ;
// --- now prepare the tool itself ---
tool_brush.Resize( &box_brush ) ;
return( 1 ) ;
}
|