Example #1
0
static void on_configure_response(GtkDialog * dialog, gint response, gpointer * user_data)
{
    if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY)
    {
        if(g_strcmp0(gtk_entry_get_text(GTK_ENTRY(widgets.author_entry)), "") == 0)
        {
            dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("The author name field is empty!"));
        }
        else
        {
            website_selected = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets.combo));
            check_button_is_checked = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets.check_button));
            SETPTR(author_name, g_strdup(gtk_entry_get_text(GTK_ENTRY(widgets.author_entry))));
            save_settings();
        }
    }
}
Example #2
0
void save()
{
	save_settings(&settings,"/setting");
	
	get_pid();
	
	rt_kprintf("pitch:		%d	%d	%d.\n",	settings.pitch_min,
											settings.pitch_mid,
											settings.pitch_max);
	rt_kprintf("roll:		%d	%d	%d.\n",	settings.roll_min,
											settings.roll_mid,
											settings.roll_max);
	rt_kprintf("yaw:		%d	%d	%d.\n",	settings.yaw_min,
											settings.yaw_mid,
											settings.yaw_max);
	rt_kprintf("throttle:	%d	%d.\n",		settings.th_min,
											settings.th_max);
}
Example #3
0
void config_save(void)
{
	save_yawCntrl();
	save_rollCntrl();
	save_pitchCntrl();

//	save_navigation();
//	save_airspeedCntrl();
#if (ALTITUDE_GAINS_VARIABLE == 1)
	save_altitudeCntrlVariable();
#else
	save_altitudeCntrl();
#endif

	save_settings();
	save_gains();
	save_turns();
}
Example #4
0
int main (int argc, char *argv[])
{
	struct sigaction sig_action, old_action;
	MBMManager *manager;
	MBMManagerPrivate *priv;

	sig_action.sa_handler = sig_quit;
	sigemptyset (&sig_action.sa_mask);
	sigaddset (&sig_action.sa_mask, SIGINT);
	sigaddset (&sig_action.sa_mask, SIGTERM);
    sigaddset (&sig_action.sa_mask, SIGHUP);
	sig_action.sa_flags = 0;
	sigaction (SIGINT, &sig_action, &old_action);
	sigaction (SIGTERM, &sig_action, NULL);
    sigaction (SIGHUP, &sig_action, NULL);

	mbm_options_parse (argc, argv);
	g_type_init ();

	if (!g_thread_supported ())
		g_thread_init (NULL);

	dbus_g_thread_init ();

	g_debug ("Started version: %s", VERSION);

	init_settings_table ();
	load_settings ();

	save_settings ();

	g_loop = g_main_loop_new (NULL, FALSE);

	if (!dbus_init (g_loop))
		return -1;

	g_manager = manager = mbm_manager_new ();

	priv = MBM_MANAGER_GET_PRIVATE (manager);

	g_main_loop_run (g_loop);

	g_object_unref (manager);
}
Example #5
0
void save_config(void)
{
#if (USE_CONFIGFILE == 1)
	save_yawCntrl();
	save_rollCntrl();
	save_pitchCntrl();

//	save_navigation();
//	save_airspeedCntrl();
#if (ALTITUDE_GAINS_VARIABLE == 1)
	save_altitudeCntrlVariable();
#else
	save_altitudeCntrl();
#endif

	save_settings();
	save_gains();
#endif // USE_CONFIGFILE
}
Example #6
0
int main(void)
{

static ULONG flFrameFlags = 	FCF_TITLEBAR 			|
															FCF_SYSMENU 			|
															FCF_SIZEBORDER		|
                              FCF_MINMAX 				|
                              FCF_MENU 					|
															FCF_SHELLPOSITION |
                              FCF_ACCELTABLE    |
                              FCF_TASKLIST;

hab = WinInitialize(0L);
hmq = WinCreateMsgQueue (hab,0L);

WinRegisterClass (hab, (PSZ) szProgName, (PFNWP) ClientWndProc, CS_SIZEREDRAW|CS_CLIPCHILDREN,0L);

hwndMain = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE, &flFrameFlags,
																szClientClass, "Drift Warpspeed", WS_VISIBLE,
                                0L,ID_RESOURCE,
																(PHWND) &hwndClient);
// generate gonio tables
generate_tables();

idTimer = WinStartTimer(hab,hwndClient,ID_TIMER,31);

while (WinGetMsg(hab,&qmsg,NULLHANDLE,0,0))
	{
	WinDispatchMsg(hab,&qmsg);
	}

save_hiscores();
if (saveonexit)
  save_settings();
free_all();
free_demo();
WinStopTimer(hab,hwndClient,idTimer);

//WinDestroyWindow(hwndMain);
WinDestroyMsgQueue(hmq);
WinTerminate(hab);
return (0);
}
Example #7
0
/*****************************************************************************
 * InterfaceWindow::_StoreSettings
 *****************************************************************************/
void
InterfaceWindow::_StoreSettings()
{
    /* Save the volume */
    config_PutInt( p_intf, "volume", p_mediaControl->GetVolume() );

    /* Save the windows positions */
    if ( fSettings->ReplaceRect( "main frame", Frame() ) != B_OK )
        fSettings->AddRect( "main frame", Frame() );
#if 0
    if ( fPlaylistWindow->Lock() )
    {
        if (fSettings->ReplaceRect( "playlist frame", fPlaylistWindow->Frame() ) != B_OK)
            fSettings->AddRect( "playlist frame", fPlaylistWindow->Frame() );
        if (fSettings->ReplaceBool( "playlist showing", !fPlaylistWindow->IsHidden() ) != B_OK)
            fSettings->AddBool( "playlist showing", !fPlaylistWindow->IsHidden() );
        fPlaylistWindow->Unlock();
    }
#endif
    if ( fMessagesWindow->Lock() )
    {
        if (fSettings->ReplaceRect( "messages frame", fMessagesWindow->Frame() ) != B_OK)
            fSettings->AddRect( "messages frame", fMessagesWindow->Frame() );
        if (fSettings->ReplaceBool( "messages showing", !fMessagesWindow->IsHidden() ) != B_OK)
            fSettings->AddBool( "messages showing", !fMessagesWindow->IsHidden() );
        fMessagesWindow->Unlock();
    }
    if ( fPreferencesWindow->Lock() )
    {
        if (fSettings->ReplaceRect( "settings frame", fPreferencesWindow->Frame() ) != B_OK)
            fSettings->AddRect( "settings frame", fPreferencesWindow->Frame() );
        if (fSettings->ReplaceBool( "settings showing", !fPreferencesWindow->IsHidden() ) != B_OK)
            fSettings->AddBool( "settings showing", !fPreferencesWindow->IsHidden() );
        fPreferencesWindow->Unlock();
    }
#if 0
    uint32 displayMode = fPlaylistWindow->DisplayMode();
    if (fSettings->ReplaceInt32( "playlist display mode", displayMode ) != B_OK )
        fSettings->AddInt32( "playlist display mode", displayMode );
#endif
    save_settings( fSettings, "interface_settings", "VideoLAN Client" );
}
Example #8
0
static void inbox_received_handler(DictionaryIterator *iter, void *context) {
  // Background Color
  Tuple *bg_color_t = dict_find(iter, MESSAGE_KEY_BackgroundColor);
  if (bg_color_t) {
    settings.BackgroundColor = GColorFromHEX(bg_color_t->value->int32);
  }

  // Background Color
  Tuple *sg_color_t = dict_find(iter, MESSAGE_KEY_SecondaryColor);
  if (sg_color_t) {
    settings.SecondaryColor = GColorFromHEX(sg_color_t->value->int32);
  }

  Tuple *steps = dict_find(iter, MESSAGE_KEY_ShowSteps);
  if (steps) {
    settings.ShowSteps = steps->value->int32 == 1;
  }

  save_settings();
}
Example #9
0
static void on_configure_response(G_GNUC_UNUSED GtkDialog *dialog, G_GNUC_UNUSED gint response, GtkWidget *checkbox)
{
	gboolean old_display_sidebar = display_sidebar;

	display_sidebar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox));

	if (display_sidebar ^ old_display_sidebar)
	{
		if (display_sidebar)
		{
			create_sidebar();
			sidebar_refresh();
		}
		else
		{
			destroy_sidebar();
		}
		save_settings();
	}
}
Example #10
0
static void in_recv_handler(DictionaryIterator *iterator, void *context)
{
  	Tuple *thinLogo_t = dict_find(iterator, MESSAGE_KEY_ThinLogo);
	if (thinLogo_t)
	{
		userSettings.ThinLogo = thinLogo_t->value->int32 == 1;
	}
	
  	Tuple *lyrics_t = dict_find(iterator, MESSAGE_KEY_Lyrics);
	if (lyrics_t)
	{
		userSettings.Lyrics = lyrics_t->value->int32 == 1;	
	}
	
	Tuple *timeColor_t = dict_find(iterator, MESSAGE_KEY_TimeColor);
	if (timeColor_t)
	{
		userSettings.TimeColor = GColorFromHEX(timeColor_t->value->int32);
	}
	
	Tuple *dateColor_t = dict_find(iterator, MESSAGE_KEY_DateColor);
	if (dateColor_t)
	{
		userSettings.DateColor = GColorFromHEX(dateColor_t->value->int32);
	}
	
	Tuple *dayOfWeekColor_t = dict_find(iterator, MESSAGE_KEY_DayOfWeekColor);
	if (dayOfWeekColor_t)
	{
		userSettings.DayOfWeekColor = GColorFromHEX(dayOfWeekColor_t->value->int32);
	}
	
	Tuple *lyricsColor_t = dict_find(iterator, MESSAGE_KEY_LyricsColor);
	if (lyricsColor_t)
	{
		userSettings.LyricsColor = GColorFromHEX(lyricsColor_t->value->int32);
	}
	
	// Save the new settings to persistent storage
	save_settings();
}
Example #11
0
VideoSettings::~VideoSettings()
{
    if ( fSettings )
    {
        // we are the default settings
        // and write our settings to disk
        if (fSettings->ReplaceInt32( "video size", VideoSize() ) != B_OK)
            fSettings->AddInt32( "video size", VideoSize() );
        if (fSettings->ReplaceInt32( "flags", Flags() ) != B_OK)
            fSettings->AddInt32( "flags", Flags() );

        save_settings( fSettings, "video_settings", "VideoLAN Client" );
        delete fSettings;
    }
    else
    {
        // we are just a clone of the default settings
        fDefaultSettings.SetVideoSize( VideoSize() );
        fDefaultSettings.SetFlags( Flags() );
    }
}
Example #12
0
static void message_received(DictionaryIterator *iter, void *context) {
    Tuple *city = dict_find(iter, MESSAGE_KEY_CITY_CHANGE);
    bool dirty = false;
    if(city) {
        freeSchemePack(pack);
        uint32_t c = city->value->uint32;
        DLOG("city change: %d", c);
        settings.city = RESOURCE_ID_SCHEME_MSK + c;
        dirty = true;
    }

    Tuple *loc = dict_find(iter, MESSAGE_KEY_LOCALE_CHANGE);
    if(loc) {
        free_locale();
        uint32_t l = loc->value->uint32;
        DLOG("locale change: %d", l);
        switch(settings.city) {
            case RESOURCE_ID_SCHEME_MSK: settings.scheme_locale = RESOURCE_ID_SCHEME_LOCALE_MSK_EN + l; break;
            case RESOURCE_ID_SCHEME_SPB: settings.scheme_locale = RESOURCE_ID_SCHEME_LOCALE_SPB_EN + l; break;
            case RESOURCE_ID_SCHEME_KIEV: settings.scheme_locale = RESOURCE_ID_SCHEME_LOCALE_KIEV_EN + l; break;
            case RESOURCE_ID_SCHEME_KHARKIV: settings.scheme_locale = RESOURCE_ID_SCHEME_LOCALE_KHARKIV_EN + l; break;
            case RESOURCE_ID_SCHEME_MINSK: settings.scheme_locale = RESOURCE_ID_SCHEME_LOCALE_MINSK_EN + l; break;
        }
        settings.locale = RESOURCE_ID_LOCALE_EN + l;
        dirty = true;
    }

    if(dirty) {
        loadSchemePack(settings.city, settings.scheme_locale);
        load_locale(settings.locale);
        save_settings();
        Window *top = window_stack_get_top_window();
        Layer *root = window_get_root_layer(top);
        layer_mark_dirty(root);
        open_update_window();
    }
}
Example #13
0
void Timed::send_time_settings()
{
  log_debug() ;
  log_debug("settings=%p", settings) ;
  log_debug("settings->cellular_zone=%p", settings->cellular_zone) ;
  log_debug("settings->cellular_zone='%s'", settings->cellular_zone->zone().c_str()) ;
  nanotime_t diff = systime_back ;
  clear_invokation_flag() ;
  save_settings() ;
  settings->fix_etc_localtime() ;
  sent_signature = dst_signature(time(NULL)) ;
  Maemo::Timed::WallClock::Info info(settings->get_wall_clock_info(diff)) ;
  log_notice("sending signal 'settings_changed': %s", info.str().toStdString().c_str()) ;
  emit settings_changed(info, not diff.is_zero()) ;
  log_notice("signal 'settings_changed' sent") ;
  // emit settings_changed_1(systime) ;
  am->reshuffle_queue(diff) ;
  if(q_pause)
  {
    delete q_pause ;
    q_pause = NULL ;
  }
  check_dst() ; // reschedule dst timer
}
Example #14
0
TbScreenMode reenter_video_mode(void)
{
 TbScreenMode scrmode;
 scrmode=validate_vidmode(settings.video_scrnmode);
 if ( setup_screen_mode(scrmode) )
  {
      settings.video_scrnmode = scrmode;
  } else
  {
      SYNCLOG("Can't enter %s (mode %d), falling to failsafe mode",
          get_vidmode_name(scrmode),(int)scrmode);
      scrmode=get_failsafe_vidmode();
      if ( !setup_screen_mode(scrmode) )
      {
        _DK_FatalError = 1;
        exit_keeper = 1;
        return Lb_SCREEN_MODE_INVALID;
      }
      settings.video_scrnmode = scrmode;
      save_settings();
  }
  SYNCLOG("Switched video to %s (mode %d)", get_vidmode_name(scrmode),(int)scrmode);
  return scrmode;
}
void frontend_set_mouse_sensitivity(struct GuiButton *gbtn)
{
    settings.first_person_move_sensitivity = fe_mouse_sensitivity;
    save_settings();
}
Example #16
0
File: ace.cpp Project: KrossX/ACE
INT_PTR CALLBACK dialog_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
	switch (msg)
	{
	case WM_INITDIALOG:
	{
		HICON h_icon;

		h_icon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ACEICON), IMAGE_ICON, 32, 32, 0);
		SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)h_icon);

		h_icon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ACEICON), IMAGE_ICON, 16, 16, 0);
		SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)h_icon);


		SendMessage(GetDlgItem(hwnd, IDC_COMBO_AAMODE), CB_ADDSTRING, 0, (LPARAM)L"Multisampling");
		SendMessage(GetDlgItem(hwnd, IDC_COMBO_AAMODE), CB_ADDSTRING, 0, (LPARAM)L"Adaptive multisampling");
		SendMessage(GetDlgItem(hwnd, IDC_COMBO_AAMODE), CB_ADDSTRING, 0, (LPARAM)L"Supersampling");

		SendMessage(GetDlgItem(hwnd, IDC_COMBO_AAFILTER), CB_ADDSTRING, 0, (LPARAM)L"Box");
		SendMessage(GetDlgItem(hwnd, IDC_COMBO_AAFILTER), CB_ADDSTRING, 0, (LPARAM)L"Narrow-tent");
		SendMessage(GetDlgItem(hwnd, IDC_COMBO_AAFILTER), CB_ADDSTRING, 0, (LPARAM)L"Wide-tent");
		SendMessage(GetDlgItem(hwnd, IDC_COMBO_AAFILTER), CB_ADDSTRING, 0, (LPARAM)L"Edge detect");

		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_PRESETS), TBM_SETRANGE, TRUE, MAKELONG(0, 5));
		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_PRESETS), TBM_SETTICFREQ, 1, 0);

		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_ANTIALIAS), TBM_SETRANGE, TRUE, MAKELONG(0, 3));
		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_ANTIALIAS), TBM_SETTICFREQ, 1, 0);

		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_ANISO), TBM_SETRANGE, TRUE, MAKELONG(0, 4));
		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_ANISO), TBM_SETTICFREQ, 1, 0);

		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_MIPMAP), TBM_SETRANGE, TRUE, MAKELONG(0, 3));
		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_MIPMAP), TBM_SETTICFREQ, 1, 0);

		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_TEXTURE), TBM_SETRANGE, TRUE, MAKELONG(0, 2));
		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_TEXTURE), TBM_SETTICFREQ, 1, 0);

		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_VSYNC), TBM_SETRANGE, TRUE, MAKELONG(0, 3));
		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_VSYNC), TBM_SETTICFREQ, 1, 0);

		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_TESS), TBM_SETRANGE, TRUE, MAKELONG(0, 9));
		SendMessage(GetDlgItem(hwnd, IDC_SLIDER_TESS), TBM_SETTICFREQ, 1, 0);

		set_starting_values(hwnd);
	}
	break;

	case WM_HSCROLL:
	{
		if ((HWND)lparam == GetDlgItem(hwnd, IDC_SLIDER_PRESETS))
		{
			LRESULT value = SendMessage(GetDlgItem(hwnd, IDC_SLIDER_PRESETS), TBM_GETPOS, 0, 0);
			set_preset(hwnd, value);
			SetDlgItemText(hwnd, IDC_LABEL_PRESET, text_presets[value]);
		}
		else  if ((HWND)lparam == GetDlgItem(hwnd, IDC_SLIDER_ANTIALIAS))
		{
			LRESULT value = SendMessage(GetDlgItem(hwnd, IDC_SLIDER_ANTIALIAS), TBM_GETPOS, 0, 0);

			if (value == 0)
			{
				values.anti_alias = 1;
				values.anti_alias_samples = 0;
			}
			else
			{
				values.anti_alias = 2;
				values.anti_alias_samples = (int)pow(2, value);
			}

			SetDlgItemText(hwnd, IDC_LABEL_ANTIALIAS, text_antialias[value]);
		}
		else  if ((HWND)lparam == GetDlgItem(hwnd, IDC_SLIDER_ANISO))
		{
			LRESULT value = SendMessage(GetDlgItem(hwnd, IDC_SLIDER_ANISO), TBM_GETPOS, 0, 0);

			if (value == 0)
				values.aniso_degree = 0;
			else
				values.aniso_degree = (int)pow(2, value);

			SetDlgItemText(hwnd, IDC_LABEL_ANISO, text_aniso[value]);
		}
		else  if ((HWND)lparam == GetDlgItem(hwnd, IDC_SLIDER_MIPMAP))
		{
			LRESULT value = SendMessage(GetDlgItem(hwnd, IDC_SLIDER_MIPMAP), TBM_GETPOS, 0, 0);
			values.texture_lod = 3 - value;
			SetDlgItemText(hwnd, IDC_LABEL_MIPMAP, text_mipmap[value]);
		}
		else  if ((HWND)lparam == GetDlgItem(hwnd, IDC_SLIDER_TEXTURE))
		{
			LRESULT value = SendMessage(GetDlgItem(hwnd, IDC_SLIDER_TEXTURE), TBM_GETPOS, 0, 0);
			values.tfq = 2 - value;
			SetDlgItemText(hwnd, IDC_LABEL_TEXTURE, text_texture[value]);
		}
		else  if ((HWND)lparam == GetDlgItem(hwnd, IDC_SLIDER_VSYNC))
		{
			LRESULT value = SendMessage(GetDlgItem(hwnd, IDC_SLIDER_VSYNC), TBM_GETPOS, 0, 0);
			values.vsync_control = value;
			SetDlgItemText(hwnd, IDC_LABEL_VSYNC, text_vsync[value]);
		}
		else  if ((HWND)lparam == GetDlgItem(hwnd, IDC_SLIDER_TESS))
		{
			LRESULT value = SendMessage(GetDlgItem(hwnd, IDC_SLIDER_TESS), TBM_GETPOS, 0, 0);

			if (value < 2)
			{
				values.tessellation_option = value;
				values.tessellation = 1;
			}
			else
			{
				values.tessellation_option = 2;

				switch (value)
				{
				case 2: values.tessellation = 1; break;
				case 3: values.tessellation = 2; break;
				case 4: values.tessellation = 4; break;
				case 5: values.tessellation = 6; break;
				case 6: values.tessellation = 8; break;
				case 7: values.tessellation = 16; break;
				case 8: values.tessellation = 32; break;
				case 9: values.tessellation = 64; break;
				}
			}

			SetDlgItemText(hwnd, IDC_LABEL_TESS, text_tess[value]);
		}
	}
	break;

	case WM_COMMAND:
	{
		switch (LOWORD(wparam))
		{
		case IDC_COMBO_AAMODE: //if (HIWORD(wparam) == CBN_SELCHANGE)
			break;

		case IDC_COMBO_AAFILTER: if (HIWORD(wparam) == CBN_SELCHANGE)
			values.aaf = SendMessage(GetDlgItem(hwnd, IDC_COMBO_AAFILTER), CB_GETCURSEL, 0, 0);
			break;

		case IDC_CHECK_MLAA:
			values.mlf = IsDlgButtonChecked(hwnd, IDC_CHECK_MLAA);
			break;

		case IDC_CHECK_SURFACE:
			values.surface_format_replacements = IsDlgButtonChecked(hwnd, IDC_CHECK_SURFACE);
			break;

		case IDC_CHECK_TRIPLEBUFFER:
			values.triple_buffering = IsDlgButtonChecked(hwnd, IDC_CHECK_TRIPLEBUFFER);
			break;

		case IDOK:
			save_settings();
			EndDialog(hwnd, ERROR_SUCCESS);
			return TRUE;

		case IDCANCEL:
			EndDialog(hwnd, ERROR_SUCCESS);
			return TRUE;

		case IDAPPLY:
			save_settings();
			return TRUE;
		}
	}
	break;
	}

	return FALSE;
}
Example #17
0
static void form_event(int index, int external)
{
    char spare[255];
    bool is_button = false;
    bool checked = OBJ_SELECTED(index);
    char * tmp;
    MENU pop_menu, me_data;

    /* For font driver popup: */
    int num_font_drivers = 2;

    /*
    	Just a small collection of locales, each country has at least one
    	ATARI-clone user! :)
    */
    int num_locales = 15;
    short x, y;
    int choice, i;

    switch(index) {

    case SETTINGS_SAVE:
		OBJ_UNCHECK(index);
        OBJ_REDRAW(index);
        save_settings();
        break;

    case SETTINGS_ABORT:
		OBJ_UNCHECK(index);
        OBJ_REDRAW(index);
        close_settings();
        break;

    case SETTINGS_CB_USE_PROXY:
        if( checked ) {
            ENABLE_OBJ(SETTINGS_EDIT_PROXY_HOST);
            ENABLE_OBJ(SETTINGS_EDIT_PROXY_PORT);
            ENABLE_OBJ(SETTINGS_CB_PROXY_AUTH);
        } else {
            DISABLE_OBJ(SETTINGS_EDIT_PROXY_HOST);
            DISABLE_OBJ(SETTINGS_EDIT_PROXY_PORT);
            DISABLE_OBJ(SETTINGS_CB_PROXY_AUTH);
        }
        FORMEVENT(SETTINGS_CB_PROXY_AUTH);
        OBJ_REDRAW(SETTINGS_CB_USE_PROXY);
        break;

    case SETTINGS_CB_PROXY_AUTH:
        if( checked && OBJ_SELECTED( SETTINGS_CB_USE_PROXY ) ) {
            ENABLE_OBJ(SETTINGS_EDIT_PROXY_USERNAME);
            ENABLE_OBJ(SETTINGS_EDIT_PROXY_PASSWORD);
        } else {
            DISABLE_OBJ(SETTINGS_EDIT_PROXY_USERNAME);
            DISABLE_OBJ(SETTINGS_EDIT_PROXY_PASSWORD);
        }
        break;

    case SETTINGS_CB_ENABLE_ANIMATION:
        if( checked ) {
            ENABLE_OBJ( SETTINGS_EDIT_MIN_GIF_DELAY );
        } else {
            DISABLE_OBJ( SETTINGS_EDIT_MIN_GIF_DELAY );
        }
        break;

    case SETTINGS_BT_SEL_FONT_RENDERER:
        if( external ) {
            objc_offset(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER, &x, &y);
            // point mn_tree tree to states popup:
            pop_menu.mn_tree = gemtk_obj_get_tree(POP_FONT_RENDERER);
            pop_menu.mn_menu = 0;
            pop_menu.mn_item = POP_FONT_RENDERER_INTERNAL;
            pop_menu.mn_scroll = SCROLL_NO;
            pop_menu.mn_keystate = 0;

			// find the selected menu item and uncheck others:
            for(i=pop_menu.mn_item; i<=num_font_drivers; i++) {
                get_string(pop_menu.mn_tree, i, spare);
                tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
                if (strcasecmp(&spare[2], tmp)) {
                    menu_icheck(pop_menu.mn_tree, i, 0);
                } else {
                    menu_icheck(pop_menu.mn_tree, i, 1);
                }
                set_string(pop_menu.mn_tree, i, spare);
            }

            menu_popup(&pop_menu, x, y, &me_data);
            choice = me_data.mn_item;
            if( choice > 0 && choice <= num_font_drivers ) {
                get_string(pop_menu.mn_tree, choice, spare);
                for(i=2; i<(int)strlen(spare); i++) {
                    spare[i]= (char)tolower(spare[i]);
                }
                set_text(SETTINGS_BT_SEL_FONT_RENDERER,
                         (char*)&spare[2],
                         LABEL_FONT_RENDERER_MAX_LEN);
                OBJ_REDRAW(SETTINGS_BT_SEL_FONT_RENDERER);
            }
        }
        tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
        if (strcasecmp(tmp, "freetype") == 0) {
            ENABLE_OBJ(SETTINGS_CB_ANTI_ALIASING);
        } else {
            DISABLE_OBJ(SETTINGS_CB_ANTI_ALIASING);
        }
        break;

    case SETTINGS_BT_SEL_LOCALE:
        objc_offset(dlgtree, SETTINGS_BT_SEL_LOCALE, &x, &y);

        // point mn_tree tree to states popup:
        pop_menu.mn_tree = gemtk_obj_get_tree(POP_LANGUAGE);
        pop_menu.mn_menu = 0;
        pop_menu.mn_item = POP_LANGUAGE_CS;
        pop_menu.mn_scroll = SCROLL_NO;
        pop_menu.mn_keystate = 0;

		// find the selected menu item and uncheck others:
        for(i=pop_menu.mn_item; i<=num_locales; i++) {
            get_string(pop_menu.mn_tree, i, spare);
            tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_LOCALE);
            if (strcasecmp(&spare[2], tmp)) {
                menu_icheck(pop_menu.mn_tree, i, 0);
            } else {
                menu_icheck(pop_menu.mn_tree, i, 1);
            }
            set_string(pop_menu.mn_tree, i, spare);
        }


        menu_popup(&pop_menu, x, y, &me_data);
        choice = me_data.mn_item;
        if( choice > 0 && choice <= num_locales ) {
            get_string(pop_menu.mn_tree, choice, spare);
            for(i=2; i<(int)strlen(spare); i++) {
                spare[i]= (char)tolower(spare[i]);
            }
            set_text(SETTINGS_BT_SEL_LOCALE, (char*)&spare[2], 5);
        }

        OBJ_REDRAW(SETTINGS_BT_SEL_LOCALE);
        break;

        /*
        		case SETTINGS_INPUT_TOOLBAR_BGCOLOR:
        			objc_offset( FORM(win), SETTINGS_INPUT_TOOLBAR_BGCOLOR, &x, &y );
        			choice = color_popup(x, y, tmp_option_atari_toolbar_bg);
        			snprintf( spare, 255, "%06x", choice );
        			tmp_option_atari_toolbar_bg = choice;
        			ObjcStrCpy( dlgtree, SETTINGS_INPUT_TOOLBAR_BGCOLOR,
        							spare );
        			is_button = true;
        			OBJ_REDRAW(SETTINGS_INPUT_TOOLBAR_BGCOLOR);
        			break;
        */
        /*
        		case SETTINGS_BT_TOOLBAR_ICONSET:
        			objc_offset( FORM(win), SETTINGS_BT_TOOLBAR_ICONSET, &x, &y );
        			tmp = toolbar_iconset_popup(x,y);
        			if( tmp != NULL ){
        				ObjcStrCpy( dlgtree, SETTINGS_BT_TOOLBAR_ICONSET, tmp );
        			}
        			is_button = true;
        			break;
        */
    case SETTINGS_INC_MEM_CACHE:
    case SETTINGS_DEC_MEM_CACHE:
        if( index == SETTINGS_DEC_MEM_CACHE )
            tmp_option_memory_cache_size -= 0.1;
        else
            tmp_option_memory_cache_size += 0.1;

        if( tmp_option_memory_cache_size < 0.5 )
            tmp_option_memory_cache_size = 0.5;
        if( tmp_option_memory_cache_size > 999.9 )
            tmp_option_memory_cache_size = 999.9;
        snprintf( spare, 255, "%03.1f", tmp_option_memory_cache_size );
        set_text( SETTINGS_STR_MAX_MEM_CACHE, spare, 5 );
        is_button = true;
        OBJ_REDRAW(SETTINGS_STR_MAX_MEM_CACHE);
        break;

    case SETTINGS_INC_CACHED_CONNECTIONS:
    case SETTINGS_DEC_CACHED_CONNECTIONS:
        if( index == SETTINGS_INC_CACHED_CONNECTIONS )
            tmp_option_max_cached_fetch_handles += 1;
        else
            tmp_option_max_cached_fetch_handles -= 1;
        if( tmp_option_max_cached_fetch_handles > 31 )
            tmp_option_max_cached_fetch_handles = 31;

        snprintf( spare, 255, "%02d", tmp_option_max_cached_fetch_handles );
        set_text( SETTINGS_EDIT_MAX_CACHED_CONNECTIONS, spare, 2 );
        is_button = true;
        OBJ_REDRAW(SETTINGS_EDIT_MAX_CACHED_CONNECTIONS);
        break;

    case SETTINGS_INC_MAX_FETCHERS:
    case SETTINGS_DEC_MAX_FETCHERS:
        if( index == SETTINGS_INC_MAX_FETCHERS )
            tmp_option_max_fetchers += 1;
        else
            tmp_option_max_fetchers -= 1;
        if( tmp_option_max_fetchers > 31 )
            tmp_option_max_fetchers = 31;

        snprintf( spare, 255, "%02d", tmp_option_max_fetchers );
        set_text( SETTINGS_EDIT_MAX_FETCHERS, spare, 2 );
        is_button = true;
        OBJ_REDRAW(SETTINGS_EDIT_MAX_FETCHERS);
        break;

    case SETTINGS_INC_MAX_FETCHERS_PER_HOST:
    case SETTINGS_DEC_MAX_FETCHERS_PER_HOST:
        if( index == SETTINGS_INC_MAX_FETCHERS_PER_HOST )
            tmp_option_max_fetchers_per_host += 1;
        else
            tmp_option_max_fetchers_per_host -= 1;
        if( tmp_option_max_fetchers_per_host > 31 )
            tmp_option_max_fetchers_per_host = 31;

        snprintf( spare, 255, "%02d", tmp_option_max_fetchers_per_host );
        set_text( SETTINGS_EDIT_MAX_FETCHERS_PER_HOST, spare, 2 );
        is_button = true;
        OBJ_REDRAW(SETTINGS_EDIT_MAX_FETCHERS_PER_HOST);
        break;

    case SETTINGS_INC_HISTORY_AGE:
    case SETTINGS_DEC_HISTORY_AGE:
        if( index == SETTINGS_INC_HISTORY_AGE )
            tmp_option_expire_url += 1;
        else
            tmp_option_expire_url -= 1;

        if( tmp_option_expire_url > 99 )
            tmp_option_expire_url =  0;

        snprintf( spare, 255, "%02d", tmp_option_expire_url );
        set_text( SETTINGS_EDIT_HISTORY_AGE, spare, 2 );
        is_button = true;
        OBJ_REDRAW(SETTINGS_EDIT_HISTORY_AGE);
        break;

    case SETTINGS_INC_GIF_DELAY:
    case SETTINGS_DEC_GIF_DELAY:
        if( index == SETTINGS_INC_GIF_DELAY )
            tmp_option_minimum_gif_delay += 0.1;
        else
            tmp_option_minimum_gif_delay -= 0.1;

        if( tmp_option_minimum_gif_delay < 0.1 )
            tmp_option_minimum_gif_delay = 0.1;
        if( tmp_option_minimum_gif_delay > 9.0 )
            tmp_option_minimum_gif_delay = 9.0;
        snprintf( spare, 255, "%01.1f", tmp_option_minimum_gif_delay );
        set_text( SETTINGS_EDIT_MIN_GIF_DELAY, spare, 3 );
        is_button = true;
        OBJ_REDRAW(SETTINGS_EDIT_MIN_GIF_DELAY);
        break;

    case SETTINGS_INC_MIN_FONT_SIZE:
    case SETTINGS_DEC_MIN_FONT_SIZE:
        if( index == SETTINGS_INC_MIN_FONT_SIZE )
            tmp_option_font_min_size += 1;
        else
            tmp_option_font_min_size -= 1;

        if( tmp_option_font_min_size > 500 )
            tmp_option_font_min_size = 500;
        if( tmp_option_font_min_size < 10 )
            tmp_option_font_min_size = 10;

        snprintf( spare, 255, "%03d", tmp_option_font_min_size );
        set_text( SETTINGS_EDIT_MIN_FONT_SIZE, spare, 3 );
        is_button = true;
        OBJ_REDRAW(SETTINGS_EDIT_MIN_FONT_SIZE);
        break;

    case SETTINGS_INC_DEF_FONT_SIZE:
    case SETTINGS_DEC_DEF_FONT_SIZE:
        if( index == SETTINGS_INC_DEF_FONT_SIZE )
            tmp_option_font_size += 1;
        else
            tmp_option_font_size -= 1;

        if( tmp_option_font_size > 999 )
            tmp_option_font_size = 999;
        if( tmp_option_font_size < 50 )
            tmp_option_font_size = 50;

        snprintf( spare, 255, "%03d", tmp_option_font_size );
        set_text( SETTINGS_EDIT_DEF_FONT_SIZE, spare, 3 );
        is_button = true;
        OBJ_REDRAW(SETTINGS_EDIT_DEF_FONT_SIZE);
        break;

    case SETTINGS_INC_INCREMENTAL_REFLOW:
    case SETTINGS_DEC_INCREMENTAL_REFLOW:
        if( index == SETTINGS_INC_INCREMENTAL_REFLOW )
            tmp_option_min_reflow_period += 1;
        else
            tmp_option_min_reflow_period -= 1;

        if( tmp_option_min_reflow_period > 9999 )
            tmp_option_min_reflow_period = 10;

        snprintf( spare, 255, "%04d", tmp_option_min_reflow_period );
        set_text( SETTINGS_EDIT_MIN_REFLOW_PERIOD, spare, 4 );
        is_button = true;
        OBJ_REDRAW(SETTINGS_EDIT_MIN_REFLOW_PERIOD);
        break;

    default:
        break;
    }

    if( is_button ) {
        // remove selection indicator from button element:
        OBJ_UNCHECK(index);
        OBJ_REDRAW(index);
    }
}
Example #18
0
void
on_apply_button_clicked                (GtkButton       *button,
                                        gpointer         user_data)
{
	save_settings (&current_keyboard_config, &keyboard_list, &xmodmap_list, &plugin_list, &preferences);
}
Example #19
0
void start_match() {
  window_stack_pop(false);
  match_window_push(&settings, list_new());
  save_settings(&settings);
}
Example #20
0
int main(int argc, char **argv)
{
	char *socketname = get_config_name("control");

	/* check if japlay is already running */
	if (socketname && file_exists(socketname)) {
		int fd = unix_socket_connect(socketname);
		if (fd >= 0) {
			int i;
			for (i = 1; i < argc; ++i) {
				char *path = absolute_path(argv[i]);
				if (path) {
					sendto(fd, path, strlen(path), 0, NULL, 0);
					free(path);
				}
			}
			close(fd);
			return 0;
		}
		/* remove leftover socket */
		unlink(socketname);
	}

	g_thread_init(NULL);
	gdk_threads_init();
	gdk_threads_enter();
	gtk_init(&argc, &argv);

	main_thread = g_thread_self();

	if (japlay_init(&argc, argv)) {
		error("Can not initialize japlay\n");
		return -1;
	}

	main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(main_window), APP_NAME);
	g_signal_connect(G_OBJECT(main_window), "destroy", G_CALLBACK(destroy_cb), NULL);
	g_signal_connect(G_OBJECT(main_window), "key-press-event", G_CALLBACK(key_pressed_cb), NULL);

	GtkWidget *menubar = gtk_menu_bar_new();

	GtkWidget *file_menu = gtk_menu_new();

	GtkWidget *item = gtk_menu_item_new_with_label("New playlist");
	g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(new_playlist_cb), NULL);
	gtk_menu_append(GTK_MENU(file_menu), item);

	item = gtk_menu_item_new_with_label("Add directory to the playlist...");
	g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(add_dir_cb), NULL);
	gtk_menu_append(GTK_MENU(file_menu), item);

	item = gtk_menu_item_new_with_label("Clear playlist");
	g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(clear_playlist_cb), NULL);
	gtk_menu_append(GTK_MENU(file_menu), item);

	item = gtk_separator_menu_item_new();
	gtk_menu_append(GTK_MENU(file_menu), item);

	item = gtk_check_menu_item_new_with_label("Enable shuffle");
	g_signal_connect(G_OBJECT(item), "toggled", G_CALLBACK(enable_shuffle_cb), NULL);
	gtk_menu_append(GTK_MENU(file_menu), item);

	item = gtk_check_menu_item_new_with_label("Enable automatic volume");
	g_signal_connect(G_OBJECT(item), "toggled", G_CALLBACK(enable_autovol_cb), NULL);
	gtk_menu_append(GTK_MENU(file_menu), item);

	/*item = gtk_menu_item_new_with_label("Scan playlist");
	g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(scan_playlist_cb), NULL);
	gtk_menu_append(GTK_MENU(file_menu), item);*/

	item = gtk_separator_menu_item_new();
	gtk_menu_append(GTK_MENU(file_menu), item);

	item = gtk_menu_item_new_with_label("Quit");
	g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(destroy_cb), NULL);
	gtk_menu_append(GTK_MENU(file_menu), item);

	item = gtk_menu_item_new_with_label("File");
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), file_menu);
	gtk_menu_bar_append(GTK_MENU_BAR(menubar), item);

	static const struct button {
		const char *stockid;
		const char *help;
		void (*const cb)(GtkButton *button, gpointer ptr);
	} buttons[] = {
		{GTK_STOCK_MEDIA_PLAY, "Play", play_cb},
		{GTK_STOCK_MEDIA_STOP, "stop", stop_cb},
		{GTK_STOCK_MEDIA_PAUSE, "Pause", pause_cb},
		{GTK_STOCK_MEDIA_NEXT, "Skip to the next song in the queue", next_cb},
		{GTK_STOCK_OPEN, "Add files to the playlist", add_cb},
		{GTK_STOCK_OK, "Add selected songs to the queue", enqueue_cb},
		{GTK_STOCK_DELETE, "Remove selected songs", remove_cb},
		{NULL, NULL, NULL}
	};

	GtkWidget *toolbar = gtk_hbox_new(false, 0);
	int i;
	for (i = 0; buttons[i].stockid; ++i) {
		GtkWidget *button = gtk_button_new();
		GtkWidget *image = gtk_image_new_from_stock(buttons[i].stockid, GTK_ICON_SIZE_SMALL_TOOLBAR);
		gtk_button_set_image(GTK_BUTTON(button), image);
		g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(buttons[i].cb), NULL);
		gtk_box_pack_start(GTK_BOX(toolbar), button, false, true, 0);
		gtk_widget_set_tooltip_text(button, buttons[i].help);
	}

	scope_area = gtk_drawing_area_new();
	gtk_widget_set_size_request(scope_area, SCOPE_WIDTH, -1);
	gtk_box_pack_start(GTK_BOX(toolbar), scope_area, false, true, 0);
	g_signal_connect(G_OBJECT(scope_area), "expose_event", G_CALLBACK(expose_event_cb), NULL);

	seekbar = gtk_hscale_new_with_range(0, 1, 1);
	gtk_range_set_update_policy(GTK_RANGE(seekbar), GTK_UPDATE_DELAYED);
	g_signal_connect(G_OBJECT(seekbar), "change-value", G_CALLBACK(seek_cb), NULL);
	g_signal_connect(G_OBJECT(seekbar), "format-value", G_CALLBACK(format_seek_cb), NULL);

	notebook = gtk_notebook_new();

	GtkWidget *vbox = gtk_vbox_new(false, 0);
	gtk_box_pack_start(GTK_BOX(vbox), menubar, false, true, 0);
	gtk_box_pack_start(GTK_BOX(vbox), toolbar, false, true, 0);
	gtk_box_pack_start(GTK_BOX(vbox), seekbar, false, true, 0);
	gtk_box_pack_start(GTK_BOX(vbox), notebook, true, true, 0);

	gtk_container_add(GTK_CONTAINER(main_window), vbox);
	gtk_widget_show_all(main_window);

	/* TODO: load all playlists */
	main_playlist = new_playlist();

	add_playlist_page(main_playlist, "Main");
	add_playlist_page(japlay_queue, "Play queue");
	add_playlist_page(japlay_history, "History");

	char *playlistpath = get_config_name("main_playlist.m3u");
	if (playlistpath)
		load_playlist(main_playlist, playlistpath);
	char *queuepath = get_config_name("queue.m3u");
	if (queuepath)
		load_playlist(japlay_queue, queuepath);

	char *settingspath = get_config_name("settings.cfg");
	if (settingspath)
		load_settings(settingspath);

	for (i = 1; i < argc; ++i)
		add_file_playlist(main_playlist, argv[i]);

	signal(SIGINT, handle_sigint);

	int fd = -1;
	if (socketname) {
		fd = unix_socket_create(socketname);
		if (fd >= 0) {
			GIOChannel *io = g_io_channel_unix_new(fd);
			g_io_add_watch(io, G_IO_IN, incoming_client, NULL);
		}
	}

	gtk_main();

	if (fd >= 0)
		unlink(socketname);

	if (playlistpath)
		save_playlist_m3u(main_playlist, playlistpath);
	if (queuepath)
		save_playlist_m3u(japlay_queue, queuepath);
	if (settingspath)
		save_settings(settingspath);

	japlay_exit();

	return 0;
}
Example #21
0
dvbcut_settings::~dvbcut_settings() {
  if (loaded) {
    save_settings();
  }
  endGroup();
}
Example #22
0
BOOL save_configfile(LPCTSTR pszFileName)
{
   
    HANDLE hFile;
	int t;
	int act_type;

	write_logfile("saving design configuration: %s",(char *)pszFileName);
 
    hFile = CreateFile(pszFileName, GENERIC_WRITE, 0, NULL,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
    if(hFile != INVALID_HANDLE_VALUE)
    {

		if (!IsWindow(ghWndToolbox)) 
			GLOBAL.showtoolbox=-1;

		strcpy(GLOBAL.configfile,pszFileName);
		save_settings();
		save_property(hFile,"objects",P_INT,&GLOBAL.objects);
		save_property(hFile,"main-top",P_INT,&GLOBAL.top);
		save_property(hFile,"main-left",P_INT,&GLOBAL.left);
		save_property(hFile,"main-right",P_INT,&GLOBAL.right);
		save_property(hFile,"main-bottom",P_INT,&GLOBAL.bottom);
		save_property(hFile,"anim-top",P_INT,&GLOBAL.anim_top);
		save_property(hFile,"anim-left",P_INT,&GLOBAL.anim_left);
		save_property(hFile,"anim-right",P_INT,&GLOBAL.anim_right);
		save_property(hFile,"anim-bottom",P_INT,&GLOBAL.anim_bottom);
		save_property(hFile,"design-top",P_INT,&GLOBAL.design_top);
		save_property(hFile,"design-left",P_INT,&GLOBAL.design_left);
		save_property(hFile,"design-right",P_INT,&GLOBAL.design_right);
		save_property(hFile,"design-bottom",P_INT,&GLOBAL.design_bottom);
		save_property(hFile,"tool-top",P_INT,&GLOBAL.tool_top);
		save_property(hFile,"tool-left",P_INT,&GLOBAL.tool_left);
		save_property(hFile,"tool-right",P_INT,&GLOBAL.tool_right);
		save_property(hFile,"tool-bottom",P_INT,&GLOBAL.tool_bottom);
		save_property(hFile,"showdesign",P_INT,&GLOBAL.showdesign);
		save_property(hFile,"showtoolbox",P_INT,&GLOBAL.showtoolbox);
		save_property(hFile,"autorun",P_INT,&GLOBAL.autorun);
		save_property(hFile,"minimized",P_INT,&GLOBAL.minimized);


		save_property(hFile,"comport",P_INT,&TTY.PORT);
		save_property(hFile,"bidirect",P_INT,&TTY.BIDIRECT);
		save_property(hFile,"connected",P_INT,&TTY.CONNECTED);
		save_property(hFile,"devicetype",P_INT,&TTY.devicetype);
		save_property(hFile,"samplingtype",P_INT,&TTY.samplingrate);
		save_property(hFile,"baudtype",P_INT,&TTY.BAUDRATE);
		save_property(hFile,"flow_control",P_INT,&TTY.FLOW_CONTROL);

		save_property(hFile,"captfilename",P_STRING,CAPTFILE.filename);
		save_property(hFile,"captfiletype",P_INT,&CAPTFILE.filetype);
		save_property(hFile,"captfileoffset",P_INT,&CAPTFILE.offset);
		save_property(hFile,"dialoginterval",P_INT,&GLOBAL.dialog_interval);
		save_property(hFile,"drawinterval",P_INT,&GLOBAL.draw_interval);
		save_property(hFile,"samplingrate",P_INT,&PACKETSPERSECOND);
	
		save_property(hFile,"end Object",P_END,NULL);

		for (t=0;t<GLOBAL.objects;t++)
		{  act_type=objects[t]->type;
		   save_property(hFile,"next Object",P_INT,&act_type);
		   objects[t]->save(hFile);
		   store_links(hFile,objects[t]);
		   save_property(hFile,"end Object",P_END,NULL);
		}

		CloseHandle(hFile);
		return TRUE;
    }
	return FALSE;    
	
}
Example #23
0
int main(int argc, char *argv[])
{
    char *driver = NULL;
    char *fourcc = NULL;
    char *filename = NULL;
    unsigned char mode = 0;
    DWORD dwFCC = 0;
    ICOPEN icopen;
    HRESULT coinit = S_FALSE;
    /* ICINFO icinfo; */

    wchar_t drvfile[MAX_PATH];
    HDRVR hDriver = NULL;
    int ret = 0;
    int c = -1, long_options_index = -1;

    if (argc < 2)
    {
        help(argv[0]);
        ret = -1;
        goto cleanup;
    }

    while ((c = getopt_long(argc, argv, "hd:f:s:c:v", long_options, &long_options_index)) != -1)
    {
        switch (c)
        {
            case 'h':
                help(argv[0]);
                ret = 0;
                goto cleanup;
            case 'd':
                driver = strdup(optarg);
                break;
            case 'f':
                fourcc = strdup(optarg);
                if (strlen(optarg) != 4) BAIL("Fourcc must be exactly 4 chars");
                break;
            case 's':
                if (mode != MODE_NONE) BAIL("Incompatible arguments");
                filename = strdup(optarg);
                mode = MODE_SAVE;
                break;
            case 'c':
                if (mode != MODE_NONE) BAIL("Incompatible arguments");
                filename = strdup(optarg);
                mode = MODE_CHECK;
                break;
            case 'v':
                if (mode != MODE_NONE) BAIL("Incompatible arguments");
                mode = MODE_VIEW;
                break;
            default:
                printf("Wrong arguments!\n");
                help(argv[0]);
                goto cleanup;
        }
    }

    if (!(argc == optind) && (mode != MODE_NONE) &&
        driver && (filename || (mode == MODE_VIEW)))
    {
        help(argv[0]);
        goto cleanup;
    }

    if (!MultiByteToWideChar(CP_ACP, 0, driver, -1, drvfile, MAX_PATH))
        BAIL("MultiByteToWideChar() failed\n");

    if (fourcc) memcpy(&dwFCC, fourcc, 4);
    memset(&icopen, 0, sizeof(icopen));

    icopen.dwSize = sizeof(icopen);
    icopen.fccType = ICTYPE_VIDEO; /* VIDC */
    icopen.fccHandler = dwFCC;
    icopen.dwVersion  = 0x00001000; /* FIXME */
    icopen.dwFlags = ICMODE_COMPRESS;
    icopen.dwError = 0;
    icopen.pV1Reserved = NULL;
    icopen.pV2Reserved = NULL;
    icopen.dnDevNode = -1; /* FIXME */

    coinit = CoInitialize(NULL);

    if (!(hDriver = OpenDriver(drvfile, NULL, (LPARAM) &icopen)))
        BAIL("OpenDriver() failed\n");

   /*
        memset(&icinfo, 0, sizeof(ICINFO));
        icinfo.dwSize = sizeof(ICINFO);
        SendDriverMessage(hDriver, ICM_GETINFO, (LPARAM) &icinfo, sizeof(ICINFO));
    */

    if (SendDriverMessage(hDriver, ICM_CONFIGURE, -1, 0) != ICERR_OK)
        BAIL("The driver doesn't provide a configure dialog");


    switch(mode)
    {
        case MODE_CHECK:
            if (load_settings(hDriver, filename))
                BAIL("Cannot load settings from file");
            if (SendDriverMessage(hDriver, ICM_CONFIGURE, 0, 0) != ICERR_OK)
                BAIL("ICM_CONFIGURE failed");
            break;
        case MODE_SAVE:
            if (SendDriverMessage(hDriver, ICM_CONFIGURE, 0, 0) != ICERR_OK)
                BAIL("ICM_CONFIGURE failed");
            if (save_settings(hDriver, filename))
                BAIL("Cannot save settings to file");
            break;
        case MODE_VIEW:
            {
                HWND hwnd = GetDesktopWindow();
                if (SendDriverMessage(hDriver, ICM_CONFIGURE, (LPARAM) hwnd, 0) != ICERR_OK)
                    BAIL("ICM_CONFIGURE failed");
            }
            break;
        default:
            BAIL("This should not happen :)");
    }

cleanup:
    if (driver) free(driver);
    if (fourcc) free(fourcc);
    if (filename) free(filename);
    if (hDriver) CloseDriver(hDriver, 0, 0);
    if (coinit == S_OK) CoUninitialize();
    return ret;
}
void gui_set_music_volume(struct GuiButton *gbtn)
{
    settings.redbook_volume = music_level;
    save_settings();
    SetMusicPlayerVolume(settings.redbook_volume);
}
Example #25
0
File: tui.c Project: rzr/PUAE
static int do_gui (int mode)
{
    char cwd[1024];

    if (getcwd (cwd, 1024) == NULL)
        return 0;

    tui_setup ();

    for (;;) {
        int c;

        tui_selwin (0);
        print_configuration ();
        c = tui_menubrowse (mode == 0 ? mainmenu2 : mainmenu, MENU_COL_OFFSET, 4, 0, MAX_MENU_HEIGHT);
        if (c == -1) {
            tui_shutdown ();
            return -2;
        }
        if (mode == 1) {
            if (c == 8)
                break;
            switch (c) {
            case 0:
                DiskOptions ();
                break;
            case 1:
                VideoOptions ();
                break;
            case 2:
                MemoryOptions ();
                break;
            case 3:
                CPUOptions ();
                break;
            case 4:
                HDOptions ();
                break;
            case 5:
                SoundOptions ();
                break;
            case 6:
                OtherOptions ();
                break;
            case 7:
                save_settings ();
                break;
            }
        } else {
            if (c == 5)
                break;
            switch (c) {
            case 0:
                DiskOptions ();
                break;
            case 1:
                OtherOptions ();
                break;
            case 2:
                save_settings ();
                break;
            case 3:
                uae_reset (0);
                break;
            case 4:
                uae_quit ();
                break;
            }
        }
    }
    tui_shutdown ();

    chdir (cwd);
    return 0;
}
Example #26
0
void MainForm::save() {
    links->write();

    save_settings();
}
Example #27
0
BOOL load_configfile(LPCTSTR pszFileName)
{

    HANDLE hFile;
	int t, act_samplingrate=DEF_PACKETSPERSECOND; 
	int act_type,num_objects, save_toolbox, save_connected, try_connect;
	const char * d_name;
	char new_name[256],szdata[20];

	write_logfile("loading design configuration: %s",(char *)pszFileName);

    hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    if(hFile != INVALID_HANDLE_VALUE)
    {
		GLOBAL.loading=1;
		d_name=pszFileName;
		while (strstr(d_name,"\\")) d_name=strstr(d_name,"\\")+1;
		strcpy(new_name,"BrainBay - ");strcat(new_name,d_name);
	    SetWindowText(ghWndMain,new_name);
		strcpy(GLOBAL.configfile,pszFileName);
		save_settings();
		save_toolbox=-1;

		save_connected=TTY.CONNECTED;
		SendMessage(ghWndStatusbox,WM_COMMAND, IDC_STOPSESSION,0);
		
		//TTY.read_pause=1;
		close_captfile();

		if (ghWndAnimation!=NULL) SendMessage(ghWndAnimation,WM_CLOSE,0,0);
		ghWndAnimation=NULL;

		close_toolbox();actobject=NULL;
		//InvalidateRect(ghWndMain, NULL, TRUE);

		while (GLOBAL.objects>0)
		    free_object(0);

		GLOBAL.run_exception=0;
		GLOBAL.minimized=FALSE;

	     load_next_config_buffer(hFile);
		 load_property("objects",P_INT,&GLOBAL.objects);
		 load_property("main-top",P_INT,&GLOBAL.top);
		 load_property("main-left",P_INT,&GLOBAL.left);
		 load_property("main-right",P_INT,&GLOBAL.right);
		 load_property("main-bottom",P_INT,&GLOBAL.bottom);
		 load_property("anim-top",P_INT,&GLOBAL.anim_top);
		 load_property("anim-left",P_INT,&GLOBAL.anim_left);
		 load_property("anim-right",P_INT,&GLOBAL.anim_right);
		 load_property("anim-bottom",P_INT,&GLOBAL.anim_bottom);
		 load_property("design-top",P_INT,&GLOBAL.design_top);
		 load_property("design-left",P_INT,&GLOBAL.design_left);
		 load_property("design-right",P_INT,&GLOBAL.design_right);
		 load_property("design-bottom",P_INT,&GLOBAL.design_bottom);
		 load_property("tool-top",P_INT,&GLOBAL.tool_top);
		 load_property("tool-left",P_INT,&GLOBAL.tool_left);
		 load_property("tool-right",P_INT,&GLOBAL.tool_right);
		 load_property("tool-bottom",P_INT,&GLOBAL.tool_bottom);
		 load_property("showdesign",P_INT,&GLOBAL.showdesign);
		 load_property("hidestatus",P_INT,&GLOBAL.hidestatus);
		 load_property("showtoolbox",P_INT,&GLOBAL.showtoolbox);
		 load_property("autorun",P_INT,&GLOBAL.autorun);
		 load_property("minimized",P_INT,&GLOBAL.minimized);
		 save_toolbox=GLOBAL.showtoolbox;


		 TTY.PORT=0;try_connect=0;
		 load_property("comport",P_INT,&TTY.PORT);		 
		 load_property("connected",P_INT,&try_connect);	 
		 load_property("bidirect",P_INT,&TTY.BIDIRECT);
		 load_property("devicetype",P_INT,&TTY.devicetype);
		 load_property("samplingtype",P_INT,&TTY.samplingrate);
		 load_property("baudtype",P_INT,&TTY.BAUDRATE);
		 load_property("flow_control",P_INT,&TTY.FLOW_CONTROL);

		 if (save_connected) { update_p21state(); save_connected=TTY.CONNECTED; }
		 BreakDownCommPort();  
		 if (try_connect) { TTY.CONNECTED=SetupCommPort(TTY.PORT); update_p21state(); }
		
		 load_property("captfilename",P_STRING,CAPTFILE.filename);
		 load_property("captfiletype",P_INT,&CAPTFILE.filetype);
		 load_property("captfileoffset",P_INT,&CAPTFILE.offset);
	 	 load_property("dialoginterval",P_INT,&GLOBAL.dialog_interval);
		 load_property("drawinterval",P_INT,&GLOBAL.draw_interval);
		 load_property("samplingrate",P_INT,&act_samplingrate);
		 PACKETSPERSECOND=act_samplingrate;

		 MoveWindow(ghWndMain,GLOBAL.left,GLOBAL.top,GLOBAL.right-GLOBAL.left,GLOBAL.bottom-GLOBAL.top,TRUE);
		 MoveWindow(ghWndDesign,GLOBAL.design_left,GLOBAL.design_top,GLOBAL.design_right-GLOBAL.design_left,GLOBAL.design_bottom-GLOBAL.design_top,TRUE);
		 if (!GLOBAL.showdesign)
		 {  
			 ShowWindow(ghWndDesign, FALSE); 
			 SetDlgItemText(ghWndStatusbox,IDC_DESIGN,"Show Design"); 
		 }
		 else 
		 {
			 ShowWindow(ghWndDesign,TRUE);
		     SetWindowPos(ghWndDesign,0,0,0,0,0,SWP_DRAWFRAME|SWP_NOMOVE|SWP_NOSIZE);
			 SetDlgItemText(ghWndStatusbox,IDC_DESIGN,"Hide Design"); 
		 }
		 if (!GLOBAL.hidestatus)
		 	 ShowWindow(ghWndStatusbox, TRUE); 
		 else	 ShowWindow(ghWndStatusbox,FALSE);
		     
		 num_objects=GLOBAL.objects;
		 GLOBAL.objects=0;
   		 for (t=0;t<num_objects;t++)
		 {
			act_type=load_next_config_buffer(hFile);
			if (act_type>=0)
			{	
				create_object(act_type);
				if (actobject != NULL )
				{
					actobject->load(hFile);
					link_object(actobject);
				}
				else critical_error("Could not load all objects, quitting ...\ndelete brainbay.cfg to prevent this at program startup ... ");

			}
		 }
		 CloseHandle(hFile);
		 for (t=0;t<num_objects;t++) objects[t]->update_inports();
		 update_dimensions();

		 CAPTFILE.filehandle=INVALID_HANDLE_VALUE;
		 CAPTFILE.do_read=0;
		 if (strcmp(CAPTFILE.filename,"none"))
		 {
			 char st[150];
			 reduce_filepath(st,CAPTFILE.filename);
			 strcpy(CAPTFILE.filename,GLOBAL.resourcepath);
			 strcat(CAPTFILE.filename,"ARCHIVES\\");
			 strcat(CAPTFILE.filename,st);			 
			 open_captfile(CAPTFILE.filename);
		 }

		 init_system_time();
		 reset_oscilloscopes();
		 PACKET.readstate=0;
		 ShowWindow( ghWndMain, TRUE ); UpdateWindow( ghWndMain ); 

 		 update_samplingrate(act_samplingrate);
		 update_devicetype();
		 get_session_length();


		 SetDlgItemInt(ghWndStatusbox,IDC_SAMPLINGRATE,act_samplingrate,0);
		 SetDlgItemText(ghWndStatusbox,IDC_STATUS,"Configuration loaded");
		 SetDlgItemText(ghWndStatusbox,IDC_TIME,"0.0");
		 SetDlgItemText(ghWndStatusbox,IDC_JUMPPOS,"0.0");
		 sprintf(szdata, "%.1f", (float)GLOBAL.session_length/(float)PACKETSPERSECOND);
		 SetDlgItemText(ghWndStatusbox,IDC_SESSLEN,szdata);
 		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETPOS,TRUE,(LONG)0);
		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETSELEND,TRUE,(LONG)0);
		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETSELSTART,TRUE,(LONG)0);

		 SetWindowPos(ghWndMain,0,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
		 InvalidateRect(ghWndMain,NULL,TRUE);
 		 InvalidateRect(ghWndDesign,NULL,TRUE);

		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETSELSTART,TRUE,0);
		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETSELEND,TRUE,1000);
		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETPOS,TRUE,(LONG)(0));
		 if (GLOBAL.minimized) ShowWindow(ghWndMain, SW_MINIMIZE);

		 GLOBAL.loading=0;
		 if ((GLOBAL.autorun) && (!GLOBAL.run_exception)) SendMessage(ghWndStatusbox,WM_COMMAND, IDC_RUNSESSION,0);
  	    
		 if (save_toolbox!=-1)
		 {
			GLOBAL.showtoolbox=save_toolbox;
			actobject=objects[GLOBAL.showtoolbox];
			actobject->make_dialog();
		 } 
		 
		write_logfile("load successful");
		return TRUE;
		 
    }
	write_logfile("could not load design configuration file.");
	return FALSE;    	
}
void frontend_invert_mouse(struct GuiButton *gbtn)
{
    settings.first_person_move_invert = !settings.first_person_move_invert;
    save_settings();
}
/*
 * Parse a single file
 */
static int parse_file(char *filename)
{
    int val;
    int ret = OMPI_SUCCESS;
    bool first_section = true, first_coll = true;
    coll_config_t coll_config;

    memset (&coll_config, 0, sizeof (coll_config));
    reset_collective(&coll_config);

    /* Open the file */
    coll_ml_config_yyin = fopen(filename, "r");
    if (NULL == coll_ml_config_yyin) {
        ML_ERROR(("Failed to open config file %s", filename));
        ret = OMPI_ERR_NOT_FOUND;
        goto cleanup;
    }

    /* Do the parsing */
    coll_ml_config_parse_done = false;
    coll_ml_config_yynewlines = 1;
    coll_ml_config_init_buffer(coll_ml_config_yyin);
    while (!coll_ml_config_parse_done) {
        val = coll_ml_config_yylex();
        switch (val) {
        case COLL_ML_CONFIG_PARSE_DONE:
        case COLL_ML_CONFIG_PARSE_NEWLINE:
            break;
        case COLL_ML_CONFIG_PARSE_COLLECTIVE:
            /* dump all the information to last section that was defined */
            if (!first_coll) {
                ret = save_settings(&coll_config);

                if (OMPI_SUCCESS != ret) {
                    ML_ERROR(("Error in syntax for collective %s", coll_config.coll_name));
                    goto cleanup;
                }
            }
            
            /* reset collective config */
            reset_collective(&coll_config);

            first_coll    = false;
            first_section = true;

            ret = set_collective_name(&coll_config);
            if (OMPI_SUCCESS != ret) {
                goto cleanup;
            }
            break;
        case COLL_ML_CONFIG_PARSE_SECTION:
            if (ML_UNDEFINED == coll_config.coll_id) {
                ML_ERROR(("Collective section wasn't defined !"));
                ret = OMPI_ERROR;
                goto cleanup;
            }

            if (!first_section) {
                /* dump all the information to last section that was defined */
                ret = save_settings(&coll_config);
                if (OMPI_SUCCESS != ret) {
                    ML_ERROR(("Error in syntax for collective %s section %s", coll_config.coll_name,
                              coll_config.section.section_name));
                    goto cleanup;
                }
            }

            first_section = false;

            /* reset all section values */
            reset_section(&coll_config.section);

            /* set new section name */
            ret = set_section_name(&coll_config.section);
            if (OMPI_SUCCESS != ret) {
                goto cleanup;
            }
            break;
        case COLL_ML_CONFIG_PARSE_SINGLE_WORD:
            if (ML_UNDEFINED == coll_config.coll_id ||
                ML_UNDEFINED == coll_config.section.section_id) {
                ML_ERROR(("Collective section or sub-section was not defined !"));
                ret = OMPI_ERROR;
                goto cleanup;
            } else {
                parse_line(&coll_config.section);
            }
            break;

        default:
            /* anything else is an error */
            ML_ERROR(("Unexpected token!"));
            ret = OMPI_ERROR;
            goto cleanup;
            break;
        }
    }

    save_settings(&coll_config);
    fclose(coll_ml_config_yyin);
    coll_ml_config_yylex_destroy ();
    ret = OMPI_SUCCESS;

cleanup:
    reset_collective(&coll_config);
    if (NULL != key_buffer) {
        free(key_buffer);
        key_buffer = NULL;
        key_buffer_len = 0;
    }
    return ret;
}
Example #30
0
void MainWindow::on_MainWindow_destroyed()
{
    save_settings(def_setting);
}