|
...
// ----------------------------------------------------------------------------
//
// Function: Ctrl_Resize
//
// Parameters: wnd (HWND) Pointer to Window's created window
// width (int) horiz. size of the window
// height (int) vert. size of the window
// Returns: (int) 0 if error
//
// This is called once when your control window is created
//
// ----------------------------------------------------------------------------
extern "C" __declspec(dllexport) int Ctrl_Resize( HWND wnd, int width, int height )
{
short p_x, d_x, p_y, d_y ;
Error_Fct( hwnd, FCT_IN_TRACE, "TAG Edit: Ctrl_Resize(wind=%08x,dim=%dx%d)", wnd, width, height ) ;
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 Button_Dim_Sml = (short) Fct_Variable_Value( "$INTERFACE_BUTTON_DIM_SML" ) ;
short Space_Dim = (short) Fct_Variable_Value( "$INTERFACE_SPACE_DIM" ) ;
short Border_Dim = (short) Fct_Variable_Value( "$INTERFACE_BORDER_DIM" ) ;
unsigned short TAG_Cur = (unsigned short) Fct_Variable_Value( "$TAG_CUR" ) ;
unsigned short Brush_Cur = (unsigned short) Fct_Variable_Value( "$BRUSH_CUR" ) ;
if ( wnd ) {
box_box.Pos_X = 1 ;
box_box.Pos_Y = 1 ;
box_box.Dim_X = width - 2 ;
box_box.Dim_Y = height - 2 ;
box_box.border = Border_Dim;
box_box.Init( wnd ) ;
} else {
wnd = box_box.wnd ;
}
// ------------------------------------------------
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 - 3) / 4 ;
d_y = Button_Dim_Sml ;
but_load.Name = "Load" ;
but_load.Flag = OUTIL_OUT ;
but_load.Pos_X = p_x ;
but_load.Pos_Y = p_y ;
but_load.Dim_X = 2*d_x+1 ;
but_load.Dim_Y = d_y ;
but_load.border = Border_Dim;
but_load.Font_Name = Tools_Font_Name ;
but_load.Font_Weight = Tools_Font_Weigth ;
but_load.Font_Scale = Tools_Font_Scale ;
but_load.Init( wnd ) ;
p_x += 2*d_x + 2 ;
but_undo.Name = "Undo" ;
but_undo.Flag = OUTIL_OUT ;
but_undo.Pos_X = p_x ;
but_undo.Pos_Y = p_y ;
but_undo.Dim_X = box_box.Dim_X - 2*Space_Dim - (2*d_x+2) ; ;
but_undo.Dim_Y = d_y ;
but_undo.border = Border_Dim;
but_undo.Font_Name = Tools_Font_Name ;
but_undo.Font_Weight = Tools_Font_Weigth ;
but_undo.Font_Scale = Tools_Font_Scale ;
but_undo.Init( wnd ) ;
p_x = box_box.Pos_X + Space_Dim ;
p_y += d_y + 1 ;
// --- erosion et dilatation ---
but_erose.Name = "Erosion" ;
but_erose.Pos_X = p_x ;
but_erose.Pos_Y = p_y ;
but_erose.Dim_X = 2*d_x+1 ;
but_erose.Dim_Y = d_y ;
but_erose.border = Border_Dim;
but_erose.Font_Name = Tools_Font_Name ;
but_erose.Font_Weight = Tools_Font_Weigth ;
but_erose.Font_Scale = Tools_Font_Scale ;
but_erose.Init( wnd ) ;
p_x += 2*d_x + 2 ;
but_dilat.Name = "Dilatation" ;
but_dilat.Pos_X = p_x ;
but_dilat.Pos_Y = p_y ;
but_dilat.Dim_X = box_box.Dim_X - 2*Space_Dim - (2*d_x+2) ; ;
but_dilat.Dim_Y = d_y ;
but_dilat.border = Border_Dim;
but_dilat.Font_Name = Tools_Font_Name ;
but_dilat.Font_Weight = Tools_Font_Weigth ;
but_dilat.Font_Scale = Tools_Font_Scale ;
but_dilat.Init( wnd ) ;
// --- opening and closing ---
p_x = box_box.Pos_X + Space_Dim ;
p_y += d_y + 1 ;
but_open1.Name = "Open 1" ;
but_open1.Pos_X = p_x ;
but_open1.Pos_Y = p_y ;
but_open1.Dim_X = d_x ;
but_open1.Dim_Y = d_y ;
but_open1.border = Border_Dim;
but_open1.Font_Name = Tools_Font_Name ;
but_open1.Font_Weight = Tools_Font_Weigth ;
but_open1.Font_Scale = Tools_Font_Scale ;
but_open1.Init( wnd ) ;
p_x += d_x + 1 ;
but_open2.Name = "Open 2" ;
but_open2.Pos_X = p_x ;
but_open2.Pos_Y = p_y ;
but_open2.Dim_X = d_x ;
but_open2.Dim_Y = d_y ;
but_open2.border = Border_Dim;
but_open2.Font_Name = Tools_Font_Name ;
but_open2.Font_Weight = Tools_Font_Weigth ;
but_open2.Font_Scale = Tools_Font_Scale ;
but_open2.Init( wnd ) ;
p_x += d_x + 1 ;
but_close1.Name = "Close 1" ;
but_close1.Pos_X = p_x ;
but_close1.Pos_Y = p_y ;
but_close1.Dim_X = d_x ;
but_close1.Dim_Y = d_y ;
but_close1.border = Border_Dim;
but_close1.Font_Name = Tools_Font_Name ;
but_close1.Font_Weight = Tools_Font_Weigth ;
but_close1.Font_Scale = Tools_Font_Scale ;
but_close1.Init( wnd ) ;
p_x += d_x + 1 ;
but_close2.Name = "Close 2" ;
but_close2.Pos_X = p_x ;
but_close2.Pos_Y = p_y ;
but_close2.Dim_X = box_box.Dim_X - 2*Space_Dim - (3*d_x+3) ; ;
but_close2.Dim_Y = d_y ;
but_close2.border = Border_Dim;
but_close2.Font_Name = Tools_Font_Name ;
but_close2.Font_Weight = Tools_Font_Weigth ;
but_close2.Font_Scale = Tools_Font_Scale ;
but_close2.Init( wnd ) ;
// ------------------------------------------------
// --- TAG Selection Tool ---
// ------------------------------------------------
p_x = box_box.Pos_X + Space_Dim ;
p_y += d_y + Space_Dim ;
d_x = box_box.Dim_X - 2*Space_Dim ;
d_y = tool_tag.Height(4) ;
box_tag.Flag = OUTIL_NO_3D ;
box_tag.Pos_X = p_x ;
box_tag.Pos_Y = p_y ;
box_tag.Dim_X = d_x ;
box_tag.Dim_Y = d_y ;
box_tag.color = box_box.color ;
box_tag.border = Border_Dim;
box_tag.Font_Name = Tools_Font_Name ;
box_tag.Font_Weight = Tools_Font_Weigth ;
box_tag.Font_Scale = Tools_Font_Scale ; // + 1 ;
box_tag.Init( wnd ) ;
box_tag.Flag = OUTIL_EMPTY ;
tool_tag.Resize( &box_tag ) ;
// ------------------------------------------------
// ------------------------------------------------
// --- Brush Selection Tool ---
// ------------------------------------------------
p_x = box_box.Pos_X + Space_Dim ;
p_y += d_y + Space_Dim ;
d_x = box_box.Dim_X - 2*Space_Dim ;
d_y = tool_brush.Height() ;
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.Init( wnd ) ;
tool_brush.Resize( &box_brush ) ;
// ------------------------------------------------
return( 1 ) ;
}
...
|