Example #1
0
void contact_list_window_callback(UG_MESSAGE* msg)
{
    if(msg->type == MSG_TYPE_OBJECT) {
        if(msg->id == OBJ_TYPE_BUTTON && msg->event == OBJ_EVENT_RELEASED) {
            unsigned index;
            int contact_number = book_get_number();

            switch(msg->sub_id) {
            case 0:
            case 1:
            case 2:
            case 3:
                index = msg->sub_id + g_contact_first_visible;
                if(index < contact_number) {
                    char* phone = book_get_item_number(index);
                    g_outgoing_number_length = strlen(phone);
                    strcpy(g_outgoing_number, phone);
                    if(g_prev_contact_window_ptr == &g_sms_new_window) {
                        UG_ButtonSetText(&g_sms_new_window, 5, g_outgoing_number);
                        UG_WindowShow(&g_sms_new_window);
                    } else if(g_prev_contact_window_ptr == &g_call_action_window) {
                        strcpy(UG_ButtonGetText(&g_call_action_window, 2), g_outgoing_number);
                        UG_WindowShow(&g_call_action_window);
                    } else if(g_prev_contact_window_ptr == &g_call_condition_window) {
                        strcpy(UG_ButtonGetText(&g_call_condition_window, 2), g_outgoing_number);
                        UG_WindowShow(&g_call_condition_window);
                    } else {
                        calling_window_show(g_outgoing_number);
                    }
                }
                break;
            case 4: // back
                UG_WindowShow(g_prev_contact_window_ptr);
                break;
            case 5: // down
                if(g_contact_first_visible < (contact_number - 1)) {
                    g_contact_first_visible++;
                    contact_list_window_update();
                }
                break;
            case 6: // up
                if(g_contact_first_visible > 0) {
                    g_contact_first_visible--;
                    contact_list_window_update();
                }
                break;
            case 7: // dial
                dial_window_show();
                break;
            default:
                break;
            }
        }
    }
}
Example #2
0
void sms_info_window_callback(UG_MESSAGE *msg)
{
    if (msg->type == MSG_TYPE_OBJECT) {
        if (msg->id == OBJ_TYPE_BUTTON && msg->event == OBJ_EVENT_RELEASED) {
            switch (msg->sub_id) {
                case 0:
                    UG_WindowShow(&g_sms_inbox_window);
                    break;
                case 1:
                    sms_book_add(UG_ButtonGetText(&g_sms_info_window, 2));
                    UG_WindowShow(&g_sms_inbox_window);
                    break;
            }
        }
    }
}
Example #3
0
CScopeWindow::CScopeWindow (UG_S16 sPosX0, UG_S16 sPosY0, CRecorder *pRecorder, CScopeConfig *pConfig)
:	m_pRecorder (pRecorder),
	m_pConfig (pConfig),
	m_nChannelEnable (0),
	m_pTimeLine (0)
{
	assert (m_pRecorder != 0);

	UG_WindowCreate (&m_Window, m_ObjectList, s_ObjectCount, Callback);
	UG_WindowSetStyle (&m_Window, WND_STYLE_2D | WND_STYLE_HIDE_TITLE);
	UG_WindowResize (&m_Window, sPosX0, sPosY0, sPosX0+WIDTH-1, sPosY0+HEIGHT-1);

	UG_TextboxCreate (&m_Window, &m_Textbox1, TXB_ID_0, 5, 5, 149, 25);
	UG_TextboxSetFont (&m_Window, TXB_ID_0, &FONT_10X16);
	UG_TextboxSetText (&m_Window, TXB_ID_0, "TinyScope Pi");
	UG_TextboxSetBackColor (&m_Window, TXB_ID_0, C_LIGHT_GRAY);
	UG_TextboxSetForeColor (&m_Window, TXB_ID_0, C_BLACK);
	UG_TextboxSetAlignment (&m_Window, TXB_ID_0, ALIGN_CENTER);

	UG_WindowShow (&m_Window);

	UG_Update ();

	UpdateChart ();
}
Example #4
0
void contact_list_window_show()
{
    g_prev_contact_window_ptr = UG_GetActiveWindow();

    g_contact_first_visible = 0;
    contact_list_window_update();
    UG_WindowShow(&g_contact_list_window);
}
Example #5
0
static void sms_sending_window_callback(UG_MESSAGE *msg)
{
    if (msg->type == MSG_TYPE_OBJECT) {
        if (msg->id == OBJ_TYPE_BUTTON && msg->event == OBJ_EVENT_RELEASED) {
            UG_WindowShow(UG_GetLastWindow());
        }
    }
}
Example #6
0
static void dial_window_callback(UG_MESSAGE* msg)
{
    if(msg->type == MSG_TYPE_OBJECT) {
        if(msg->id == OBJ_TYPE_BUTTON && msg->event == OBJ_EVENT_RELEASED) {
            switch(msg->sub_id) {
            case 15: // text
                break;
            case 12: // return
                UG_WindowShow(&g_contact_list_window);
                break;
            case 13: // call or send sms
                if(g_prev_contact_window_ptr == &g_sms_new_window) {
                    UG_ButtonSetText(&g_sms_new_window, 5, g_outgoing_number);
                    UG_WindowShow(&g_sms_new_window);
                } else if(g_prev_contact_window_ptr == &g_call_action_window) {
                    strcpy(UG_ButtonGetText(&g_call_action_window, 2), g_outgoing_number);
                    UG_WindowShow(&g_call_action_window);
                } else if(g_prev_contact_window_ptr == &g_call_condition_window) {
                    strcpy(UG_ButtonGetText(&g_call_condition_window, 2), g_outgoing_number);
                    UG_WindowShow(&g_call_condition_window);
                } else {
                    calling_window_show(g_outgoing_number);
                }
                break;
            case 14: // delete
                if(g_outgoing_number_length > 0) {
                    g_outgoing_number_length--;
                    g_outgoing_number[g_outgoing_number_length] = '\0';
                    UG_ButtonSetText(&g_dial_window, 15, g_outgoing_number);
                }
                break;
            default:
                if(g_outgoing_number_length < (sizeof(g_outgoing_number) - 1)) {
                    int index = msg->sub_id;
                    g_outgoing_number[g_outgoing_number_length] = *g_dial_button_text[index];
                    UG_ButtonSetText(&g_dial_window, 15, g_outgoing_number);
                    g_outgoing_number_length++;
                    g_outgoing_number[g_outgoing_number_length] = '\0';
                }
            }
        }
    }
}
Example #7
0
void sms_info_window_show(char *info)
{
    char *icon;
    if (UG_GetActiveWindow() == &g_sms_inbox_window) {
        icon = "G";
    } else {
        icon = "F";
    }
    UG_ButtonSetText(&g_sms_info_window, 1, icon);
    UG_ButtonSetText(&g_sms_info_window, 2, info);
    UG_WindowShow(&g_sms_info_window);
}
Example #8
0
void sms_new_window_show()
{
    char *icon;

    g_sms_new_window_prev = UG_GetActiveWindow();
    if (g_sms_new_window_prev == &g_sms_inbox_window) {
        icon = "F";
    } else {
        icon = ":";
    }
    UG_ButtonSetText(&g_sms_new_window, 3, icon);

    g_sms_template_first_visible = 0;
    g_sms_select_message = 0;
    UG_ButtonSetText(&g_sms_new_window, 6, ":");
    sms_new_window_update();
    UG_WindowShow(&g_sms_new_window);
}
Example #9
0
void dial_window_show(void)
{
    char* icon;
    if(g_prev_contact_window_ptr == &g_sms_info_window) {
        icon = "E"; // sms
    } else if(g_prev_contact_window_ptr == &g_call_condition_window ||
              g_prev_contact_window_ptr == &g_call_action_window || g_prev_contact_window_ptr == &g_sms_new_window) {
        icon = ":"; // ok
    } else {
        icon = "0"; // call
    }
    UG_ButtonSetText(&g_dial_window, 13, icon);

    g_outgoing_number[0] = '\0';
    g_outgoing_number_length = 0;
    UG_ButtonSetText(&g_dial_window, 15, g_outgoing_number);

    UG_WindowShow(&g_dial_window);
}
Example #10
0
void sms_inbox_window_callback(UG_MESSAGE *msg)
{
    int index;
    if (msg->type == MSG_TYPE_OBJECT) {
        if (msg->id == OBJ_TYPE_BUTTON && msg->event == OBJ_EVENT_RELEASED) {
            int index;
            int number = gsm_sms_get_list_number();
            switch (msg->sub_id) {
                case 0:
                case 1:
                    index = g_sms_inbox_first_visible + msg->sub_id;
                    if (index < number) {
                        sms_info_window_show(gsm_sms_remote_content(index));
                    }
                    break;
                case 2: // back
                    UG_WindowShow(&g_home_window);
                    break;
                case 3: // down
                    if (g_sms_inbox_first_visible < (number - 1)) {
                        g_sms_inbox_first_visible++;
                        sms_inbox_window_update();
                    }
                    break;
                case 4: // up
                    if (g_sms_inbox_first_visible > 0) {
                        g_sms_inbox_first_visible--;
                        sms_inbox_window_update();
                    }
                    break;
                case 5: // add
                    sms_new_window_show();
                    break;
                default:
                    break;
            }

        }
    }
}
Example #11
0
void sms_window_show()
{
    sms_inbox_window_update();
    UG_WindowShow(&g_sms_inbox_window);
}
Example #12
0
void sms_new_window_callback(UG_MESSAGE *msg)
{
    if (msg->type == MSG_TYPE_OBJECT) {
        if (msg->id == OBJ_TYPE_BUTTON && msg->event == OBJ_EVENT_RELEASED) {
            int number = sms_get_max_item_num();
            int select;
            switch (msg->sub_id) {
                case 0: // back
                    UG_WindowShow(g_sms_new_window_prev);
                    break;
                case 1: // down
                    if (g_sms_template_first_visible < (number - 1)) {
                        g_sms_template_first_visible++;
                        sms_new_window_update();
                    }
                    break;
                case 2: // up
                    if (g_sms_template_first_visible > 0) {
                        g_sms_template_first_visible--;
                        sms_new_window_update();
                    }
                    break;
                case 3: // send
                    if (g_sms_new_window_prev == &g_sms_inbox_window) {
                        gsm_sms_begin(UG_ButtonGetText(&g_sms_new_window, 5));
                        gsm_sms_send(sms_get_item(g_sms_select_message));

                        UG_TextboxSetText(&g_sms_sending_window, 1, NULL);
//                        UG_ButtonHide(&g_sms_sending_window, 0);
                        UG_WindowShow(&g_sms_sending_window);
                    } else {
                        strcpy(g_sms_action_number, UG_ButtonGetText(&g_sms_new_window, 5));
                        strcpy(g_sms_action_content, sms_get_item(g_sms_select_message));

                        UG_WindowShow(g_sms_new_window_prev);
                    }
                    break;
                case 4:
                case 5:
                    contact_list_window_show();
                    break;
                case 6:
                case 7:
                case 8:
                case 9:
                    select = msg->sub_id - 6 + g_sms_template_first_visible;
                    if (select < number) {
                        g_sms_select_message = select;
                        sms_new_window_update();
                    }
                    break;
                case 10:
                case 11:
                case 12:
                case 13:
                    select = msg->sub_id - 10 + g_sms_template_first_visible;
                    if (select < number) {
                        g_sms_select_message = select;
                        sms_new_window_update();
                    }
                    break;
            }
        }
    }
}
static void settings_window_callback(UG_MESSAGE *msg)
{
    if (msg->type == MSG_TYPE_OBJECT) {
        if (msg->id == OBJ_TYPE_BUTTON && msg->event == OBJ_EVENT_RELEASED) {
            switch (msg->sub_id) {
                case 0: // back
                    if (g_settings_is_changed) {
                        g_settings_is_changed = 0;
                        settings_save();
                    }
                    UG_WindowShow(&g_home_window);
                    break;
                case 3: // -
                    if (g_settings_sound > 0) {
                        g_settings_is_changed = 1;
                        g_settings_sound--;
                        audioSetVolume(g_settings_sound);
                        g_settings_sound_str[0] = '0' + g_settings_sound;
                        UG_ButtonSetText(&g_settings_window, 4,
                                g_settings_sound_str);
                    }
                    break;
                case 5: // +
                    if (g_settings_sound < 6) {
                        g_settings_is_changed = 1;
                        g_settings_sound++;
                        audioSetVolume(g_settings_sound);
                        g_settings_sound_str[0] = '0' + g_settings_sound;
                        UG_ButtonSetText(&g_settings_window, 4,
                                g_settings_sound_str);
                    }
                    break;
                case 6: // -
                    if (g_settings_brightness > 0) {
                        g_settings_is_changed = 1;
                        g_settings_brightness--;
                        lcd_backlight_level(g_brightness_table[g_settings_brightness]);

                        itoa(g_settings_brightness, g_settings_brightness_str,
                                10);
                        UG_ButtonSetText(&g_settings_window, 7,
                                g_settings_brightness_str);
                    }
                    break;
                case 8: // +
                    if (g_settings_brightness < 6) {
                        g_settings_is_changed = 1;
                        g_settings_brightness++;
                        lcd_backlight_level(g_brightness_table[g_settings_brightness]);

                        itoa(g_settings_brightness, g_settings_brightness_str,
                                10);
                        UG_ButtonSetText(&g_settings_window, 7,
                                g_settings_brightness_str);
                    }
                    break;
                default:
                    break;
            }
        }
    }
}