comparison src/xs_config.c @ 785:fcda6f365e02

More cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 06 Nov 2012 14:00:54 +0200
parents 45108b3d88db
children 0617f844ebdb
comparison
equal deleted inserted replaced
784:45b8649f0ef9 785:fcda6f365e02
70 70
71 #define LUW(x) lookup_widget(xs_configwin, x) 71 #define LUW(x) lookup_widget(xs_configwin, x)
72 72
73 /* Samplerates 73 /* Samplerates
74 */ 74 */
75 static const gchar *xs_samplerates_table[] = { 75 static const gchar *xs_samplerates_table[] =
76 {
76 "8000", "11025", "22050", 77 "8000", "11025", "22050",
77 "44100", "48000", "64000", 78 "44100", "48000", "64000",
78 "96000" 79 "96000"
79 }; 80 };
80 81
81 static const gint xs_nsamplerates_table = (sizeof(xs_samplerates_table) / sizeof(xs_samplerates_table[0])); 82 static const gint xs_nsamplerates_table = sizeof(xs_samplerates_table) / sizeof(xs_samplerates_table[0]);
82 83
83 /* 84 /*
84 * Configuration specific stuff 85 * Configuration specific stuff
85 */ 86 */
86 XS_MUTEX(xs_cfg); 87 XS_MUTEX(xs_cfg);
130 { CTYPE_BOOL, &xs_cfg.subAutoEnable, "subAutoEnable" }, 131 { CTYPE_BOOL, &xs_cfg.subAutoEnable, "subAutoEnable" },
131 { CTYPE_BOOL, &xs_cfg.subAutoMinOnly, "subAutoMinOnly" }, 132 { CTYPE_BOOL, &xs_cfg.subAutoMinOnly, "subAutoMinOnly" },
132 { CTYPE_INT, &xs_cfg.subAutoMinTime, "subAutoMinTime" }, 133 { CTYPE_INT, &xs_cfg.subAutoMinTime, "subAutoMinTime" },
133 }; 134 };
134 135
135 static const gint xs_cfgtable_max = (sizeof(xs_cfgtable) / sizeof(xs_cfgtable[0])); 136 static const gint xs_ncfgtable = sizeof(xs_cfgtable) / sizeof(xs_cfgtable[0]);
136 137
137 138
138 static xs_wid_item_t xs_widtable[] = { 139 static xs_wid_item_t xs_cfgitems[] = {
139 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_16bit", &xs_cfg.audioBitsPerSample, XS_RES_16BIT }, 140 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_16bit", &xs_cfg.audioBitsPerSample, XS_RES_16BIT },
140 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_8bit", &xs_cfg.audioBitsPerSample, XS_RES_8BIT }, 141 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_8bit", &xs_cfg.audioBitsPerSample, XS_RES_8BIT },
141 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_mono", &xs_cfg.audioChannels, XS_CHN_MONO }, 142 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_mono", &xs_cfg.audioChannels, XS_CHN_MONO },
142 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_stereo", &xs_cfg.audioChannels, XS_CHN_STEREO }, 143 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_stereo", &xs_cfg.audioChannels, XS_CHN_STEREO },
143 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_autopan", &xs_cfg.audioChannels, XS_CHN_AUTOPAN }, 144 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_autopan", &xs_cfg.audioChannels, XS_CHN_AUTOPAN },
193 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_enable", &xs_cfg.subAutoEnable, 0 }, 194 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_enable", &xs_cfg.subAutoEnable, 0 },
194 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_min_only", &xs_cfg.subAutoMinOnly, 0 }, 195 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_min_only", &xs_cfg.subAutoMinOnly, 0 },
195 { WTYPE_SPIN, CTYPE_INT, "cfg_subauto_mintime", &xs_cfg.subAutoMinTime, 0 }, 196 { WTYPE_SPIN, CTYPE_INT, "cfg_subauto_mintime", &xs_cfg.subAutoMinTime, 0 },
196 }; 197 };
197 198
198 static const gint xs_widtable_max = (sizeof(xs_widtable) / sizeof(xs_widtable[0])); 199 static const gint xs_nwidtable = sizeof(xs_cfgitems) / sizeof(xs_cfgitems[0]);
199 200
200 201
201 /* Reset/initialize the configuration 202 /* Reset/initialize the configuration
202 */ 203 */
203 void xs_init_configuration(void) 204 void xs_init_configuration(void)
301 } 302 }
302 303
303 304
304 static void xs_filter_free(xs_sid_filter_t *filter) 305 static void xs_filter_free(xs_sid_filter_t *filter)
305 { 306 {
306 if (filter) { 307 if (filter)
308 {
307 g_free(filter->name); 309 g_free(filter->name);
308 filter->name = NULL; 310 filter->name = NULL;
309 g_free(filter); 311 g_free(filter);
310 } 312 }
311 } 313 }
314 #define XS_FITEM (4 * 2) 316 #define XS_FITEM (4 * 2)
315 317
316 static gboolean xs_filter_load_into(XS_CONFIG_FILE *cfg, gint nFilter, xs_sid_filter_t *filter) 318 static gboolean xs_filter_load_into(XS_CONFIG_FILE *cfg, gint nFilter, xs_sid_filter_t *filter)
317 { 319 {
318 gchar tmpKey[64], *tmpStr; 320 gchar tmpKey[64], *tmpStr;
321 gint i, j;
319 322
320 /* Get fields from config */ 323 /* Get fields from config */
321 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dType", nFilter); 324 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dType", nFilter);
322 if (!XS_CFG_GET_INT(tmpKey, &(filter->type))) 325 if (!XS_CFG_GET_INT(tmpKey, &(filter->type)))
323 return FALSE; 326 return FALSE;
328 331
329 filter->name = g_strdup(tmpStr); 332 filter->name = g_strdup(tmpStr);
330 if (filter->name == NULL) 333 if (filter->name == NULL)
331 return FALSE; 334 return FALSE;
332 335
333 if (filter->type == 1) { 336 switch (filter->type)
334 gint i, j; 337 {
338 case 1:
339
340 /* Types 1 has points */
341 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dNPoints", nFilter);
342 if (!XS_CFG_GET_INT(tmpKey, &(filter->npoints)))
343 return FALSE;
335 344
336 /* Types 1 has points */ 345 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dPoints", nFilter);
337 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dNPoints", nFilter); 346 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
338 if (!XS_CFG_GET_INT(tmpKey, &(filter->npoints))) 347 return FALSE;
348
349 for (i = 0, j = 0; i < filter->npoints; i++, j += XS_FITEM)
350 {
351 if (sscanf(&tmpStr[j], "%4x%4x",
352 &(filter->points[i].x),
353 &(filter->points[i].y)) != 2)
354 return FALSE;
355 }
356 break;
357
358 case 3:
359 /* Type 3 has tunables */
360 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dData", nFilter);
361 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
362 return FALSE;
363
364 if (sscanf(tmpStr, "%f,%f,%f,%f", &filter->rate, &filter->point,
365 &filter->voice_nonlinearity, &filter->cf_treshold) != 4)
366 return FALSE;
367
368 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dData3", nFilter);
369 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
370 return FALSE;
371
372 if (sscanf(tmpStr, "%f,%f,%f,%f", &filter->baseresistance,
373 &filter->offset, &filter->steepness,
374 &filter->minimumfetresistance) != 4)
375 return FALSE;
376 break;
377
378 case 4:
379 /* Type 4 has fewer tunables */
380 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dData4", nFilter);
381 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
382 return FALSE;
383
384 if (sscanf(tmpStr, "%f,%f", &filter->k, &filter->b) != 2)
385 return FALSE;
386 break;
387
388 default:
389 xs_error("Unknown filter type %d for '%s' (#%d).\n", filter->type, filter->name, nFilter);
339 return FALSE; 390 return FALSE;
340
341 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dPoints", nFilter);
342 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
343 return FALSE;
344
345 for (i = 0, j = 0; i < filter->npoints; i++, j += XS_FITEM) {
346 if (sscanf(&tmpStr[j], "%4x%4x",
347 &(filter->points[i].x),
348 &(filter->points[i].y)) != 2)
349 return FALSE;
350 }
351 } else if (filter->type == 3) {
352 /* Type 3 has tunables */
353 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dData", nFilter);
354 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
355 return FALSE;
356
357 if (sscanf(tmpStr, "%f,%f,%f,%f", &filter->rate, &filter->point,
358 &filter->voice_nonlinearity, &filter->cf_treshold) != 4)
359 return FALSE;
360
361 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dData3", nFilter);
362 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
363 return FALSE;
364
365 if (sscanf(tmpStr, "%f,%f,%f,%f", &filter->baseresistance,
366 &filter->offset, &filter->steepness,
367 &filter->minimumfetresistance) != 4)
368 return FALSE;
369
370 } else if (filter->type == 4) {
371 /* Type 4 has fewer tunables */
372 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dData4", nFilter);
373 if (!XS_CFG_GET_STRING(tmpKey, &tmpStr))
374 return FALSE;
375
376 if (sscanf(tmpStr, "%f,%f", &filter->k, &filter->b) != 2)
377 return FALSE;
378 } else {
379 xs_error("Unknown filter type %d for '%s' (#%d).\n", filter->type, filter->name, nFilter);
380 return FALSE;
381 } 391 }
382 392
383 return TRUE; 393 return TRUE;
384 } 394 }
385 395
390 400
391 /* Allocate filter struct */ 401 /* Allocate filter struct */
392 if ((filter = g_malloc0(sizeof(xs_sid_filter_t))) == NULL) 402 if ((filter = g_malloc0(sizeof(xs_sid_filter_t))) == NULL)
393 return NULL; 403 return NULL;
394 404
395 if (!xs_filter_load_into(cfg, nFilter, filter)) { 405 if (!xs_filter_load_into(cfg, nFilter, filter))
406 {
396 xs_error("Error loading filter %d from configuration.\n", nFilter); 407 xs_error("Error loading filter %d from configuration.\n", nFilter);
397 xs_filter_free(filter); 408 xs_filter_free(filter);
398 return NULL; 409 return NULL;
399 } else 410 } else
400 return filter; 411 return filter;
411 tmpValue = g_malloc(sizeof(gchar) * XS_FITEM * (pFilter->npoints + 1)); 422 tmpValue = g_malloc(sizeof(gchar) * XS_FITEM * (pFilter->npoints + 1));
412 if (tmpValue == NULL) 423 if (tmpValue == NULL)
413 return FALSE; 424 return FALSE;
414 425
415 /* Make value string */ 426 /* Make value string */
416 for (i = 0, j = 0; i < pFilter->npoints; i++, j += XS_FITEM) { 427 for (i = 0, j = 0; i < pFilter->npoints; i++, j += XS_FITEM)
428 {
417 g_snprintf(&tmpValue[j], XS_FITEM+1, "%04x%04x", 429 g_snprintf(&tmpValue[j], XS_FITEM+1, "%04x%04x",
418 pFilter->points[i].x, 430 pFilter->points[i].x,
419 pFilter->points[i].y); 431 pFilter->points[i].y);
420 } 432 }
421 433
456 468
457 static gboolean xs_chkf(xs_sid_filter_t *filter, const gchar *str, const gchar *name, gint type) 469 static gboolean xs_chkf(xs_sid_filter_t *filter, const gchar *str, const gchar *name, gint type)
458 { 470 {
459 if (g_strncasecmp(str, name, strlen(name))) 471 if (g_strncasecmp(str, name, strlen(name)))
460 return FALSE; 472 return FALSE;
461 if (filter->type != type) { 473
462 if (filter->type == -1) { 474 if (filter->type != type)
475 {
476 if (filter->type == -1)
477 {
463 filter->type = type; 478 filter->type = type;
464 return TRUE; 479 return TRUE;
465 } else { 480 }
481 else
482 {
466 xs_error("Unexpected key '%s' for filter type %d.\n"); 483 xs_error("Unexpected key '%s' for filter type %d.\n");
467 return FALSE; 484 return FALSE;
468 } 485 }
469 } else 486 } else
470 return TRUE; 487 return TRUE;
479 size_t lineNum, i; 496 size_t lineNum, i;
480 xs_sid_filter_t *filter = NULL; 497 xs_sid_filter_t *filter = NULL;
481 498
482 fprintf(stderr, "xs_filters_import(%s)\n", filename); 499 fprintf(stderr, "xs_filters_import(%s)\n", filename);
483 500
484 if ((inFile = fopen(filename, "ra")) == NULL) { 501 if ((inFile = fopen(filename, "ra")) == NULL)
502 {
485 xs_filters_error(""); 503 xs_filters_error("");
486 return FALSE; 504 return FALSE;
487 } 505 }
488 506
489 fprintf(stderr, "importing...\n"); 507 fprintf(stderr, "importing...\n");
490 508
491 inSection = FALSE; 509 inSection = FALSE;
492 lineNum = 0; 510 lineNum = 0;
493 while (fgets(inLine, XS_BUF_SIZE, inFile) != NULL && !isError) { 511 while (fgets(inLine, XS_BUF_SIZE, inFile) != NULL && !isError)
512 {
494 size_t linePos = 0; 513 size_t linePos = 0;
495 lineNum++; 514 lineNum++;
496 515
497 xs_findnext(inLine, &linePos); 516 xs_findnext(inLine, &linePos);
498 if (isalpha(inLine[linePos])) { 517 if (isalpha(inLine[linePos]))
518 {
499 /* A new key/value pair */ 519 /* A new key/value pair */
500 if (!xs_fgetitem(inLine, &linePos, '=', tmpStr, XS_BUF_SIZE)) { 520 if (!xs_fgetitem(inLine, &linePos, '=', tmpStr, XS_BUF_SIZE))
521 {
501 xs_error("Invalid line '%s' :: expected =", inLine); 522 xs_error("Invalid line '%s' :: expected =", inLine);
502 isError = TRUE; 523 isError = TRUE;
503 } else if (inSection) { 524 }
525 else
526 if (inSection)
527 {
504 linePos++; 528 linePos++;
505 xs_findnext(inLine, &linePos); 529 xs_findnext(inLine, &linePos);
506 530
507 if (xs_chkf(filter, tmpStr, "points", 1)) { 531 if (xs_chkf(filter, tmpStr, "points", 1))
508 532 {
509 } else if (xs_chkf(filter, tmpStr, "point", 1)) { 533 }
534 else
535 if (xs_chkf(filter, tmpStr, "point", 1))
536 {
510 537
511 } else if (!g_strncasecmp(tmpStr, "type", 4)) { 538 }
512 if (filter->type != -1) { 539 else
540 if (!g_strncasecmp(tmpStr, "type", 4))
541 {
542 if (filter->type != -1)
543 {
513 xs_error("Filter type %d already set for '%s'\n", 544 xs_error("Filter type %d already set for '%s'\n",
514 filter->type, sectName); 545 filter->type, sectName);
515 } 546 }
516 547 }
517 } else { 548 else
549 {
518 xs_error("Unsupported definition '%s' @ '%s'\n", 550 xs_error("Unsupported definition '%s' @ '%s'\n",
519 tmpStr, sectName); 551 tmpStr, sectName);
520 } 552 }
521 } 553 }
522 } else if (inLine[linePos] == '[') { 554 }
555 else
556 if (inLine[linePos] == '[')
557 {
523 /* Check for existing section */ 558 /* Check for existing section */
524 if (inSection) { 559 if (inSection)
560 {
525 /* Submit definition */ 561 /* Submit definition */
526 fprintf(stderr, "filter ends: %s\n", sectName); 562 fprintf(stderr, "filter ends: %s\n", sectName);
527 if ((filter = g_malloc0(sizeof(xs_sid_filter_t))) == NULL) { 563 if ((filter = g_malloc0(sizeof(xs_sid_filter_t))) == NULL)
564 {
528 fprintf(stderr, "could not allocate ..\n"); 565 fprintf(stderr, "could not allocate ..\n");
529 } else { 566 }
567 else
568 {
530 569
531 } 570 }
532 g_free(sectName); 571 g_free(sectName);
533 } 572 }
534 573
536 linePos++; 575 linePos++;
537 for (i = 0; i < XS_BUF_SIZE-1 && inLine[linePos] && inLine[linePos] != ']'; i++, linePos++) 576 for (i = 0; i < XS_BUF_SIZE-1 && inLine[linePos] && inLine[linePos] != ']'; i++, linePos++)
538 tmpStr[i] = inLine[linePos]; 577 tmpStr[i] = inLine[linePos];
539 tmpStr[i] = 0; 578 tmpStr[i] = 0;
540 579
541 if (inLine[linePos] != ']') { 580 if (inLine[linePos] != ']')
581 {
542 fprintf(stderr, "invalid! expected ']': %s\n", inLine); 582 fprintf(stderr, "invalid! expected ']': %s\n", inLine);
543 } else { 583 }
544 if (!g_strncasecmp(tmpStr, "filter", 6)) { 584 else
585 {
586 if (!g_strncasecmp(tmpStr, "filter", 6))
587 {
545 sectName = strdup(tmpStr + 6); 588 sectName = strdup(tmpStr + 6);
546 fprintf(stderr, "filter: %s\n", sectName); 589 fprintf(stderr, "filter: %s\n", sectName);
547 inSection = TRUE; 590 inSection = TRUE;
548 } else { 591 }
592 else
593 {
549 fprintf(stderr, "ignoring section: %s\n", tmpStr); 594 fprintf(stderr, "ignoring section: %s\n", tmpStr);
550 inSection = FALSE; 595 inSection = FALSE;
551 } 596 }
552 } 597 }
553 } else if (inLine[linePos] != '#' && inLine[linePos] != ';' && inLine[linePos] != 0) { 598 }
599 else if (inLine[linePos] != '#' && inLine[linePos] != ';' && inLine[linePos] != 0)
600 {
554 /* Syntax error */ 601 /* Syntax error */
555 xs_error("Syntax error: '%s'\n", inLine); 602 xs_error("Syntax error: '%s'\n", inLine);
556 isError = TRUE; 603 isError = TRUE;
557 } 604 }
558 } 605 }
562 } 609 }
563 610
564 611
565 static gboolean xs_filter_export(FILE *outFile, xs_sid_filter_t *filter) 612 static gboolean xs_filter_export(FILE *outFile, xs_sid_filter_t *filter)
566 { 613 {
614 gint i;
615
567 fprintf(outFile, 616 fprintf(outFile,
568 "[Filter%s]\n" 617 "[Filter%s]\n"
569 "type=%d\n", 618 "type=%d\n",
570 filter->name, filter->type); 619 filter->name, filter->type);
571 620
572 if (filter->type == 1) { 621 switch (filter->type)
573 gint i; 622 {
574 fprintf(outFile, "points=%d\n", filter->npoints); 623 case 1:
624 fprintf(outFile, "points=%d\n", filter->npoints);
625
626 for (i = 0; i < filter->npoints; i++)
627 {
628 fprintf(outFile,
629 "point%d=%d,%d\n",
630 i + 1,
631 filter->points[i].x,
632 filter->points[i].y);
633 }
634 break;
575 635
576 for (i = 0; i < filter->npoints; i++) { 636 case 3:
577 fprintf(outFile, 637 fprintf(outFile,
578 "point%d=%d,%d\n", 638 "DistortionRate = %f\n"
579 i + 1, 639 "DistortionPoint = %f\n"
580 filter->points[i].x, 640 "VoiceNonlinearity = %f\n"
581 filter->points[i].y); 641 "DistortionCFThreshold = %f\n",
582 } 642 filter->rate, filter->point,
583 } else if (filter->type == 3) { 643 filter->voice_nonlinearity,
584 fprintf(outFile, 644 filter->cf_treshold);
585 "DistortionRate = %f\n" 645
586 "DistortionPoint = %f\n" 646 fprintf(outFile,
587 "VoiceNonlinearity = %f\n" 647 "Type3BaseResistance = %f\n"
588 "DistortionCFThreshold = %f\n", 648 "Type3Offset = %f\n"
589 filter->rate, filter->point, 649 "Type3Steepness = %f\n"
590 filter->voice_nonlinearity, 650 "Type3MinimumFETResistance = %f\n",
591 filter->cf_treshold); 651 filter->baseresistance, filter->offset,
652 filter->steepness, filter->minimumfetresistance);
653 break;
654
655 case 4:
656 fprintf(outFile,
657 "Type4K=%f\n"
658 "Type4B=%f\n",
659 filter->k, filter->b);
660 break;
592 661
593 fprintf(outFile, 662 default:
594 "Type3BaseResistance = %f\n" 663 xs_error("Filter '%s' has type %d, which is unsupported by export.\n",
595 "Type3Offset = %f\n" 664 filter->name, filter->type);
596 "Type3Steepness = %f\n" 665 return FALSE;
597 "Type3MinimumFETResistance = %f\n",
598 filter->baseresistance, filter->offset,
599 filter->steepness, filter->minimumfetresistance);
600
601 } else if (filter->type == 4) {
602 fprintf(outFile,
603 "Type4K=%f\n"
604 "Type4B=%f\n",
605 filter->k, filter->b);
606 } else {
607 xs_error("Filter '%s' has type %d, which is unsupported by export.\n",
608 filter->name, filter->type);
609 return FALSE;
610 } 666 }
611 667
612 fprintf(outFile, "\n"); 668 fprintf(outFile, "\n");
613 return TRUE; 669 return TRUE;
614 } 670 }
615 671
616 672
617 static gboolean xs_filters_export(const gchar *filename, xs_sid_filter_t **filters, gint nFilters) 673 static gboolean xs_filters_export(const gchar *filename, xs_sid_filter_t **filters, gint nfilters)
618 { 674 {
619 gboolean result = TRUE; 675 gboolean result = TRUE;
620 FILE *outFile; 676 FILE *outFile;
621 gint n; 677 gint n;
622 678
623 /* Open/create the file */ 679 /* Open/create the file */
624 if ((outFile = fopen(filename, "wa")) == NULL) { 680 if ((outFile = fopen(filename, "wa")) == NULL)
681 {
625 xs_filters_error("Could not open '%s' for writing! Not exporting.", filename); 682 xs_filters_error("Could not open '%s' for writing! Not exporting.", filename);
626 return FALSE; 683 return FALSE;
627 } 684 }
628 685
629 /* Header */ 686 /* Header */
630 fprintf(outFile, 687 fprintf(outFile,
631 "; SIDPlay2 compatible filter definition file\n" 688 "; SIDPlay2 compatible filter definition file\n"
632 "; Exported by " PACKAGE_STRING "\n\n"); 689 "; Exported by " PACKAGE_STRING "\n\n");
633 690
634 /* Write each filter spec in "INI"-style format */ 691 /* Write each filter spec in "INI"-style format */
635 for (n = 0; n < nFilters; n++) { 692 for (n = 0; n < nfilters; n++)
636 if (!xs_filter_export(outFile, filters[n])) { 693 {
694 if (!xs_filter_export(outFile, filters[n]))
695 {
637 result = FALSE; 696 result = FALSE;
638 break; 697 break;
639 } 698 }
640 } 699 }
641 700
660 XS_MUTEX_LOCK(xs_cfg); 719 XS_MUTEX_LOCK(xs_cfg);
661 XSDEBUG("loading from config-file ...\n"); 720 XSDEBUG("loading from config-file ...\n");
662 721
663 cfg = XS_CONFIG_OPEN(); 722 cfg = XS_CONFIG_OPEN();
664 723
665 if (cfg == NULL) { 724 if (cfg == NULL)
725 {
666 XSDEBUG("Could not open configuration, trying to write defaults...\n"); 726 XSDEBUG("Could not open configuration, trying to write defaults...\n");
667 xs_write_configuration(); 727 xs_write_configuration();
668 return; 728 return;
669 } 729 }
670 730
671 /* Read the new settings from XMMS configuration file */ 731 /* Read the new settings from XMMS configuration file */
672 for (i = 0; i < xs_cfgtable_max; i++) { 732 for (i = 0; i < xs_ncfgtable; i++)
673 switch (xs_cfgtable[i].itemType) { 733 switch (xs_cfgtable[i].itemType)
734 {
674 case CTYPE_INT: 735 case CTYPE_INT:
675 XS_CFG_GET_INT(xs_cfgtable[i].itemName, 736 XS_CFG_GET_INT(xs_cfgtable[i].itemName,
676 (gint *) xs_cfgtable[i].itemData); 737 (gint *) xs_cfgtable[i].itemData);
677 break; 738 break;
678 739
691 (gchar **) &tmpStr)) { 752 (gchar **) &tmpStr)) {
692 xs_pstrcpy((gchar **) xs_cfgtable[i].itemData, tmpStr); 753 xs_pstrcpy((gchar **) xs_cfgtable[i].itemData, tmpStr);
693 g_free(tmpStr); 754 g_free(tmpStr);
694 } 755 }
695 break; 756 break;
696 }
697 } 757 }
698 758
699 /* Filters and presets are a special case */ 759 /* Filters and presets are a special case */
700 xs_filter_load_into(cfg, 0, &xs_cfg.sid2Filter); 760 xs_filter_load_into(cfg, 0, &xs_cfg.sid2Filter);
701 761
702 if (xs_cfg.sid2NFilterPresets > 0) { 762 if (xs_cfg.sid2NFilterPresets > 0)
763 {
703 xs_cfg.sid2FilterPresets = g_malloc0(xs_cfg.sid2NFilterPresets * sizeof(xs_sid_filter_t *)); 764 xs_cfg.sid2FilterPresets = g_malloc0(xs_cfg.sid2NFilterPresets * sizeof(xs_sid_filter_t *));
704 if (!xs_cfg.sid2FilterPresets) { 765 if (!xs_cfg.sid2FilterPresets)
766 {
705 xs_error("Allocation of sid2FilterPresets structure failed!\n"); 767 xs_error("Allocation of sid2FilterPresets structure failed!\n");
706 } else { 768 }
707 for (i = 0; i < xs_cfg.sid2NFilterPresets; i++) { 769 else
770 {
771 for (i = 0; i < xs_cfg.sid2NFilterPresets; i++)
708 xs_cfg.sid2FilterPresets[i] = xs_filter_load(cfg, i); 772 xs_cfg.sid2FilterPresets[i] = xs_filter_load(cfg, i);
709 }
710 } 773 }
711 } 774 }
712 775
713 XS_CONFIG_FREE(cfg); 776 XS_CONFIG_FREE(cfg);
714 777
734 if (!cfg) cfg = xmms_cfg_new(); 797 if (!cfg) cfg = xmms_cfg_new();
735 if (!cfg) return -1; 798 if (!cfg) return -1;
736 #endif 799 #endif
737 800
738 /* Write the new settings to XMMS configuration file */ 801 /* Write the new settings to XMMS configuration file */
739 for (i = 0; i < xs_cfgtable_max; i++) { 802 for (i = 0; i < xs_ncfgtable; i++)
740 switch (xs_cfgtable[i].itemType) { 803 switch (xs_cfgtable[i].itemType)
804 {
741 case CTYPE_INT: 805 case CTYPE_INT:
742 XS_CFG_SET_INT(xs_cfgtable[i].itemName, 806 XS_CFG_SET_INT(xs_cfgtable[i].itemName,
743 *(gint *) xs_cfgtable[i].itemData); 807 *(gint *) xs_cfgtable[i].itemData);
744 break; 808 break;
745 809
755 819
756 case CTYPE_STR: 820 case CTYPE_STR:
757 XS_CFG_SET_STRING(xs_cfgtable[i].itemName, 821 XS_CFG_SET_STRING(xs_cfgtable[i].itemName,
758 *(gchar **) xs_cfgtable[i].itemData); 822 *(gchar **) xs_cfgtable[i].itemData);
759 break; 823 break;
760 }
761 } 824 }
762 825
763 826
764 #ifndef AUDACIOUS_PLUGIN 827 #ifndef AUDACIOUS_PLUGIN
765 xmms_cfg_write_default_file(cfg); 828 xmms_cfg_write_default_file(cfg);
789 /* Get lock on configuration */ 852 /* Get lock on configuration */
790 XS_MUTEX_LOCK(xs_cfg); 853 XS_MUTEX_LOCK(xs_cfg);
791 854
792 XSDEBUG("get data from widgets to config...\n"); 855 XSDEBUG("get data from widgets to config...\n");
793 856
794 for (i = 0; i < xs_widtable_max; i++) { 857 for (i = 0; i < xs_nwidtable; i++)
795 switch (xs_widtable[i].widType) { 858 switch (xs_cfgitems[i].widType)
859 {
796 case WTYPE_BGROUP: 860 case WTYPE_BGROUP:
797 /* Check if toggle-button is active */ 861 /* Check if toggle-button is active */
798 if (GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName))->active) { 862 if (GTK_TOGGLE_BUTTON(LUW(xs_cfgitems[i].widName))->active)
863 {
799 /* Yes, set the constant value */ 864 /* Yes, set the constant value */
800 *((gint *) xs_widtable[i].itemData) = xs_widtable[i].itemSet; 865 *((gint *) xs_cfgitems[i].itemData) = xs_cfgitems[i].itemSet;
801 } 866 }
802 break; 867 break;
803 868
804 case WTYPE_COMBO: 869 case WTYPE_COMBO:
805 /* Get text from text-widget */ 870 /* Get text from text-widget */
806 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW(xs_widtable[i].widName))); 871 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW(xs_cfgitems[i].widName)));
807 if (sscanf(tmpStr, "%d", &tmpInt) != 1) 872 if (sscanf(tmpStr, "%d", &tmpInt) != 1)
808 tmpInt = xs_widtable[i].itemSet; 873 tmpInt = xs_cfgitems[i].itemSet;
809 874
810 *((gint *) xs_widtable[i].itemData) = tmpInt; 875 *((gint *) xs_cfgitems[i].itemData) = tmpInt;
811 break; 876 break;
812 877
813 case WTYPE_SPIN: 878 case WTYPE_SPIN:
814 case WTYPE_SCALE: 879 case WTYPE_SCALE:
815 /* Get the value */ 880 /* Get the value */
816 switch (xs_widtable[i].widType) { 881 switch (xs_cfgitems[i].widType)
817 case WTYPE_SPIN: 882 {
818 tmpValue = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW(xs_widtable[i].widName)))->value; 883 case WTYPE_SPIN:
819 break; 884 tmpValue = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW(xs_cfgitems[i].widName)))->value;
820 885 break;
821 case WTYPE_SCALE: 886
822 tmpValue = gtk_range_get_adjustment(GTK_RANGE(LUW(xs_widtable[i].widName)))->value; 887 case WTYPE_SCALE:
823 break; 888 tmpValue = gtk_range_get_adjustment(GTK_RANGE(LUW(xs_cfgitems[i].widName)))->value;
824 889 break;
825 default: 890
826 tmpValue = -1; 891 default:
827 break; 892 tmpValue = -1;
893 break;
828 } 894 }
829 895
830 /* Set the value */ 896 /* Set the value */
831 switch (xs_widtable[i].itemType) { 897 switch (xs_cfgitems[i].itemType)
832 case CTYPE_INT: 898 {
833 *((gint *) xs_widtable[i].itemData) = (gint) tmpValue; 899 case CTYPE_INT:
834 break; 900 *((gint *) xs_cfgitems[i].itemData) = (gint) tmpValue;
835 901 break;
836 case CTYPE_FLOAT: 902
837 *((gfloat *) xs_widtable[i].itemData) = tmpValue; 903 case CTYPE_FLOAT:
838 break; 904 *((gfloat *) xs_cfgitems[i].itemData) = tmpValue;
905 break;
839 } 906 }
840 break; 907 break;
841 908
842 case WTYPE_BUTTON: 909 case WTYPE_BUTTON:
843 /* Check if toggle-button is active */ 910 /* Check if toggle-button is active */
844 *((gboolean *) xs_widtable[i].itemData) = 911 *((gboolean *) xs_cfgitems[i].itemData) =
845 (GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName))->active); 912 (GTK_TOGGLE_BUTTON(LUW(xs_cfgitems[i].widName))->active);
846 break; 913 break;
847 914
848 case WTYPE_TEXT: 915 case WTYPE_TEXT:
849 /* Get text from text-widget */ 916 /* Get text from text-widget */
850 xs_pstrcpy((gchar **) xs_widtable[i].itemData, 917 xs_pstrcpy((gchar **) xs_cfgitems[i].itemData,
851 gtk_entry_get_text(GTK_ENTRY(LUW(xs_widtable[i].widName)))); 918 gtk_entry_get_text(GTK_ENTRY(LUW(xs_cfgitems[i].widName))));
852 break; 919 break;
853 }
854 } 920 }
855 921
856 /* Get filter settings */ 922 /* Get filter settings */
857 /* 923 /*
858 if (!xs_curve_get_points(XS_CURVE(LUW("")), &xs_cfg.sid2Filter.points, &xs_cfg.sid2Filter.npoints)) { 924 if (!xs_curve_get_points(XS_CURVE(LUW("")), &xs_cfg.sid2Filter.points, &xs_cfg.sid2Filter.npoints)) {
893 void xs_cfg_sldb_browse(GtkButton * button, gpointer user_data) 959 void xs_cfg_sldb_browse(GtkButton * button, gpointer user_data)
894 { 960 {
895 (void) button; 961 (void) button;
896 (void) user_data; 962 (void) user_data;
897 963
898 if (xs_sldb_fileselector != NULL) { 964 if (xs_sldb_fileselector != NULL)
965 {
899 XS_WINDOW_PRESENT(xs_sldb_fileselector); 966 XS_WINDOW_PRESENT(xs_sldb_fileselector);
900 return; 967 return;
901 } 968 }
902 969
903 xs_sldb_fileselector = create_xs_sldb_fs(); 970 xs_sldb_fileselector = create_xs_sldb_fs();
970 void xs_cfg_hvsc_browse(GtkButton * button, gpointer user_data) 1037 void xs_cfg_hvsc_browse(GtkButton * button, gpointer user_data)
971 { 1038 {
972 (void) button; 1039 (void) button;
973 (void) user_data; 1040 (void) user_data;
974 1041
975 if (xs_hvsc_selector != NULL) { 1042 if (xs_hvsc_selector != NULL)
1043 {
976 XS_WINDOW_PRESENT(xs_hvsc_selector); 1044 XS_WINDOW_PRESENT(xs_hvsc_selector);
977 return; 1045 return;
978 } 1046 }
979 1047
980 xs_hvsc_selector = create_xs_hvsc_fs(); 1048 xs_hvsc_selector = create_xs_hvsc_fs();
1022 assert(curve); 1090 assert(curve);
1023 assert(f); 1091 assert(f);
1024 1092
1025 xs_curve_reset(curve); 1093 xs_curve_reset(curve);
1026 xs_curve_set_range(curve, 0,0, XS_SIDPLAY2_NFPOINTS, XS_SIDPLAY2_FMAX); 1094 xs_curve_set_range(curve, 0,0, XS_SIDPLAY2_NFPOINTS, XS_SIDPLAY2_FMAX);
1027 if (!xs_curve_set_points(curve, f->points, f->npoints)) { 1095 if (!xs_curve_set_points(curve, f->points, f->npoints))
1096 {
1028 // FIXME 1097 // FIXME
1029 xs_error("Warning: Could not set filter curve widget points!\n"); 1098 xs_error("Warning: Could not set filter curve widget points!\n");
1030 } 1099 }
1031 } 1100 }
1032 1101
1034 void xs_cfg_sp2_presets_update(void) 1103 void xs_cfg_sp2_presets_update(void)
1035 { 1104 {
1036 GList *tmpList = NULL; 1105 GList *tmpList = NULL;
1037 gint i; 1106 gint i;
1038 1107
1039 for (i = 0; i < xs_cfg.sid2NFilterPresets; i++) { 1108 for (i = 0; i < xs_cfg.sid2NFilterPresets; i++)
1109 {
1040 tmpList = g_list_append(tmpList, 1110 tmpList = g_list_append(tmpList,
1041 (gpointer) xs_cfg.sid2FilterPresets[i]->name); 1111 (gpointer) xs_cfg.sid2FilterPresets[i]->name);
1042 } 1112 }
1043 1113
1044 if (tmpList != NULL) 1114 if (tmpList != NULL)
1057 (void) user_data; 1127 (void) user_data;
1058 1128
1059 XS_MUTEX_LOCK(xs_cfg); 1129 XS_MUTEX_LOCK(xs_cfg);
1060 1130
1061 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry"))); 1131 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry")));
1062 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++) { 1132 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++)
1063 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name)) { 1133 {
1134 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name))
1135 {
1064 j = i; 1136 j = i;
1065 break; 1137 break;
1066 } 1138 }
1067 } 1139 }
1068 1140
1069 if (j != -1) { 1141 if (j != -1)
1142 {
1070 fprintf(stderr, "Updating from '%s'\n", tmpStr); 1143 fprintf(stderr, "Updating from '%s'\n", tmpStr);
1071 xs_cfg_sp2_filter_update( 1144 xs_cfg_sp2_filter_update(
1072 XS_CURVE(LUW("cfg_sp2_filter_curve")), 1145 XS_CURVE(LUW("cfg_sp2_filter_curve")),
1073 xs_cfg.sid2FilterPresets[i]); 1146 xs_cfg.sid2FilterPresets[i]);
1074 } else { 1147 }
1148 else
1149 {
1075 /* error/warning: no such filter preset */ 1150 /* error/warning: no such filter preset */
1076 fprintf(stderr, "No such filter preset '%s'!\n", tmpStr); 1151 fprintf(stderr, "No such filter preset '%s'!\n", tmpStr);
1077 } 1152 }
1078 1153
1079 XS_MUTEX_UNLOCK(xs_cfg); 1154 XS_MUTEX_UNLOCK(xs_cfg);
1096 (void) user_data; 1171 (void) user_data;
1097 1172
1098 XS_MUTEX_LOCK(xs_cfg); 1173 XS_MUTEX_LOCK(xs_cfg);
1099 1174
1100 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry"))); 1175 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry")));
1101 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++) { 1176 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++)
1102 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name)) { 1177 {
1178 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name))
1179 {
1103 j = i; 1180 j = i;
1104 break; 1181 break;
1105 } 1182 }
1106 } 1183 }
1107 1184
1108 if (j != -1) { 1185 if (j != -1)
1186 {
1109 fprintf(stderr, "Found, confirm overwrite?\n"); 1187 fprintf(stderr, "Found, confirm overwrite?\n");
1110 } 1188 }
1111 1189
1112 fprintf(stderr, "saving!\n"); 1190 fprintf(stderr, "saving!\n");
1113 1191
1131 void xs_cfg_sp2_filter_import(GtkButton *button, gpointer user_data) 1209 void xs_cfg_sp2_filter_import(GtkButton *button, gpointer user_data)
1132 { 1210 {
1133 (void) button; 1211 (void) button;
1134 (void) user_data; 1212 (void) user_data;
1135 1213
1136 if (xs_filt_importselector != NULL) { 1214 if (xs_filt_importselector != NULL)
1215 {
1137 XS_WINDOW_PRESENT(xs_filt_importselector); 1216 XS_WINDOW_PRESENT(xs_filt_importselector);
1138 return; 1217 return;
1139 } 1218 }
1140 1219
1141 xs_filt_importselector = create_xs_filter_import_fs(); 1220 xs_filt_importselector = create_xs_filter_import_fs();
1170 void xs_cfg_sp2_filter_export(GtkButton *button, gpointer user_data) 1249 void xs_cfg_sp2_filter_export(GtkButton *button, gpointer user_data)
1171 { 1250 {
1172 (void) button; 1251 (void) button;
1173 (void) user_data; 1252 (void) user_data;
1174 1253
1175 if (xs_filt_exportselector != NULL) { 1254 if (xs_filt_exportselector != NULL)
1255 {
1176 XS_WINDOW_PRESENT(xs_filt_exportselector); 1256 XS_WINDOW_PRESENT(xs_filt_exportselector);
1177 return; 1257 return;
1178 } 1258 }
1179 1259
1180 xs_filt_exportselector = create_xs_filter_export_fs(); 1260 xs_filt_exportselector = create_xs_filter_export_fs();
1364 gchar tmpStr[64]; 1444 gchar tmpStr[64];
1365 GList *tmpList = NULL; 1445 GList *tmpList = NULL;
1366 GtkWidget *tmpCurve; 1446 GtkWidget *tmpCurve;
1367 1447
1368 /* Check if the window already exists */ 1448 /* Check if the window already exists */
1369 if (xs_configwin) { 1449 if (xs_configwin)
1450 {
1370 XS_WINDOW_PRESENT(xs_configwin); 1451 XS_WINDOW_PRESENT(xs_configwin);
1371 return; 1452 return;
1372 } 1453 }
1373 1454
1374 /* Create the window */ 1455 /* Create the window */
1376 1457
1377 /* Get lock on configuration */ 1458 /* Get lock on configuration */
1378 XS_MUTEX_LOCK(xs_cfg); 1459 XS_MUTEX_LOCK(xs_cfg);
1379 1460
1380 /* Add samplerates */ 1461 /* Add samplerates */
1381 for (i = 0; i < xs_nsamplerates_table; i++) { 1462 for (i = 0; i < xs_nsamplerates_table; i++)
1463 {
1382 tmpList = g_list_append (tmpList, 1464 tmpList = g_list_append (tmpList,
1383 (gpointer) xs_samplerates_table[i]); 1465 (gpointer) xs_samplerates_table[i]);
1384 } 1466 }
1385 gtk_combo_set_popdown_strings(GTK_COMBO(LUW("cfg_samplerate_combo")), tmpList); 1467 gtk_combo_set_popdown_strings(GTK_COMBO(LUW("cfg_samplerate_combo")), tmpList);
1386 g_list_free(tmpList); 1468 g_list_free(tmpList);
1425 xs_cfg_subauto_enable_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_subauto_enable")), NULL); 1507 xs_cfg_subauto_enable_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_subauto_enable")), NULL);
1426 xs_cfg_subauto_min_only_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_subauto_min_only")), NULL); 1508 xs_cfg_subauto_min_only_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_subauto_min_only")), NULL);
1427 1509
1428 1510
1429 /* Set current data to widgets */ 1511 /* Set current data to widgets */
1430 for (i = 0; i < xs_widtable_max; i++) { 1512 for (i = 0; i < xs_nwidtable; i++)
1431 switch (xs_widtable[i].widType) { 1513 {
1514 switch (xs_cfgitems[i].widType)
1515 {
1432 case WTYPE_BGROUP: 1516 case WTYPE_BGROUP:
1433 assert(xs_widtable[i].itemType == CTYPE_INT); 1517 assert(xs_cfgitems[i].itemType == CTYPE_INT);
1434 /* Check if current value matches the given one */ 1518 /* Check if current value matches the given one */
1435 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName)), 1519 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_cfgitems[i].widName)),
1436 (*((gint *) xs_widtable[i].itemData) == xs_widtable[i].itemSet)); 1520 (*((gint *) xs_cfgitems[i].itemData) == xs_cfgitems[i].itemSet));
1437 break; 1521 break;
1438 1522
1439 case WTYPE_COMBO: 1523 case WTYPE_COMBO:
1440 assert(xs_widtable[i].itemType == CTYPE_INT); 1524 assert(xs_cfgitems[i].itemType == CTYPE_INT);
1441 g_snprintf(tmpStr, sizeof(tmpStr), "%d", *(gint *) xs_widtable[i].itemData); 1525 g_snprintf(tmpStr, sizeof(tmpStr), "%d", *(gint *) xs_cfgitems[i].itemData);
1442 gtk_entry_set_text(GTK_ENTRY(LUW(xs_widtable[i].widName)), tmpStr); 1526 gtk_entry_set_text(GTK_ENTRY(LUW(xs_cfgitems[i].widName)), tmpStr);
1443 break; 1527 break;
1444 1528
1445 case WTYPE_SPIN: 1529 case WTYPE_SPIN:
1446 case WTYPE_SCALE: 1530 case WTYPE_SCALE:
1447 /* Get the value */ 1531 /* Get the value */
1448 switch (xs_widtable[i].itemType) { 1532 switch (xs_cfgitems[i].itemType)
1449 case CTYPE_INT: 1533 {
1450 tmpValue = (gfloat) * ((gint *) xs_widtable[i].itemData); 1534 case CTYPE_INT:
1451 break; 1535 tmpValue = (gfloat) * ((gint *) xs_cfgitems[i].itemData);
1452 1536 break;
1453 case CTYPE_FLOAT: 1537
1454 tmpValue = *((gfloat *) xs_widtable[i].itemData); 1538 case CTYPE_FLOAT:
1455 break; 1539 tmpValue = *((gfloat *) xs_cfgitems[i].itemData);
1456 1540 break;
1457 default: 1541
1458 tmpValue = -1; 1542 default:
1459 assert(0); 1543 tmpValue = -1;
1460 break; 1544 assert(0);
1545 break;
1461 } 1546 }
1462 1547
1463 /* Set the value */ 1548 /* Set the value */
1464 switch (xs_widtable[i].widType) { 1549 switch (xs_cfgitems[i].widType)
1465 case WTYPE_SPIN: 1550 {
1466 gtk_adjustment_set_value(gtk_spin_button_get_adjustment 1551 case WTYPE_SPIN:
1467 (GTK_SPIN_BUTTON(LUW(xs_widtable[i].widName))), tmpValue); 1552 gtk_adjustment_set_value(gtk_spin_button_get_adjustment
1468 break; 1553 (GTK_SPIN_BUTTON(LUW(xs_cfgitems[i].widName))), tmpValue);
1469 1554 break;
1470 case WTYPE_SCALE: 1555
1471 gtk_adjustment_set_value(gtk_range_get_adjustment 1556 case WTYPE_SCALE:
1472 (GTK_RANGE(LUW(xs_widtable[i].widName))), tmpValue); 1557 gtk_adjustment_set_value(gtk_range_get_adjustment
1473 break; 1558 (GTK_RANGE(LUW(xs_cfgitems[i].widName))), tmpValue);
1559 break;
1474 } 1560 }
1475 break; 1561 break;
1476 1562
1477 case WTYPE_BUTTON: 1563 case WTYPE_BUTTON:
1478 assert(xs_widtable[i].itemType == CTYPE_BOOL); 1564 assert(xs_cfgitems[i].itemType == CTYPE_BOOL);
1479 /* Set toggle-button */ 1565 /* Set toggle-button */
1480 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName)), 1566 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_cfgitems[i].widName)),
1481 *((gboolean *) xs_widtable[i].itemData)); 1567 *((gboolean *) xs_cfgitems[i].itemData));
1482 break; 1568 break;
1483 1569
1484 case WTYPE_TEXT: 1570 case WTYPE_TEXT:
1485 assert(xs_widtable[i].itemType == CTYPE_STR); 1571 assert(xs_cfgitems[i].itemType == CTYPE_STR);
1486 /* Set text to text-widget */ 1572 /* Set text to text-widget */
1487 if (*(gchar **) xs_widtable[i].itemData != NULL) { 1573 if (*(gchar **) xs_cfgitems[i].itemData != NULL)
1488 gtk_entry_set_text(GTK_ENTRY(LUW(xs_widtable[i].widName)), 1574 {
1489 *(gchar **) xs_widtable[i].itemData); 1575 gtk_entry_set_text(GTK_ENTRY(LUW(xs_cfgitems[i].widName)),
1576 *(gchar **) xs_cfgitems[i].itemData);
1490 } 1577 }
1491 break; 1578 break;
1492 } 1579 }
1493 } 1580 }
1494 1581