⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jui_widget.c

📁 java 1.1 gemini 08_16
💻 C
📖 第 1 页 / 共 5 页
字号:
volatile int j2me_lcd_mutex_cnt = 0;
volatile module_type j2me_lcd_mutex_tid = MOD_NIL;


/*****************************************************************************
 * FUNCTION
 *  jui_lcd_mutex_lock
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void jui_lcd_mutex_lock(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* GDI_LOCK; */
    if (stack_int_get_active_module_id() != j2me_lcd_mutex_tid)
    {
        kal_take_mutex(J2ME_lcd_mutex);
        j2me_lcd_mutex_tid = stack_int_get_active_module_id();
    }
    ++j2me_lcd_mutex_cnt;

}


/*****************************************************************************
 * FUNCTION
 *  jui_lcd_mutex_unlock
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void jui_lcd_mutex_unlock(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(j2me_lcd_mutex_tid == stack_int_get_active_module_id());

    --j2me_lcd_mutex_cnt;

    if (j2me_lcd_mutex_cnt == 0)
    {
        j2me_lcd_mutex_tid = MOD_NIL;
        kal_give_mutex(J2ME_lcd_mutex);
    }
    /* GDI_UNLOCK; */
}

/* void LCDUIrefresh(kal_int32 x1, kal_int32 y1, kal_int32 x2, kal_int32 y2) */


/*****************************************************************************
 * FUNCTION
 *  jui_widget_refresh_screen
 * DESCRIPTION
 *  update screen using given range.
 * PARAMETERS
 *  x1      [IN]        Start of x-coordinate
 *  y1      [IN]        Start of y-coordinate
 *  x2      [IN]        End of x-coordinate
 *  y2      [IN]        End of y-coordinate
 * RETURNS
 *  void
 *****************************************************************************/
void jui_widget_refresh_screen(kal_int32 x1, kal_int32 y1, kal_int32 x2, kal_int32 y2)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* reject invalid case */
    if (x1 > x2)
    {
        kal_int32 t = x1;

        x1 = x2;
        x2 = t;
    }

    if (y1 > y2)
    {
        kal_int32 t = y1;

        y1 = y2;
        y2 = t;
    }

    if ((x1 >= LCD_WIDTH) || (y1 >= LCD_HEIGHT))
    {
        return;
    }
    if ((x2 < 0) || (y2 < 0))
    {
        return;
    }

    JAL_LOCK_MUTEX
    if (x1 < 0)
    {
        x1 = 0;
    }
    if (y1 < 0)
    {
        y1 = 0;
    }
    if (x2 >= LCD_WIDTH)
    {
        x2 = LCD_WIDTH - 1;
    }
    if (y2 >= LCD_HEIGHT)
    {
        y2 = LCD_HEIGHT - 1;
    }

    /* to enter cs will degrade performance, however, to avoid gdi mutex assert */

    jui_widget_refresh_lcd(x1, y1, x2, y2);

    JAL_UNLOCK_MUTEX
}

/* void LCDUIgetDisplayParams(kal_int32 *width, kal_int32 *height, kal_int32 *adornedHeight,
   kal_int32 *erase_color, kal_int32 *depth, kal_int32 *flags, kal_int32 *alphaLevels) */


/*****************************************************************************
 * FUNCTION
 *  jui_widget_get_display_properties
 * DESCRIPTION
 *  Get widget display property
 * PARAMETERS
 *  width               [IN/OUT]        Screen width
 *  height              [IN/OUT]        Screen height
 *  adornedHeight       [IN/OUT]        Displayable height
 *  erase_color         [IN/OUT]        Erase color
 *  depth               [IN/OUT]        Color format of ui buffer
 *  alphaLevels         [IN/OUT]        Alpha levels
 * RETURNS
 *  void
 *****************************************************************************/
void jui_widget_get_display_properties(
        kal_int32 *width,
        kal_int32 *height,
        kal_int32 *adornedHeight,
        kal_int32 *fg_color,
        kal_int32 *erase_color,
        kal_int32 *depth,
        kal_int32 *alphaLevels)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    color c;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Need to port */
    *width = jui_ui_device_width;
    *height = jui_ui_device_height;
#if defined (__MMI_MAINLCD_128X128__) || defined (__MMI_MAINLCD_128X160__) || defined (MMI_SHOW_STATUS_ICON_IN_TITLE)
    *adornedHeight = jui_ui_device_height - MMI_button_bar_height;
#else
    *adornedHeight = jui_ui_device_height - MMI_button_bar_height - MMI_status_bar_height;
#endif
    c = current_MMI_theme->list_selected_item_filler->c;
    *fg_color = (((kal_int32) c.alpha) << 24) |
        (((kal_int32) c.r) << 16) | (((kal_int32) c.g) << 8) | (((kal_int32) c.b));

    c = current_MMI_theme->general_background_filler->c;
    *erase_color = (((kal_int32) c.alpha) << 24) |
        (((kal_int32) c.r) << 16) | (((kal_int32) c.g) << 8) | (((kal_int32) c.b));

    *depth = gdi_layer_get_bit_per_pixel();
    *alphaLevels = 16;
}


/*****************************************************************************
 * FUNCTION
 *  jui_widget_get_display_width
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
kal_int32 jui_widget_get_display_width(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (jui_ui_device_width == 0)
    {
        jui_ui_device_width = UI_device_width;
    }
    return jui_ui_device_width;
}


/*****************************************************************************
 * FUNCTION
 *  jui_widget_get_display_height
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
kal_int32 jui_widget_get_display_height(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (jui_ui_device_height == 0)
    {
        jui_ui_device_height = UI_device_height;
    }
    return jui_ui_device_height;
}


/*****************************************************************************
 * FUNCTION
 *  jui_widget_get_button_bar_height
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
kal_int32 jui_widget_get_button_bar_height(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return MMI_button_bar_height;
}

                                                   /* jboolean LCDUIplaySound(kal_int32 soundType) *//* should move outside */


/*****************************************************************************
 * FUNCTION
 *  jui_widget_play_sound
 * DESCRIPTION
 *  
 * PARAMETERS
 *  soundType       [IN]        
 * RETURNS
 *  
 *****************************************************************************/
kal_bool jui_widget_play_sound(kal_int32 soundType)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    aud_play_id_struct id_param;
    med_result_enum result;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    kal_trace(TRACE_FUNC, FUNC_J2ME_JUI_WIDGET_PLAY_SOUND);

    /* If mute, return directly */
    if (jam_get_aud_volume_level() == 0)
    {
        return KAL_TRUE;
    }
    
    if ((soundType == JUI_ALERT_WARNING) || (soundType == JUI_ALERT_ERROR) || (soundType == JUI_ALERT_ALARM))
    {
        switch (soundType)
        {
            case JUI_ALERT_WARNING:
                id_param.audio_id = (U8) TONE_WARNING1;
                break;
            case JUI_ALERT_ERROR:
                id_param.audio_id = (U8) TONE_ERROR1;
                break;
            default:
                id_param.audio_id = (U8) TONE_WARNING1;
                break;
        }
        
        id_param.play_style = 0;
        id_param.volume = jam_get_aud_volume_level();
        id_param.output_path = MDI_DEVICE_SPEAKER2;
        id_param.identifier = 0;
        result = (med_result_enum) media_aud_play_id(MOD_J2ME, &id_param);

        if (result != MED_RES_OK)
        {
            kal_trace(TRACE_ERROR, INFO_J2ME_MMA_MARKER_FAIL);
        }
        return KAL_TRUE;
    }
    else
    {
        return KAL_FALSE;
    }
}

/* Requests a flashing effect for the device's backlight. */
/* jboolean LCDUIshowBacklight(jboolean mode) */


/*****************************************************************************
 * FUNCTION
 *  jui_widget_set_backlight
 * DESCRIPTION
 *  Set backlight on or off
 * PARAMETERS
 *  mode        [IN]        On or off
 * RETURNS
 *  
 *****************************************************************************/
kal_bool jui_widget_set_backlight(kal_bool mode)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (mode)
    {
        return jvm_BackLightOn();
    }
    else
    {
        return jvm_BackLightOff();
    }
}

/* void InitializeWindowSystem() */


/*****************************************************************************
 * FUNCTION
 *  jui_widget_init
 * DESCRIPTION
 *  init widget environment
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void jui_widget_init(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    jui_widget_init_layer();
    jui_widget_register_lcd(KAL_TRUE);

}

/* 
 * Finalize the use of the window system by returning all allocated
 * graphics data structures to the free list. e.g. close, destroy or free
 * X, Xt and xpm library resources.
 */
/* void FinalizeWindowSystem() */


/*****************************************************************************
 * FUNCTION
 *  jui_widget_deinit
 * DESCRIPTION
 *  deinit widget environment
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void jui_widget_deinit(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    jui_widget_deinit_layer();
}


/*****************************************************************************
 * FUNCTION
 *  jui_hide_status_icons_bar0
 * DESCRIPTION
 *  hide function of horizontal status bar
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void jui_hide_status_icons_bar0(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 x1, y1, x2, y2;
    color c;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    kal_trace(TRACE_GROUP_5, 
        FUNC_J2ME_JUI_STATUS,
        __LINE__,
        jui_widget_obj_show_status(JUI_OBJ_STATUS_BAR),
        jui_is_hide_status_icon,
        (jui_widget_act_mode_idx == JUI_SCREEN_MODE_FULL),
        jvm_is_own_screen(),
        jui_status_icon_layer_handle);
    
    if (!jui_is_hide_status_icon || !jvm_is_own_screen())
    {
        return;
    }
    ASSERT(current_MMI_theme->lite_disp_scr_bg_color);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -