def draw_initialize(ui):
    global cur_fig
    xfl.fl_set_form_minsize(ui.drawfree, 530, 490)
    xfl.fl_set_object_gravity(ui.colgrp, xfl.FL_West, xfl.FL_West)
    xfl.fl_set_object_gravity(ui.sizegrp, xfl.FL_SouthWest, xfl.FL_SouthWest)
    xfl.fl_set_object_gravity(ui.figgrp, xfl.FL_NorthWest, xfl.FL_NorthWest)
    xfl.fl_set_object_gravity(ui.miscgrp, xfl.FL_South, xfl.FL_South)
    xfl.fl_set_object_resize(ui.miscgrp, xfl.FL_RESIZE_NONE)
    cur_fig = saved_figure[0]
    cur_fig.c[0] = cur_fig.c[1] = cur_fig.c[2] = 127
    cur_fig.w = cur_fig.h = 30
    cur_fig.drawit = xfl.fl_oval
    cur_fig.fill = 1
    cur_fig.col = xfl.FL_FREE_COL1 + 1
    xfl.fl_mapcolor(xfl.FL_FREE_COL1, \
            cur_fig.c[0], cur_fig.c[1], cur_fig.c[2])
    xfl.fl_mapcolor(cur_fig.col, \
            cur_fig.c[0], cur_fig.c[1], cur_fig.c[2])
    xfl.fl_set_slider_bounds(ui.wsli, 1, max_w)
    xfl.fl_set_slider_bounds(ui.hsli, 1, max_h)
    xfl.fl_set_slider_precision(ui.wsli, 0)
    xfl.fl_set_slider_precision(ui.hsli, 0)
    xfl.fl_set_slider_value(ui.wsli, cur_fig.w)
    xfl.fl_set_slider_value(ui.hsli, cur_fig.h)
    # color sliders
    xfl.fl_set_slider_bounds(ui.rsli, 1.0, 0)
    xfl.fl_set_slider_bounds(ui.gsli, 1.0, 0)
    xfl.fl_set_slider_bounds(ui.bsli, 1.0, 0)
    # initial drawing function
    xfl.fl_set_button(ui.drobj[0], 1)
    def create_forms(self):

        self.sample = xfl.fl_bgn_form(xfl.FL_NO_BOX, 320, 250)

        self.ptrflobj0 = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 320, 250, '')
        xfl.fl_set_object_color(self.ptrflobj0, xfl.FL_COL1, xfl.FL_COL1)
        xfl.fl_set_object_lalign(self.ptrflobj0, xfl.FL_ALIGN_CENTER)
        xfl.fl_set_object_lstyle(self.ptrflobj0, xfl.FL_NORMAL_STYLE)
        xfl.fl_set_object_lsize(self.ptrflobj0, xfl.FL_DEFAULT_SIZE)
        xfl.fl_set_object_lcol(self.ptrflobj0, xfl.FL_BLACK)
        xfl.fl_set_object_resize(self.ptrflobj0, xfl.FL_RESIZE_ALL)
        xfl.fl_set_object_gravity(self.ptrflobj0, xfl.FL_NoGravity, xfl.FL_NoGravity)
        self.pvalslider = xfl.fl_add_valslider(xfl.FL_HOR_SLIDER, 10, 40, 290, 30, 'Horizontal way')
        xfl.fl_set_object_boxtype(self.pvalslider, xfl.FL_UP_BOX)
        xfl.fl_set_slider_bounds(self.pvalslider, 1, 25)
        xfl.fl_set_slider_value(self.pvalslider, 1)
        xfl.fl_set_slider_increment(self.pvalslider, 0.4, 0.5)
        xfl.fl_set_slider_size(self.pvalslider, 0.20)
        xfl.fl_set_slider_step(self.pvalslider, 1)
        xfl.fl_set_slider_precision(self.pvalslider, 3)
        xfl.fl_set_object_color(self.pvalslider, xfl.FL_COL1, xfl.FL_COL1)
        xfl.fl_set_object_lalign(self.pvalslider, xfl.FL_ALIGN_BOTTOM)
        xfl.fl_set_object_lstyle(self.pvalslider, xfl.FL_NORMAL_STYLE)
        xfl.fl_set_object_lsize(self.pvalslider, xfl.FL_TINY_SIZE)
        xfl.fl_set_object_lcol(self.pvalslider, xfl.FL_BLACK)
        xfl.fl_set_object_resize(self.pvalslider, xfl.FL_RESIZE_ALL)
        xfl.fl_set_object_gravity(self.pvalslider, xfl.FL_NoGravity, xfl.FL_NoGravity)
        xfl.fl_set_object_shortcut(self.pvalslider, 'H', 1)
        xfl.fl_set_object_callback(self.pvalslider, self.slidercb, 4)
        xfl.fl_set_object_return(self.pvalslider, xfl.FL_RETURN_CHANGED|xfl.FL_RETURN_END)

        xfl.fl_end_form()
 def create_form_cl(self):
     if self.pcl:
         return
     self.pcl = xfl.fl_bgn_form(xfl.FL_NO_BOX, 330, 385)
     pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 330, 385, "")
     xfl.fl_set_object_color(pobj, xfl.FL_COL1, xfl.FL_COL1)
     pobj = xfl.fl_add_box(xfl.FL_NO_BOX, 40, 10, 250, 30, "Color Browser")
     xfl.fl_set_object_lcol(pobj, xfl.FL_RED)
     xfl.fl_set_object_lsize(pobj, xfl.FL_HUGE_SIZE)
     xfl.fl_set_object_lstyle(pobj, xfl.FL_BOLD_STYLE + xfl.FL_SHADOW_STYLE)
     xfl.fl_set_object_gravity(pobj, xfl.FL_North, xfl.FL_North)
     xfl.fl_set_object_resize(pobj, xfl.FL_RESIZE_NONE)
     self.pdbobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 40, 50, \
             250, 25, "")
     xfl.fl_set_object_boxtype(self.pdbobj, xfl.FL_BORDER_BOX)
     if xfl.fl_get_visual_depth() == 1:
         tmpcolr = xfl.FL_WHITE
     else:
         tmpcolr = xfl.FL_COL1
     xfl.fl_set_object_color(self.pdbobj, tmpcolr, xfl.FL_COL1)
     xfl.fl_set_object_callback(self.pdbobj, self.db_cb, 0)
     xfl.fl_set_object_gravity(self.pdbobj, xfl.FL_North, xfl.FL_North)
     xfl.fl_set_object_resize(self.pdbobj, xfl.FL_RESIZE_X)
     self.prescol = xfl.fl_add_box(xfl.FL_FLAT_BOX, 225, 90, 90, 35, "")
     xfl.fl_set_object_color(self.prescol, xfl.FL_FREE_COL4, \
             xfl.FL_FREE_COL4)
     xfl.fl_set_object_boxtype(self.prescol, xfl.FL_BORDER_BOX)
     xfl.fl_set_object_resize(self.prescol, xfl.FL_RESIZE_NONE)
     xfl.fl_set_object_gravity(self.prescol, xfl.FL_NorthEast, \
             xfl.FL_East)
     self.prs = xfl.fl_add_valslider(xfl.FL_VERT_FILL_SLIDER, 225, 130, \
             30, 200, "")
     xfl.fl_set_object_color(self.prs, xfl.FL_COL1, xfl.FL_RED)
     xfl.fl_set_slider_bounds(self.prs, 0, 255)
     xfl.fl_set_slider_precision(self.prs, 0)
     xfl.fl_set_object_callback(self.prs, self.search_rgb, 0)
     #xfl.fl_set_object_return(self.prs, 0)
     xfl.fl_set_object_resize(self.prs, xfl.FL_RESIZE_Y)
     xfl.fl_set_object_gravity(self.prs, xfl.FL_NorthEast, \
             xfl.FL_SouthEast)
     xfl.fl_set_object_return(self.prs, xfl.FL_RETURN_CHANGED)
     self.pgs = xfl.fl_add_valslider(xfl.FL_VERT_FILL_SLIDER, 255, 130, \
             30, 200, "")
     xfl.fl_set_object_color(self.pgs, xfl.FL_COL1, xfl.FL_GREEN)
     xfl.fl_set_slider_bounds(self.pgs, 0, 255)
     xfl.fl_set_slider_precision(self.pgs, 0)
     xfl.fl_set_object_callback(self.pgs, self.search_rgb, 1)
     #xfl.fl_set_object_return(self.pgs, 0)
     xfl.fl_set_object_resize(self.pgs, xfl.FL_RESIZE_Y)
     xfl.fl_set_object_gravity(self.pgs, xfl.FL_NorthEast, \
             xfl.FL_SouthEast)
     xfl.fl_set_object_return(self.pgs, xfl.FL_RETURN_CHANGED)
     self.pbs = xfl.fl_add_valslider(xfl.FL_VERT_FILL_SLIDER, 285, 130, \
             30, 200, "")
     xfl.fl_set_object_color(self.pbs, xfl.FL_COL1, xfl.FL_BLUE)
     xfl.fl_set_slider_bounds(self.pbs, 0, 255)
     xfl.fl_set_slider_precision(self.pbs, 0)
     xfl.fl_set_object_callback(self.pbs, self.search_rgb, 2)
     #xfl.fl_set_object_return(self.pbs, 0)
     xfl.fl_set_object_resize(self.pbs, xfl.FL_RESIZE_Y)
     xfl.fl_set_object_gravity(self.pbs, xfl.FL_NorthEast, \
             xfl.FL_SouthEast)
     xfl.fl_set_object_return(self.pbs, xfl.FL_RETURN_CHANGED)
     self.pcolbr = xfl.fl_add_browser(xfl.FL_HOLD_BROWSER, 10, 90, \
             205, 240, "")
     xfl.fl_set_browser_fontstyle(self.pcolbr, xfl.FL_FIXED_STYLE)
     xfl.fl_set_object_callback(self.pcolbr, self.br_cb, 0)
     xfl.fl_set_object_gravity(self.pcolbr, xfl.FL_NorthWest, \
             xfl.FL_SouthEast)
     pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 135, 345, \
             80, 30, "Done")
     xfl.fl_set_object_callback(pobj, self.done_cb, 0)
     xfl.fl_set_object_gravity(pobj, xfl.FL_South, xfl.FL_South)
     xfl.fl_set_object_resize(pobj, xfl.FL_RESIZE_NONE)
     xfl.fl_end_form()
     xfl.fl_scale_form(self.pcl, 1.1, 1.0)