annotate src/xs_title.c @ 983:04dde987c0aa

Some translation updates.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 31 Mar 2013 11:43:01 +0300
parents be2a8436461a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 Titlestring handling
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
324
dd201740a720 Changed copyright text.
Matti Hamalainen <ccr@tnsp.org>
parents: 233
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
723
9321ffa2ea7e Update copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 718
diff changeset
7 (C) Copyright 1999-2009 Tecnic Software productions (TNSP)
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 (at your option) any later version.
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 GNU General Public License for more details.
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
412
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
19 You should have received a copy of the GNU General Public License along
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
20 with this program; if not, write to the Free Software Foundation, Inc.,
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #include "xs_title.h"
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 #include "xs_support.h"
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #include "xs_config.h"
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
26
618
ddae043e8e47 Remove Audacious related stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 611
diff changeset
27
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
28 static void xs_path_split(gchar *path, gchar **tmpFilename, gchar **tmpFilePath, gchar **tmpFileExt)
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
29 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
30 gchar *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
31
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
32 /* Split the filename into path */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
33 *tmpFilePath = g_strdup(path);
763
61a527ac3baa Cleanups, remove useless function.
Matti Hamalainen <ccr@tnsp.org>
parents: 751
diff changeset
34 tmpStr = strrchr(*tmpFilePath, '/');
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
35 if (tmpStr) tmpStr[1] = 0;
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
36
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
37 /* Filename */
763
61a527ac3baa Cleanups, remove useless function.
Matti Hamalainen <ccr@tnsp.org>
parents: 751
diff changeset
38 *tmpFilename = strrchr(path, '/');
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
39 if (*tmpFilename)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
40 *tmpFilename = g_strdup(*tmpFilename + 1);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
41 else
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
42 *tmpFilename = g_strdup(path);
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
43
763
61a527ac3baa Cleanups, remove useless function.
Matti Hamalainen <ccr@tnsp.org>
parents: 751
diff changeset
44 tmpStr = strrchr(*tmpFilename, '.');
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
45 tmpStr[0] = 0;
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
46
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
47 /* Extension */
763
61a527ac3baa Cleanups, remove useless function.
Matti Hamalainen <ccr@tnsp.org>
parents: 751
diff changeset
48 *tmpFileExt = strrchr(path, '.');
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
49 }
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
50
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
51
618
ddae043e8e47 Remove Audacious related stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 611
diff changeset
52 /* Create a title string based on given information and settings.
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 */
718
50c30f624bbd Whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
54 #define VPUTCH(MCH) \
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
55 if (index < XS_BUF_SIZE) tmpBuf[index++] = MCH;
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 377
diff changeset
56
718
50c30f624bbd Whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
57 #define VPUTSTR(MSTR) { \
50c30f624bbd Whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
58 if (MSTR != NULL) { \
50c30f624bbd Whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
59 if ((index + strlen(MSTR) + 1) < XS_BUF_SIZE) { \
50c30f624bbd Whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
60 strcpy(&tmpBuf[index], MSTR); \
50c30f624bbd Whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
61 index += strlen(MSTR); \
50c30f624bbd Whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
62 } else \
50c30f624bbd Whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
63 index = XS_BUF_SIZE; \
50c30f624bbd Whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 717
diff changeset
64 } \
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 377
diff changeset
65 }
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67
961
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
68 const gchar *xs_get_sidmodel(gint model)
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
69 {
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
70 switch (model)
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
71 {
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
72 case XS_SIDMODEL_6581: return "6581";
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
73 case XS_SIDMODEL_8580: return "8580";
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
74 case XS_SIDMODEL_ANY: return "ANY";
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
75 case XS_SIDMODEL_UNKNOWN: return "???";
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
76 default: return "";
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
77 }
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
78 }
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
79
751
55eea3fa8868 Rename some structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 745
diff changeset
80 gchar *xs_make_titlestring(XSTuneInfo *p, gint subTune)
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
82 gchar *tmpFilename, *tmpFilePath, *tmpFileExt,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
83 *str, *result, tmpStr[XS_BUF_SIZE], tmpBuf[XS_BUF_SIZE];
751
55eea3fa8868 Rename some structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 745
diff changeset
84 XSSubTuneInfo *subInfo;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
85 gint index;
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
87 /* Get filename parts */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
88 xs_path_split(p->sidFilename, &tmpFilename,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
89 &tmpFilePath, &tmpFileExt);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
90
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
91 /* Get sub-tune information */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
92 if ((subTune > 0) && (subTune <= p->nsubTunes)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
93 subInfo = &(p->subTunes[subTune - 1]);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
94 } else
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
95 subInfo = NULL;
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
97
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
98 /* Check if the titles are overridden or not */
745
9dc5378cc806 Remove XMMS_EXTRA stuff, as we require XMMS 1.2.10+ now.
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
99 #if !defined(AUDACIOUS_PLUGIN)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
100 if (!xs_cfg.titleOverride) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
101 TitleInput *pTuple;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
102
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
103 pTuple = (TitleInput *) g_malloc0(sizeof(TitleInput));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
104 pTuple->__size = XMMS_TITLEINPUT_SIZE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
105 pTuple->__version = XMMS_TITLEINPUT_VERSION;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
106
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
107 /* Create the input fields */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
108 pTuple->file_name = tmpFilename;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
109 pTuple->file_ext = tmpFileExt;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
110 pTuple->file_path = tmpFilePath;
618
ddae043e8e47 Remove Audacious related stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 611
diff changeset
111
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
112 pTuple->track_name = g_strdup(p->sidName);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
113 pTuple->track_number = subTune;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
114 pTuple->album_name = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
115 pTuple->performer = g_strdup(p->sidComposer);
961
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
116 pTuple->date = g_strdup_printf("%s%s%s",
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
117 xs_get_sidmodel(p->sidModel1),
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
118 (p->sidModel2 > XS_SIDMODEL_UNKNOWN) ? " + " : "",
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
119 (p->sidModel2 > XS_SIDMODEL_UNKNOWN) ? xs_get_sidmodel(p->sidModel2) : "");
618
ddae043e8e47 Remove Audacious related stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 611
diff changeset
120
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
121 pTuple->year = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
122 pTuple->genre = g_strdup("SID-tune");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
123 pTuple->comment = g_strdup(p->sidCopyright);
618
ddae043e8e47 Remove Audacious related stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 611
diff changeset
124
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
125 result = xmms_get_titlestring(xmms_get_gentitle_format(), pTuple);
541
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
126
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
127 g_free(pTuple->track_name);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
128 g_free(pTuple->album_name);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
129 g_free(pTuple->performer);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
130 g_free(pTuple->date);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
131 g_free(pTuple->genre);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
132 g_free(pTuple->comment);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
133 g_free(pTuple);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
134 } else
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
136 {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
137 /* Create the string */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
138 str = xs_cfg.titleFormat;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
139 index = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
140 while (*str && (index < XS_BUF_SIZE)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
141 if (*str == '%') {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
142 str++;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
143 switch (*str) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
144 case '%':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
145 VPUTCH('%');
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
146 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
147 case 'f':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
148 VPUTSTR(tmpFilename);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
149 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
150 case 'F':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
151 VPUTSTR(tmpFilePath);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
152 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
153 case 'e':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
154 VPUTSTR(tmpFileExt);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
155 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
156 case 'p':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
157 VPUTSTR(p->sidComposer);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
158 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
159 case 't':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
160 VPUTSTR(p->sidName);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
161 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
162 case 'c':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
163 VPUTSTR(p->sidCopyright);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
164 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
165 case 's':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
166 VPUTSTR(p->sidFormat);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
167 break;
961
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
168 case '1':
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
169 VPUTSTR(xs_get_sidmodel(p->sidModel1));
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
170 break;
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
171 case '2':
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
172 VPUTSTR(xs_get_sidmodel(p->sidModel2));
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
173 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
174 case 'm':
961
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
175 VPUTSTR(xs_get_sidmodel(p->sidModel1));
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
176 if (p->sidModel2 > XS_SIDMODEL_UNKNOWN)
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
177 {
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
178 VPUTSTR(" + ");
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
179 VPUTSTR(xs_get_sidmodel(p->sidModel2));
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
180 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
181 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
182 case 'C':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
183 if (subInfo && (subInfo->tuneSpeed > 0)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
184 switch (subInfo->tuneSpeed) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
185 case XS_CLOCK_PAL:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
186 VPUTSTR("PAL");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
187 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
188 case XS_CLOCK_NTSC:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
189 VPUTSTR("NTSC");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
190 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
191 case XS_CLOCK_ANY:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
192 VPUTSTR("ANY");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
193 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
194 case XS_CLOCK_VBI:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
195 VPUTSTR("VBI");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
196 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
197 case XS_CLOCK_CIA:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
198 VPUTSTR("CIA");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
199 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
200 default:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
201 g_snprintf(tmpStr, XS_BUF_SIZE,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
202 "%iHz", subInfo->tuneSpeed);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
203 VPUTSTR(tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
204 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
205 } else
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
206 VPUTSTR("?");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
207 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
208 case 'n':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
209 g_snprintf(tmpStr, XS_BUF_SIZE, "%i", subTune);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
210 VPUTSTR(tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
211 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
212 case 'N':
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
213 g_snprintf(tmpStr, XS_BUF_SIZE, "%i", p->nsubTunes);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
214 VPUTSTR(tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
215 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
216 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
217 } else
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
218 VPUTCH(*str);
498
9d5e04cd0c97 Remove useless block.
Matti Hamalainen <ccr@tnsp.org>
parents: 482
diff changeset
219
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
220 str++;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
221 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
222
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
223 tmpBuf[index] = 0;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
224
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
225 /* Make resulting string */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
226 result = g_strdup(tmpBuf);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
227 }
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
229 /* Free temporary strings */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
230 g_free(tmpFilename);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
231 g_free(tmpFilePath);
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
233 return result;
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 }