static void ok_cb(void *data) { apply_config(); Epplet_save_config(); Epplet_window_destroy(config_win); config_win = None; return; data = NULL; }
nrfx_err_t nrfx_uart_init(nrfx_uart_t const * p_instance, nrfx_uart_config_t const * p_config, nrfx_uart_event_handler_t event_handler) { NRFX_ASSERT(p_config); uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; nrfx_err_t err_code = NRFX_SUCCESS; if (p_cb->state != NRFX_DRV_STATE_UNINITIALIZED) { err_code = NRFX_ERROR_INVALID_STATE; NRFX_LOG_WARNING("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code)); return err_code; } #if NRFX_CHECK(NRFX_PRS_ENABLED) static nrfx_irq_handler_t const irq_handlers[NRFX_UART_ENABLED_COUNT] = { #if NRFX_CHECK(NRFX_UART0_ENABLED) nrfx_uart_0_irq_handler, #endif }; if (nrfx_prs_acquire(p_instance->p_reg, irq_handlers[p_instance->drv_inst_idx]) != NRFX_SUCCESS) { err_code = NRFX_ERROR_BUSY; NRFX_LOG_WARNING("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code)); return err_code; } #endif // NRFX_CHECK(NRFX_PRS_ENABLED) apply_config(p_instance, p_config); p_cb->handler = event_handler; p_cb->p_context = p_config->p_context; if (p_cb->handler) { interrupts_enable(p_instance, p_config->interrupt_priority); } nrf_uart_enable(p_instance->p_reg); p_cb->rx_buffer_length = 0; p_cb->rx_secondary_buffer_length = 0; p_cb->rx_enabled = false; p_cb->tx_buffer_length = 0; p_cb->state = NRFX_DRV_STATE_INITIALIZED; NRFX_LOG_WARNING("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code)); return err_code; }
static void ok_cb(void *data) { apply_config(1); save_config(); Epplet_window_destroy(config_win); config_win = None; if (cfg_gads) { free(cfg_gads); cfg_gads = NULL; } return; data = NULL; }
// Called at program start to bootstrap everything. void handle_init() { app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "handle_init"); // Record the fallback font pointer so we can identify if this one // is accidentally returned from fonts_load_custom_font(). fallback_font = fonts_get_system_font(FONT_KEY_FONT_FALLBACK); load_config(); #ifdef MAKE_CHRONOGRAPH load_chrono_data(); #endif // MAKE_CHRONOGRAPH app_message_register_inbox_received(receive_config_handler); app_message_register_inbox_dropped(dropped_config_handler); #define INBOX_MESSAGE_SIZE 200 #define OUTBOX_MESSAGE_SIZE 50 #ifndef NDEBUG uint32_t inbox_max = app_message_inbox_size_maximum(); uint32_t outbox_max = app_message_outbox_size_maximum(); app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "available message space %u, %u", (unsigned int)inbox_max, (unsigned int)outbox_max); if (inbox_max > INBOX_MESSAGE_SIZE) { inbox_max = INBOX_MESSAGE_SIZE; } if (outbox_max > OUTBOX_MESSAGE_SIZE) { outbox_max = OUTBOX_MESSAGE_SIZE; } app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "app_message_open(%u, %u)", (unsigned int)inbox_max, (unsigned int)outbox_max); AppMessageResult open_result = app_message_open(inbox_max, outbox_max); app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "open_result = %d", open_result); #else // NDEBUG app_message_open(INBOX_MESSAGE_SIZE, OUTBOX_MESSAGE_SIZE); #endif // NDEBUG time_t now = time(NULL); struct tm *startup_time = localtime(&now); date_numeric_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD); create_objects(); compute_hands(startup_time, ¤t_placement); apply_config(); }
static int config_parse_line(char* line, int line_count, void* ptr_data) { char* pos; char* key; char* data; struct hub_config* config = (struct hub_config*) ptr_data; strip_off_ini_line_comments(line, line_count); if (!*line) return 0; LOG_DUMP("config_parse_line(): '%s'", line); if (!is_valid_utf8(line)) { LOG_WARN("Invalid utf-8 characters on line %d", line_count); } if ((pos = strchr(line, '=')) != NULL) { pos[0] = 0; } else { return 0; } key = line; data = &pos[1]; key = strip_white_space(key); data = strip_white_space(data); data = strip_off_quotes(data); if (!*key || !*data) { LOG_FATAL("Configuration parse error on line %d", line_count); return -1; } LOG_DUMP("config_parse_line: '%s' => '%s'", key, data); return apply_config(config, key, data, line_count); }
/** Tests the configuration the user supplied * * @param rh a handle to parsed configuration. * @param filename a name of a configuration file. * @return 0 on success, -1 when failure. */ int rc_test_config(rc_handle *rh, char const *filename) { SERVER *srv; srv = rc_conf_srv(rh, "authserver"); if (!srv || !srv->max) { rc_log(LOG_ERR,"%s: no authserver specified", filename); return -1; } srv = rc_conf_srv(rh, "acctserver"); if (!srv || !srv->max) { /* it is allowed not to have acct servers */ if (rh->so_type != RC_SOCKET_TLS && rh->so_type != RC_SOCKET_DTLS) rc_log(LOG_DEBUG,"%s: no acctserver specified", filename); } if (!rc_conf_str(rh, "dictionary")) { rc_log(LOG_ERR,"%s: no dictionary specified", filename); return -1; } if (rc_conf_int(rh, "radius_timeout") <= 0) { rc_log(LOG_ERR,"%s: radius_timeout <= 0 is illegal", filename); return -1; } if (rc_conf_int(rh, "radius_retries") <= 0) { rc_log(LOG_ERR,"%s: radius_retries <= 0 is illegal", filename); return -1; } if (apply_config(rh) == -1) { return -1; } return 0; }
GLVideoSystem::GLVideoSystem(bool use_opengl33core) : m_use_opengl33core(use_opengl33core), m_texture_manager(), m_renderer(), m_lightmap(), m_back_renderer(), m_context(), m_window(), m_glcontext(), m_desktop_size(), m_viewport() { SDL_DisplayMode mode; SDL_GetCurrentDisplayMode(0, &mode); m_desktop_size = Size(mode.w, mode.h); create_window(); m_texture_manager.reset(new TextureManager); m_renderer.reset(new GLScreenRenderer(*this)); #if defined(USE_OPENGLES2) m_context.reset(new GL33CoreContext(*this)); #elif defined(USE_OPENGLES1) m_context.reset(new GL20Context); #else if (use_opengl33core) { m_context.reset(new GL33CoreContext(*this)); } else { m_context.reset(new GL20Context); } #endif apply_config(); }
blargg_err_t Effects_Buffer::set_channel_count( int count, int const* types ) { RETURN_ERR( Multi_Buffer::set_channel_count( count, types ) ); delete_bufs(); mixer.samples_read = 0; RETURN_ERR( chans.resize( count + extra_chans ) ); RETURN_ERR( new_bufs( min( bufs_max, count + extra_chans ) ) ); { for ( int i = bufs_size; --i >= 0; ) RETURN_ERR( bufs [i].set_sample_rate( sample_rate(), length() ) ); } { for ( blip_long i = chans.size(); --i >= 0; ) { chan_t& ch = chans [i]; ch.cfg.vol = 1.0f; ch.cfg.pan = 0.0f; ch.cfg.surround = false; ch.cfg.echo = false; } } // side channels with echo chans [2].cfg.echo = true; chans [3].cfg.echo = true; clock_rate( clock_rate_ ); bass_freq( bass_freq_ ); apply_config(); clear(); return 0; }
void SDLBaseVideoSystem::on_resize(int w, int h) { g_config->window_size = Size(w, h); apply_config(); }
static void apply_handler(control *unused(ctrl), void *unused(data), int event) { if (event == EVENT_ACTION) apply_config(); }
SDLRenderer::SDLRenderer() : m_window(), m_renderer(), m_viewport(), m_desktop_size(0, 0), m_scale(1.0f, 1.0f) { SDL_DisplayMode mode; if (SDL_GetDesktopDisplayMode(0, &mode) != 0) { log_warning << "Couldn't get desktop display mode: " << SDL_GetError() << std::endl; } else { m_desktop_size = Size(mode.w, mode.h); } log_info << "creating SDLRenderer" << std::endl; int width = g_config->window_size.width; int height = g_config->window_size.height; int flags = SDL_WINDOW_RESIZABLE; if(g_config->use_fullscreen) { if (g_config->fullscreen_size == Size(0, 0)) { flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; width = g_config->window_size.width; height = g_config->window_size.height; } else { flags |= SDL_WINDOW_FULLSCREEN; width = g_config->fullscreen_size.width; height = g_config->fullscreen_size.height; } } SCREEN_WIDTH = width; SCREEN_HEIGHT = height; m_viewport.x = 0; m_viewport.y = 0; m_viewport.w = width; m_viewport.h = height; SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2"); int ret = SDL_CreateWindowAndRenderer(width, height, flags, &m_window, &m_renderer); if(ret != 0) { std::stringstream msg; msg << "Couldn't set video mode (" << width << "x" << height << "): " << SDL_GetError(); throw std::runtime_error(msg.str()); } SDL_RendererInfo info; if (SDL_GetRendererInfo(m_renderer, &info) != 0) { log_warning << "Couldn't get RendererInfo: " << SDL_GetError() << std::endl; } else { log_info << "SDL_Renderer: " << info.name << std::endl; log_info << "SDL_RendererFlags: " << std::endl; if (info.flags & SDL_RENDERER_SOFTWARE) { log_info << " SDL_RENDERER_SOFTWARE" << std::endl; } if (info.flags & SDL_RENDERER_ACCELERATED) { log_info << " SDL_RENDERER_ACCELERATED" << std::endl; } if (info.flags & SDL_RENDERER_PRESENTVSYNC) { log_info << " SDL_RENDERER_PRESENTVSYNC" << std::endl; } if (info.flags & SDL_RENDERER_TARGETTEXTURE) { log_info << " SDL_RENDERER_TARGETTEXTURE" << std::endl; } log_info << "Texture Formats: " << std::endl; for(size_t i = 0; i < info.num_texture_formats; ++i) { log_info << " " << SDL_GetPixelFormatName(info.texture_formats[i]) << std::endl; } log_info << "Max Texture Width: " << info.max_texture_width << std::endl; log_info << "Max Texture Height: " << info.max_texture_height << std::endl; } g_config->window_size = Size(width, height); apply_config(); }
BOOL CALLBACK playlists_dropdown::preferences::DisplayDlgProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case MSG_UPDATEPREVIEW: { static_api_ptr_t<playlist_manager> pm; t_size playlist = pm->get_active_playlist(); if (playlist != pfc_infinite) { static_api_ptr_t<titleformat_compiler> cmp; titleformat_object::ptr title_format; if (cmp->compile(title_format, cfg::title_string)) { titleformat_hook_impl_splitter hook(titleformat_hook_impl_splitter( &title_format_hook(playlist, false), &titleformat_hook_impl_list(playlist, pm->get_playlist_count()))); pfc::string8 title; title_format->run(&hook, title, NULL); pfc::string8 preview; cmp->remove_color_marks(title, preview); preview.replace_char('\t', ' '); uSetDlgItemText(wnd, IDC_PREVIEW, preview); } else { uSetDlgItemText(wnd, IDC_PREVIEW, "COMPILATION ERROR"); } } else { uSetDlgItemText(wnd, IDC_PREVIEW, "N/A"); } } break; case WM_COMMAND: switch (wp) { // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // GENERAL // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= case IDC_SHOW_ICONS: cfg::show_icons = uButton_GetCheck(wnd, IDC_SHOW_ICONS); playlists_dropdown::g_reload_icons(); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; case IDC_ICON_UTILS: { HMENU menu = CreatePopupMenu(); uAppendMenu(menu, MF_STRING, 1, "Clear custom icons history"); uAppendMenu(menu, MF_STRING, 2, "Reset all icons to default"); RECT rc; GetWindowRect(GetDlgItem(wnd, IDC_ICON_UTILS), &rc); int cmd = TrackPopupMenu(menu, TPM_NONOTIFY | TPM_RETURNCMD, rc.left, rc.bottom, 0, GetDlgItem(wnd, IDC_ICON_UTILS), 0); DestroyMenu(menu); if (cmd == 1 && uMessageBox(wnd, "Are you sure you want to clear all custom icons history?", "Continue?", MB_YESNO) == IDYES) { cfg::custom_icons_history.reset(); } else if (cmd == 2 && uMessageBox(wnd, "Are you sure you want to reset all icons to default?", "Continue?", MB_YESNO) == IDYES) { try { static_api_ptr_t<playlist_manager_v2> pm2; for (int i = 0, total = pm2->get_playlist_count(); i < total; i++) { pm2->playlist_remove_property(i, guid_icon_path); } } catch(...) { } } playlists_dropdown::g_reload_icons(); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); } break; case IDC_MIN_VISIBLE | EN_CHANGE << 16: cfg::min_visible = uGetDlgItemInt(wnd, IDC_MIN_VISIBLE, NULL, true); playlists_dropdown::g_update_all_min_visible(); break; case IDC_FORMATTING_STRING | EN_CHANGE << 16: if (TabCtrl_GetDlgCurSel(wnd, IDC_FS_TAB) == 0) { uGetDlgItemText(wnd, IDC_FORMATTING_STRING, cfg::title_string); uSendMessage(wnd, MSG_UPDATEPREVIEW, 0, 0); } else { uGetDlgItemText(wnd, IDC_FORMATTING_STRING, cfg::style_string); } uEnableWindow(uGetDlgItem(wnd, IDC_APPLY), true); break; // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // PADDING // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= case IDC_PADDING_TOP | EN_CHANGE << 16: cfg::padding.get_value().top = uGetDlgItemInt(wnd, IDC_PADDING_TOP, NULL, true); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; case IDC_PADDING_RIGHT | EN_CHANGE << 16: cfg::padding.get_value().right = uGetDlgItemInt(wnd, IDC_PADDING_RIGHT, NULL, true); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; case IDC_PADDING_BOTTOM | EN_CHANGE << 16: cfg::padding.get_value().bottom = uGetDlgItemInt(wnd, IDC_PADDING_BOTTOM, NULL, true); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; case IDC_PADDING_LEFT | EN_CHANGE << 16: cfg::padding.get_value().left = uGetDlgItemInt(wnd, IDC_PADDING_LEFT, NULL, true); playlists_dropdown::g_update_all_sizes(); playlists_dropdown::g_redraw_all(); break; // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // FIELDS BUTTON // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= case IDC_FIELDS: { HMENU menu = CreatePopupMenu(); for (int i = 1; i < tabsize(g_fields_list); i++) { uAppendMenu(menu, !!g_fields_list[i].label ? MF_STRING : MF_SEPARATOR, i, g_fields_list[i].label); } RECT rc; GetWindowRect(GetDlgItem(wnd, IDC_FIELDS), &rc); int cmd = TrackPopupMenu(menu, TPM_NONOTIFY | TPM_RETURNCMD, rc.left, rc.bottom, 0, GetDlgItem(wnd, IDC_FIELDS), 0); DestroyMenu(menu); if (cmd >= 0 && cmd < tabsize(g_fields_list) && !!g_fields_list[cmd].label) { uSendDlgItemMessageText(wnd, IDC_FORMATTING_STRING, EM_REPLACESEL, TRUE, g_fields_list[cmd].label); SetFocus(GetDlgItem(wnd, IDC_FORMATTING_STRING)); } } break; // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // APPLY // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= case IDC_APPLY: apply_config(); uEnableWindow(uGetDlgItem(wnd, IDC_APPLY), FALSE); break; } break; case WM_INITDIALOG: { EnableTheming(wnd); // Setup "Display/Style" TabControl HWND hTabWnd = uGetDlgItem(wnd, IDC_FS_TAB); uTabCtrl_InsertItemText(hTabWnd, 0, "Display"); uTabCtrl_InsertItemText(hTabWnd, 1, "Style"); TabCtrl_SetCurSel(hTabWnd, cfg::last_fs_tab); uSetDlgItemText(wnd, IDC_FORMATTING_STRING, get_formatting_string(TabCtrl_GetCurSel(hTabWnd))); uButton_SetCheck(wnd, IDC_SHOW_ICONS, cfg::show_icons); SetDlgSpinner(wnd, IDC_MIN_VISIBLE_SPIN, IDC_MIN_VISIBLE, 1, 1000, cfg::min_visible); SetDlgSpinner(wnd, IDC_PADDING_TOP_SPIN, IDC_PADDING_TOP, 0, 1024, cfg::padding.get_value().top); SetDlgSpinner(wnd, IDC_PADDING_RIGHT_SPIN, IDC_PADDING_RIGHT, 0, 1024, cfg::padding.get_value().right); SetDlgSpinner(wnd, IDC_PADDING_BOTTOM_SPIN, IDC_PADDING_BOTTOM, 0, 1024, cfg::padding.get_value().bottom); SetDlgSpinner(wnd, IDC_PADDING_LEFT_SPIN, IDC_PADDING_LEFT, 0, 1024, cfg::padding.get_value().left); uEnableWindow(uGetDlgItem(wnd, IDC_APPLY), FALSE); SendMessage(wnd, MSG_UPDATEPREVIEW, 0, 0); } break; case WM_DESTROY: cfg::last_fs_tab = TabCtrl_GetDlgCurSel(wnd, IDC_FS_TAB); break; case WM_NOTIFY: if (((LPNMHDR) lp)->idFrom == IDC_FS_TAB && ((LPNMHDR) lp)->code == TCN_SELCHANGE) { uSetDlgItemText(wnd, IDC_FORMATTING_STRING, get_formatting_string(TabCtrl_GetDlgCurSel(wnd, IDC_FS_TAB))); } break; default: return false; } return true; }
static visualizer_t * visualizer_create() { const bg_plugin_info_t * info; char * tmp_path; int row, col; GtkWidget * main_table; GtkWidget * table; GtkWidget * box; visualizer_t * ret; bg_cfg_section_t * cfg_section; ret = calloc(1, sizeof(*ret)); ret->cb.motion_callback = motion_callback; ret->cb.data = ret; window_init(ret, &ret->normal_window, 0); window_init(ret, &ret->fullscreen_window, 1); ret->current_window = &ret->normal_window; ret->log_window = bg_gtk_log_window_create(log_close_callback, ret, TR("Gmerlin visualizer")); ret->config_button = create_pixmap_button(ret, "config_16.png", TRS("Configure")); ret->plugin_button = create_pixmap_button(ret, "plugin_16.png", TRS("Recording and display plugins")); ret->restart_button = create_pixmap_button(ret, "refresh_16.png", TRS("Restart visualization")); ret->quit_button = create_pixmap_button(ret, "quit_16.png", TRS("Quit")); ret->fullscreen_button = create_pixmap_button(ret, "fullscreen_16.png", TRS("Fullscreen mode")); ret->nofullscreen_button = create_pixmap_button(ret, "windowed_16.png", TRS("Leave fullscreen mode")); ret->log_button = create_pixmap_button(ret, "log_16.png", TRS("Show log window")); ret->about_button = create_pixmap_button(ret, "about_16.png", TRS("About Gmerlin visualizer")); ret->help_button = create_pixmap_button(ret, "help_16.png", TRS("Launch help in a webwroswer")); ret->fps = gtk_label_new("Fps: --:--"); gtk_misc_set_alignment(GTK_MISC(ret->fps), 0.0, 0.5); gtk_widget_show(ret->fps); gtk_widget_hide(ret->nofullscreen_button); // bg_gtk_box_pack_start_defaults(GTK_BOX(mainbox), // bg_gtk_vumeter_get_widget(ret->vumeter)); ret->toolbar = gtk_event_box_new(); gtk_widget_set_events(ret->toolbar, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); g_signal_connect(G_OBJECT(ret->toolbar), "enter-notify-event", G_CALLBACK(crossing_callback), (gpointer*)ret); g_signal_connect(G_OBJECT(ret->toolbar), "leave-notify-event", G_CALLBACK(crossing_callback), (gpointer*)ret); g_object_ref(ret->toolbar); /* Must be done for widgets, which get reparented after */ ret->vumeter = bg_gtk_vumeter_create(2, 0); /* Create actual objects */ /* Create plugin regsitry */ ret->cfg_reg = bg_cfg_registry_create(); tmp_path = bg_search_file_read("visualizer", "config.xml"); bg_cfg_registry_load(ret->cfg_reg, tmp_path); if(tmp_path) free(tmp_path); cfg_section = bg_cfg_registry_find_section(ret->cfg_reg, "plugins"); ret->plugin_reg = bg_plugin_registry_create(cfg_section); ret->visualizer = bg_visualizer_create(ret->plugin_reg); bg_visualizer_set_callbacks(ret->visualizer, &ret->cb); /* Create vis plugin widget */ ret->vis_plugins = bg_gtk_plugin_widget_single_create(TR("Visualization"), ret->plugin_reg, BG_PLUGIN_VISUALIZATION, BG_PLUGIN_VISUALIZE_FRAME | BG_PLUGIN_VISUALIZE_GL); bg_gtk_plugin_widget_single_set_change_callback(ret->vis_plugins, set_vis_plugin, ret); bg_gtk_plugin_widget_single_set_parameter_callback(ret->vis_plugins, set_vis_parameter, ret); /* Create audio and video plugin widgets */ plugin_window_init(&ret->plugin_window, ret); /* Get ov info */ ret->ov_info = bg_gtk_plugin_widget_single_get_plugin(ret->plugin_window.ov_plugins); /* Load recording plugin */ ret->ra_info = bg_gtk_plugin_widget_single_get_plugin(ret->plugin_window.ra_plugins); /* Create config stuff */ ret->visualizer_section = bg_cfg_registry_find_section(ret->cfg_reg, "visualizer"); ret->general_section = bg_cfg_registry_find_section(ret->cfg_reg, "general"); ret->log_section = bg_cfg_registry_find_section(ret->cfg_reg, "log"); ret->cfg_dialog = create_cfg_dialog(ret); /* Pack everything */ main_table = gtk_table_new(2, 2, 0); gtk_table_set_row_spacings(GTK_TABLE(main_table), 5); gtk_table_set_col_spacings(GTK_TABLE(main_table), 5); gtk_container_set_border_width(GTK_CONTAINER(main_table), 5); table = gtk_table_new(1, 4, 0); gtk_table_set_row_spacings(GTK_TABLE(table), 5); gtk_table_set_col_spacings(GTK_TABLE(table), 5); gtk_container_set_border_width(GTK_CONTAINER(table), 5); row = 0; col = 0; bg_gtk_plugin_widget_single_attach(ret->vis_plugins, table, &row, &col); gtk_widget_show(table); gtk_table_attach(GTK_TABLE(main_table), table, 0, 1, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0); box = gtk_hbox_new(0, 0); gtk_box_pack_start(GTK_BOX(box), ret->plugin_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), ret->config_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), ret->restart_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), ret->fullscreen_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), ret->nofullscreen_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), ret->log_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), ret->about_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), ret->help_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), ret->quit_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), ret->fps, TRUE, TRUE, 5); gtk_widget_show(box); gtk_table_attach(GTK_TABLE(main_table), box, 0, 1, 1, 2, GTK_FILL, GTK_SHRINK, 0, 0); gtk_table_attach(GTK_TABLE(main_table), bg_gtk_vumeter_get_widget(ret->vumeter), 1, 2, 0, 2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); gtk_widget_show(main_table); gtk_container_add(GTK_CONTAINER(ret->toolbar), main_table); // gtk_widget_show(ret->toolbar); /* Start with non-fullscreen mode */ attach_toolbar(ret, &ret->normal_window); apply_config(ret); /* Get visualization plugin */ info = bg_gtk_plugin_widget_single_get_plugin(ret->vis_plugins); bg_visualizer_set_vis_plugin(ret->visualizer, info); /* Initialize stuff */ open_audio(ret); open_vis(ret); gtk_widget_show(ret->current_window->window); if(ret->width && ret->height) gtk_decorated_window_move_resize_window(GTK_WINDOW(ret->current_window->window), ret->x, ret->y, ret->width, ret->height); else gtk_decorated_window_move_resize_window(GTK_WINDOW(ret->current_window->window), 100, 100, 640, 480); while(gdk_events_pending() || gtk_events_pending()) gtk_main_iteration(); g_idle_add(idle_func, ret); g_timeout_add(3000, toolbar_timeout, ret); g_timeout_add(1000, fps_timeout, ret); return ret; }