Codebase list granule / 67a5445
granule 1.2.0 Eric Dorland 18 years ago
70 changed file(s) with 3127 addition(s) and 1247 deletion(s). Raw diff Collapse all Expand all
0 Release 1.2.0
1 Nov 30 2005 Vladislav Grinchenko (vlg@users.sourceforge.net)
2 - Fix CardFile Save option greyed out bug (bug #1261317).
3 - Add an option to disable keyboard shortcuts in DeckPlayer.
4 - Add hours/minutes scheduling resolution (rfe #1256643).
5 - Make DeckView sortable by either Front or Back column (rfe #1348833).
6 - Add selection of the answer line for multiline front size of the
7 card in DeckPlayer dialog (used for studying multiple languages
8 in one Deck).
9 - Make CardView input dialog fully tabular.
10 - Add Pango markup shortcut controls to CardView dialog.
11 - Add Japanese translation by Jeff Ames (jeffames@users.sourceforge.net)
12 - Catch illegal pango markup and give the user a chance to fix it.
13 - Get rid of libxml++ dependency (uses basic libxml2 instead).
14 - Port to libassa-3.4.x.
15 - Port to cygwin32.
16 - Port to x86_ia64 - Konstantin Riabitsev (graf25@users.sourceforge.net)
17
018 Release 1.1.6
119 Jul 3 2005 Vladislav Grinchenko (vlg@users.sourceforge.net)
220 - Fix markup of multiple tildas in the Example field.
15001500
15011501
15021502 APP_MAJOR_VERSION=1
1503 APP_MINOR_VERSION=1
1504 APP_MICRO_VERSION=6
1503 APP_MINOR_VERSION=2
1504 APP_MICRO_VERSION=0
15051505
15061506 APP_VERSION=$APP_MAJOR_VERSION.$APP_MINOR_VERSION.$APP_MICRO_VERSION
15071507 APP_SUBVERSION=$APP_MAJOR_VERSION.$APP_MINOR_VERSION
2016420164 echo "${ECHO_T}yes" >&6
2016520165
2016620166
20167 ALL_LINGUAS="ru ru_RU bg"
20167 ALL_LINGUAS="ru bg de_DE ja_JP"
2016820168
2016920169
2017020170
2185921859 else
2186021860 PKG_CONFIG_MIN_VERSION=0.9.0
2186121861 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
21862 echo "$as_me:$LINENO: checking for libxml++-2.6 >= 0.26.0" >&5
21863 echo $ECHO_N "checking for libxml++-2.6 >= 0.26.0... $ECHO_C" >&6
21864
21865 if $PKG_CONFIG --exists "libxml++-2.6 >= 0.26.0" ; then
21862 echo "$as_me:$LINENO: checking for libxml-2.0 >= 2.6.16" >&5
21863 echo $ECHO_N "checking for libxml-2.0 >= 2.6.16... $ECHO_C" >&6
21864
21865 if $PKG_CONFIG --exists "libxml-2.0 >= 2.6.16" ; then
2186621866 echo "$as_me:$LINENO: result: yes" >&5
2186721867 echo "${ECHO_T}yes" >&6
2186821868 succeeded=yes
2186921869
2187021870 echo "$as_me:$LINENO: checking XMLCPP_CFLAGS" >&5
2187121871 echo $ECHO_N "checking XMLCPP_CFLAGS... $ECHO_C" >&6
21872 XMLCPP_CFLAGS=`$PKG_CONFIG --cflags "libxml++-2.6 >= 0.26.0"`
21872 XMLCPP_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= 2.6.16"`
2187321873 echo "$as_me:$LINENO: result: $XMLCPP_CFLAGS" >&5
2187421874 echo "${ECHO_T}$XMLCPP_CFLAGS" >&6
2187521875
2187621876 echo "$as_me:$LINENO: checking XMLCPP_LIBS" >&5
2187721877 echo $ECHO_N "checking XMLCPP_LIBS... $ECHO_C" >&6
21878 XMLCPP_LIBS=`$PKG_CONFIG --libs "libxml++-2.6 >= 0.26.0"`
21878 XMLCPP_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= 2.6.16"`
2187921879 echo "$as_me:$LINENO: result: $XMLCPP_LIBS" >&5
2188021880 echo "${ECHO_T}$XMLCPP_LIBS" >&6
2188121881 else
2188321883 XMLCPP_LIBS=""
2188421884 ## If we have a custom action on failure, don't print errors, but
2188521885 ## do set a variable so people can do so.
21886 XMLCPP_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libxml++-2.6 >= 0.26.0"`
21886 XMLCPP_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libxml-2.0 >= 2.6.16"`
2188721887 echo $XMLCPP_PKG_ERRORS
2188821888 fi
2188921889
2189821898 if test $succeeded = yes; then
2189921899 :
2190021900 else
21901 { { echo "$as_me:$LINENO: error: Library requirements (libxml++-2.6 >= 0.26.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
21902 echo "$as_me: error: Library requirements (libxml++-2.6 >= 0.26.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
21901 { { echo "$as_me:$LINENO: error: Library requirements (libxml-2.0 >= 2.6.16) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
21902 echo "$as_me: error: Library requirements (libxml-2.0 >= 2.6.16) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
2190321903 { (exit 1); exit 1; }; }
2190421904 fi
2190521905
2196121961 else
2196221962 PKG_CONFIG_MIN_VERSION=0.9.0
2196321963 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
21964 echo "$as_me:$LINENO: checking for assa >= 3.3.1" >&5
21965 echo $ECHO_N "checking for assa >= 3.3.1... $ECHO_C" >&6
21966
21967 if $PKG_CONFIG --exists "assa >= 3.3.1" ; then
21964 echo "$as_me:$LINENO: checking for assa-3.4 >= 3.4.0" >&5
21965 echo $ECHO_N "checking for assa-3.4 >= 3.4.0... $ECHO_C" >&6
21966
21967 if $PKG_CONFIG --exists "assa-3.4 >= 3.4.0" ; then
2196821968 echo "$as_me:$LINENO: result: yes" >&5
2196921969 echo "${ECHO_T}yes" >&6
2197021970 succeeded=yes
2197121971
2197221972 echo "$as_me:$LINENO: checking ASSA_CFLAGS" >&5
2197321973 echo $ECHO_N "checking ASSA_CFLAGS... $ECHO_C" >&6
21974 ASSA_CFLAGS=`$PKG_CONFIG --cflags "assa >= 3.3.1"`
21974 ASSA_CFLAGS=`$PKG_CONFIG --cflags "assa-3.4 >= 3.4.0"`
2197521975 echo "$as_me:$LINENO: result: $ASSA_CFLAGS" >&5
2197621976 echo "${ECHO_T}$ASSA_CFLAGS" >&6
2197721977
2197821978 echo "$as_me:$LINENO: checking ASSA_LIBS" >&5
2197921979 echo $ECHO_N "checking ASSA_LIBS... $ECHO_C" >&6
21980 ASSA_LIBS=`$PKG_CONFIG --libs "assa >= 3.3.1"`
21980 ASSA_LIBS=`$PKG_CONFIG --libs "assa-3.4 >= 3.4.0"`
2198121981 echo "$as_me:$LINENO: result: $ASSA_LIBS" >&5
2198221982 echo "${ECHO_T}$ASSA_LIBS" >&6
2198321983 else
2198521985 ASSA_LIBS=""
2198621986 ## If we have a custom action on failure, don't print errors, but
2198721987 ## do set a variable so people can do so.
21988 ASSA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "assa >= 3.3.1"`
21988 ASSA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "assa-3.4 >= 3.4.0"`
2198921989 echo $ASSA_PKG_ERRORS
2199021990 fi
2199121991
2200022000 if test $succeeded = yes; then
2200122001 :
2200222002 else
22003 { { echo "$as_me:$LINENO: error: Library requirements (assa >= 3.3.1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
22004 echo "$as_me: error: Library requirements (assa >= 3.3.1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
22003 { { echo "$as_me:$LINENO: error: Library requirements (assa-3.4 >= 3.4.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
22004 echo "$as_me: error: Library requirements (assa-3.4 >= 3.4.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
2200522005 { (exit 1); exit 1; }; }
2200622006 fi
2200722007
00 dnl ----------------------------------------------------------------------------
11 dnl configure.in
22 dnl
3 dnl $Id: configure.in,v 1.28 2005/07/06 02:52:23 vlg Exp $
3 dnl $Id: configure.in,v 1.32 2005/11/27 04:59:21 vlg Exp $
44 dnl ----------------------------------------------------------------------------
55
66 dnl Process this file with autoconf to produce a configure script.
2020 dnl ----------------------------------------------------------------------------
2121
2222 APP_MAJOR_VERSION=1
23 APP_MINOR_VERSION=1
24 APP_MICRO_VERSION=6
23 APP_MINOR_VERSION=2
24 APP_MICRO_VERSION=0
2525
2626 APP_VERSION=$APP_MAJOR_VERSION.$APP_MINOR_VERSION.$APP_MICRO_VERSION
2727 APP_SUBVERSION=$APP_MAJOR_VERSION.$APP_MINOR_VERSION
5757
5858 dnl ----------------------------------------------------------------------------
5959 dnl Set PACKAGE_LOCALE_DIR in config.h.
60 dnl
61 dnl The po files are in format LL_CC.po, where LL is the language code,
62 dnl and CC is the coutry code. Both 'ru' and 'ru_RU' woudl be valid names, but
63 dnl the latter is more narrowly defined.
64 dnl
65 dnl To enable locale, run LANG=ru_RU appname
6066 dnl ----------------------------------------------------------------------------
67 dnl
68 dnl
6169
62 ALL_LINGUAS="ru ru_RU bg"
70 ALL_LINGUAS="ru bg de_DE ja_JP"
6371
6472 AC_PROG_INTLTOOL([0.23])
6573 GETTEXT_PACKAGE=granule
100108 dnl Replace with the current version number
101109 dnl ----------------------------------------------------------------------------
102110
103 PKG_CHECK_MODULES(XMLCPP, libxml++-2.6 >= 0.26.0)
111 PKG_CHECK_MODULES(XMLCPP, libxml-2.0 >= 2.6.16)
104112 AC_SUBST(XMLCPP_CFLAGS)
105113 AC_SUBST(XMLCPP_LIBS)
106114
109117 dnl Replace with the current version number
110118 dnl ----------------------------------------------------------------------------
111119
112 PKG_CHECK_MODULES(ASSA, assa >= 3.3.1)
120 PKG_CHECK_MODULES(ASSA, assa-3.4 >= 3.4.0)
113121 AC_SUBST(ASSA_CFLAGS)
114122 AC_SUBST(ASSA_LIBS)
115123
0 granule (1.2.0-1) unstable; urgency=low
1
2 * New upstream release.
3 * debian/control: Use new libassa dev package.
4
5 -- Eric Dorland <eric@debian.org> Fri, 16 Dec 2005 20:58:59 -0500
6
07 granule (1.1.6-1) unstable; urgency=low
18
9 * Never uploaded.
210 * Initial release.
311
412 -- Eric Dorland <eric@debian.org> Thu, 7 Apr 2005 00:44:14 -0400
11 Section: games
22 Priority: optional
33 Maintainer: Eric Dorland <eric@debian.org>
4 Build-Depends: debhelper (>= 4.1), cdbs, libgtkmm-2.4-dev, libxml++2.6-dev, libassa0-dev, libxml-parser-perl
5 Standards-Version: 3.6.2.0
4 Build-Depends: debhelper (>= 4.1), cdbs, libgtkmm-2.4-dev, libxml++2.6-dev, libassa3.4-0-dev, libxml-parser-perl
5 Standards-Version: 3.6.2.1
66
77 Package: granule
88 Architecture: any
00 [options]
11 gtk_options="--disable-crash-dialog"
22 log_level=0
3 log_stdout=false
3 log_stdout="no"
44
55 [History]
66
2323 history_size=5
2424 root_x=521
2525 root_y=164
26 disable_key_shortcuts=false
2627
2728 [Scheduling]
28 1=4/0
29 2=0/1
30 3=0/2
31 4=0/3
32 5=0/4
29 1=0/4/0/0
30 2=1/0/0/0
31 3=2/0/0/0
32 4=3/0/0/0
33 5=4/0/0/0
44 #
55 # RPM format: name-version-release.rpm
66 #
7 # $Id: granule.spec.in,v 1.15 2005/07/06 02:52:23 vlg Exp $
7 # $Id: granule.spec.in,v 1.16 2005/11/13 02:50:47 vlg Exp $
88 #===============================================================================
99 %define debug_package %{nil}
1010
1111 %define name granule
12 %define ver 1.1.6
12 %define ver 1.2.0
1313
1414 %define rel 1
1515 %define disttag fc2
2424 Version: %ver
2525 Release: %{release}
2626 Source: %{name}-%{version}.tar.gz
27 Copyright: GPL
27 License: GPL
2828 Group: Applications
2929 Packager: Vladislav Grinchenko (vlg@users.sourceforge.net)
3030 Source: %{name}-%{version}.tar.gz
9797 #===============================================================================
9898
9999 %changelog
100 * Sun Nov 6 2005 Vladislav Grinchenko <vlg@users.sourceforge.net>
101 - Fixed License tag
102
100103 * Mon Jul 4 2005 Vladislav Grinchenko <vlg@users.sourceforge.net>
101104 - Changed XML dir.
102105
44 #
55 # RPM format: name-version-release.rpm
66 #
7 # $Id: granule.spec.in,v 1.15 2005/07/06 02:52:23 vlg Exp $
7 # $Id: granule.spec.in,v 1.16 2005/11/13 02:50:47 vlg Exp $
88 #===============================================================================
99 %define debug_package %{nil}
1010
2424 Version: %ver
2525 Release: %{release}
2626 Source: %{name}-%{version}.tar.gz
27 Copyright: GPL
27 License: GPL
2828 Group: Applications
2929 Packager: Vladislav Grinchenko (vlg@users.sourceforge.net)
3030 Source: %{name}-%{version}.tar.gz
9797 #===============================================================================
9898
9999 %changelog
100 * Sun Nov 6 2005 Vladislav Grinchenko <vlg@users.sourceforge.net>
101 - Fixed License tag
102
100103 * Mon Jul 4 2005 Vladislav Grinchenko <vlg@users.sourceforge.net>
101104 - Changed XML dir.
102105
0 # $Id: Makefile.am,v 1.6 2005/04/10 23:48:43 vlg Exp $
0 # $Id: Makefile.am,v 1.7 2005/11/14 04:12:14 vlg Exp $
11 #
22 # src/pixmaps/Makefile.am
33 #
44
55 pixmapdir = $(grappdatadir)/pixmaps
6
67 pixmap_DATA = drawer_empty.xpm drawer_many.xpm drawer_one.xpm \
78 sched_green.xpm sched_grey.xpm sched_red.xpm \
89 sched_yellow.xpm speaker_24.xpm copy_deck.xpm \
910 thumbdown.xpm thumbup.xpm \
10 cardview_32x32.png deckplayer_32x32.png deckview_32x32.png
11 cardview_32x32.png deckplayer_32x32.png deckview_32x32.png \
12 text_big.png text_block.png text_bold.png text_center.png \
13 text_color_background.png text_color_foreground.png \
14 text_color_hilight.png text_italic.png text_left.png \
15 text_monospaced.png text_remove_tags.png text_right.png \
16 text_small.png text_subscript.png text_superscript.png \
17 text_underlined.png
1118
1219 EXTRA_DIST = $(pixmap_DATA)
1320
1313
1414 @SET_MAKE@
1515
16 # $Id: Makefile.am,v 1.6 2005/04/10 23:48:43 vlg Exp $
16 # $Id: Makefile.am,v 1.7 2005/11/14 04:12:14 vlg Exp $
1717 #
1818 # src/pixmaps/Makefile.am
1919 #
206206 sched_green.xpm sched_grey.xpm sched_red.xpm \
207207 sched_yellow.xpm speaker_24.xpm copy_deck.xpm \
208208 thumbdown.xpm thumbup.xpm \
209 cardview_32x32.png deckplayer_32x32.png deckview_32x32.png
209 cardview_32x32.png deckplayer_32x32.png deckview_32x32.png \
210 text_big.png text_block.png text_bold.png text_center.png \
211 text_color_background.png text_color_foreground.png \
212 text_color_hilight.png text_italic.png text_left.png \
213 text_monospaced.png text_remove_tags.png text_right.png \
214 text_small.png text_subscript.png text_superscript.png \
215 text_underlined.png
210216
211217 EXTRA_DIST = $(pixmap_DATA)
212218 all: all-am
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
00 # List of source files containing translatable strings.
1 ./src/CSVImportDialog.cpp
12 ./src/CardBox.cpp
23 ./src/CardDeck.cpp
34 ./src/CardView.cpp
5 ./src/Deck.cpp
46 ./src/DeckPlayer.cpp
7 ./src/GeneralPref.cpp
58 ./src/MainWindow.cpp
69
10
11
Binary diff not shown
44 # , fuzzy
55 #
66 #
7 #: src/CSVImportDialog.cpp:74
78 msgid ""
89 msgstr ""
910 "Project-Id-Version: granule\n"
1011 "Report-Msgid-Bugs-To: \n"
11 "POT-Creation-Date: 2005-07-12 22:08-0400\n"
12 "POT-Creation-Date: 2005-11-27 18:53-0500\n"
1213 "PO-Revision-Date: 2005-04-13 18:23+0300\n"
1314 "Last-Translator: Rostislav \"zbrox\" Raykov <zbrox@i-space.org>\n"
1415 "Language-Team: Bulgarian <dict@linux.zonebg.com>\n"
1617 "Content-Type: text/plain; charset=UTF-8\n"
1718 "Content-Transfer-Encoding: 8bit\n"
1819
20 #: src/CSVImportDialog.cpp:57 src/CardView.cpp:119
21 msgid "Cancel"
22 msgstr "?????"
23
24 #: src/CSVImportDialog.cpp:64
25 msgid "Import"
26 msgstr ""
27
28 #: src/CSVImportDialog.cpp:69
29 msgid "Line Break:"
30 msgstr ""
31
32 #: src/CSVImportDialog.cpp:70
33 msgid "UNIX (LF)"
34 msgstr ""
35
36 #: src/CSVImportDialog.cpp:71
37 msgid "Windows (CR+LF)"
38 msgstr ""
39
40 #: src/CSVImportDialog.cpp:76
41 msgid "Space"
42 msgstr ""
43
44 #: src/CSVImportDialog.cpp:77
45 msgid "Tab"
46 msgstr ""
47
48 #: src/CSVImportDialog.cpp:78
49 msgid "Semicolon (;)"
50 msgstr ""
51
52 #: src/CSVImportDialog.cpp:79
53 msgid "Colon (:)"
54 msgstr ""
55
56 #: src/CSVImportDialog.cpp:81
57 msgid "Comma (,)"
58 msgstr ""
59
60 #: src/CSVImportDialog.cpp:85
61 msgid "Separators"
62 msgstr ""
63
64 #: src/CSVImportDialog.cpp:88
65 msgid "See two separators as one"
66 msgstr ""
67
68 #: src/CSVImportDialog.cpp:214
69 msgid "CSV Text Import"
70 msgstr ""
71
1972 #: src/CardBox.cpp:184
2073 msgid "0 cards"
2174 msgstr "0 ?????"
2275
23 #: src/CardBox.cpp:311
76 #: src/CardBox.cpp:325
2477 msgid ""
2578 "Failed to parse file\n"
2679 " "
2881 "??????? ??? ??????????? ?? ????\n"
2982 "..."
3083
31 #: src/CardBox.cpp:312
84 #: src/CardBox.cpp:326
3285 msgid ""
3386 "\n"
3487 "Reason: invalid file syntax/DTD"
3689 "\n"
3790 "???????: ????????? ?????? ?????????/DTD"
3891
39 #: src/CardBox.cpp:499
92 #: src/CardBox.cpp:539
4093 msgid "File \n"
4194 msgstr "???? \n"
4295
43 #: src/CardBox.cpp:500
96 #: src/CardBox.cpp:540
4497 msgid ""
4598 "\n"
4699 "already exists.\n"
50103 "???? ??????????.\n"
51104 "??????? ?? ????? ?? ?? ?????????"
52105
53 #: src/CardBox.cpp:507 src/CardBox.cpp:775 src/DeckPlayer.cpp:886
106 #: src/CardBox.cpp:547 src/CardBox.cpp:815 src/DeckPlayer.cpp:988
54107 msgid "Yes"
55108 msgstr "??"
56109
57 #: src/CardBox.cpp:508 src/CardBox.cpp:776 src/DeckPlayer.cpp:887
110 #: src/CardBox.cpp:548 src/CardBox.cpp:816 src/DeckPlayer.cpp:989
58111 msgid "No"
59112 msgstr "??"
60113
61 #: src/CardBox.cpp:543
114 #: src/CardBox.cpp:583
62115 msgid "Trying to access index out of range!"
63116 msgstr ""
64117
65 #: src/CardBox.cpp:554
118 #: src/CardBox.cpp:594
66119 msgid "Card Deck you've selected is empty"
67120 msgstr "??????? ?????, ????? ??? ??????? ? ??????"
68121
69 #: src/CardBox.cpp:573
122 #: src/CardBox.cpp:613
70123 msgid ""
71124 "First, open or create\n"
72125 "a Card Box file."
74127 "????? ???????? ??? ????????\n"
75128 "???? ?? ????? ?? ?????."
76129
77 #: src/CardBox.cpp:612
130 #: src/CardBox.cpp:652
78131 msgid "First, open or create a Card File."
79132 msgstr "????? ???????? ??? ???????? ???? ?? ?????."
80133
81 #: src/CardBox.cpp:656
134 #: src/CardBox.cpp:696
82135 msgid ""
83136 "You have learnt all\n"
84137 "expired cards in this deck."
86139 "???????? ?????? ?????\n"
87140 "? ??????? ???? ? ???? ?????."
88141
89 #: src/CardBox.cpp:689
142 #: src/CardBox.cpp:729
90143 msgid ""
91144 "First Open or Create\n"
92145 "a New Card File!"
94147 "????? ???????? ??? ????????\n"
95148 "??? ???? ?? ?????!"
96149
97 #: src/CardDeck.cpp:25
150 #: src/CardDeck.cpp:26
98151 msgid "Card Box 1"
99152 msgstr "????? ?? ????? 1"
100153
101 #: src/CardDeck.cpp:25
154 #: src/CardDeck.cpp:26
102155 msgid "Card Box 2"
103156 msgstr "????? ?? ????? 2"
104157
105 #: src/CardDeck.cpp:26
158 #: src/CardDeck.cpp:27
106159 msgid "Card Box 3"
107160 msgstr "????? ?? ????? 3"
108161
109 #: src/CardDeck.cpp:26
162 #: src/CardDeck.cpp:27
110163 msgid "Card Box 4"
111164 msgstr "????? ?? ????? 4"
112165
113 #: src/CardDeck.cpp:27
166 #: src/CardDeck.cpp:28
114167 msgid "Card Box 5"
115168 msgstr "????? ?? ????? 5"
116169
117 #: src/CardView.cpp:109
170 #: src/CardView.cpp:111
118171 msgid "Clear"
119172 msgstr "??????????"
120173
121 #: src/CardView.cpp:117
122 msgid "Cancel"
123 msgstr "?????"
124
125 #: src/CardView.cpp:126
174 #: src/CardView.cpp:128
126175 msgid "Add"
127176 msgstr ""
128177
129 #: src/CardView.cpp:135
178 #: src/CardView.cpp:137
130179 msgid "Ok"
131180 msgstr "?????"
132181
133 #: src/CardView.cpp:144
182 #: src/CardView.cpp:146
134183 msgid "Help"
135184 msgstr ""
136185
137 #: src/CardView.cpp:153
186 #: src/CardView.cpp:155
138187 msgid "Front : "
139188 msgstr "???? : "
140189
141 #: src/CardView.cpp:159
190 #: src/CardView.cpp:161
142191 msgid "Back :"
143192 msgstr "???? : "
144193
145 #: src/CardView.cpp:165
194 #: src/CardView.cpp:167
146195 msgid "Example : "
147196 msgstr "?????? : "
148197
149 #: src/CardView.cpp:266
198 #: src/CardView.cpp:269
150199 msgid "Fill up the back of the card"
151200 msgstr "????????? ????? ?? ???????"
152201
153 #: src/CardView.cpp:297
202 #: src/CardView.cpp:301
154203 msgid "Fill up an example"
155204 msgstr "????????? ?????? ?? ???????"
156205
157 #: src/CardView.cpp:327
206 #: src/CardView.cpp:353
158207 msgid "Fill up the front of the card"
159208 msgstr "????????? ?????? ?? ???????"
160209
161 #: src/CardView.cpp:544
210 #: src/CardView.cpp:591
162211 msgid "FRONT field contains illegal markup tag(s)."
163212 msgstr "?????? ?? ??????? ??????? ?????????/?? ???/???."
164213
165 #: src/CardView.cpp:551
214 #: src/CardView.cpp:600
166215 msgid "BACK field contains illegal markup tag(s)."
167216 msgstr "????? ?? ??????? ??????? ?????????/?? ???/???."
168217
169 #: src/CardView.cpp:558
218 #: src/CardView.cpp:609
170219 msgid "EXAMPLE field contains illegal markup tag(s)."
171220 msgstr "?????? ?? ??????? ??????? ?????????/?? ???/???."
172221
173 #: src/DeckPlayer.cpp:51
222 #: src/Deck.cpp:310
223 msgid ""
224 "Failed to open import file.\n"
225 "Check file permissions."
226 msgstr ""
227
228 #: src/DeckPlayer.cpp:55
174229 msgid "Check"
175230 msgstr "????????"
176231
177 #: src/DeckPlayer.cpp:51
232 #: src/DeckPlayer.cpp:55
178233 msgid "Next "
179234 msgstr "????????"
180235
181 #: src/DeckPlayer.cpp:51
236 #: src/DeckPlayer.cpp:55
182237 msgid "Correct "
183238 msgstr "?????!"
184239
185 #: src/DeckPlayer.cpp:51
240 #: src/DeckPlayer.cpp:55
186241 msgid "Incorrect"
187242 msgstr "??????!"
188243
189 #: src/DeckPlayer.cpp:279
244 #: src/DeckPlayer.cpp:319
190245 msgid "Close"
191246 msgstr "?????????"
192247
193 #: src/DeckPlayer.cpp:281
248 #: src/DeckPlayer.cpp:321
194249 msgid "Shuffle"
195250 msgstr "???????????"
196251
197 #: src/DeckPlayer.cpp:284
252 #: src/DeckPlayer.cpp:324
198253 msgid "View/Edit Deck"
199254 msgstr "???????/???????? ?? ???????"
200255
201 #: src/DeckPlayer.cpp:286
256 #: src/DeckPlayer.cpp:326
202257 msgid "Edit Card"
203258 msgstr "??????????? ?? ?????"
204259
205 #: src/DeckPlayer.cpp:881
260 #: src/DeckPlayer.cpp:412
261 #, fuzzy
262 msgid "Front"
263 msgstr "???? : "
264
265 #: src/DeckPlayer.cpp:444
266 #, fuzzy
267 msgid "Back"
268 msgstr "???? : "
269
270 #: src/DeckPlayer.cpp:458
271 msgid "Ask front"
272 msgstr ""
273
274 #: src/DeckPlayer.cpp:464
275 msgid "Ask back"
276 msgstr ""
277
278 #: src/DeckPlayer.cpp:475
279 msgid "Test line: "
280 msgstr ""
281
282 #: src/DeckPlayer.cpp:537
283 msgid "Say It!"
284 msgstr ""
285
286 #: src/DeckPlayer.cpp:547
287 msgid "I know it!"
288 msgstr ""
289
290 #: src/DeckPlayer.cpp:557
291 msgid "No clue"
292 msgstr ""
293
294 #: src/DeckPlayer.cpp:724
295 msgid ""
296 "The card you are about to see has invalid markup.\n"
297 "To proceed further, first, fix the broken markup.\n"
298 "If unsure about the correct syntax, consult Help."
299 msgstr ""
300
301 #: src/DeckPlayer.cpp:983
206302 msgid ""
207303 "Would you like to make cards\n"
208304 "order changes permanent?"
210306 "??????? ?? ????????? ? ???? ?? ???????\n"
211307 "?? ????? ???????? ?? ??????????"
212308
213 #: src/DeckPlayer.cpp:960
309 #: src/DeckPlayer.cpp:1062
214310 msgid "The deck is empty!"
215311 msgstr "??????? ? ??????!"
312
313 #: src/GeneralPref.cpp:112
314 msgid ""
315 "Remove duplicates when inserting new\n"
316 "cards from a Deck to the CardBox"
317 msgstr ""
318
319 #: src/GeneralPref.cpp:118
320 msgid "Record all dynamic links in CardFile as relative paths"
321 msgstr ""
322
323 #: src/GeneralPref.cpp:124
324 msgid ""
325 "Some keyboard input methods may conflict with keyboard\n"
326 "shortcuts. If checked, disable all shortcuts in DeckPlayer\n"
327 "dialog (requires restart)."
328 msgstr ""
216329
217330 #: src/MainWindow.cpp:95
218331 msgid "CardBox"
250363 "???????? ? ???????.\n"
251364 "????? ?? ?????????."
252365
253 #: src/MainWindow.cpp:327 src/MainWindow.cpp:362
366 #: src/MainWindow.cpp:327 src/MainWindow.cpp:364
254367 msgid ""
255368 "Please open or create\n"
256369 "project first"
262375 "Close it to proceed."
263376 msgstr "???????? ?? ? ????????.??????????? ??, ?? ?? ??????????."
264377
265 #: src/MainWindow.cpp:499
378 #: src/MainWindow.cpp:504
266379 msgid "Choose New CardFile name"
267380 msgstr "???????? ???? ??? ?? ????? ?? ?????"
268381
269 #: src/MainWindow.cpp:539
382 #: src/MainWindow.cpp:544
270383 msgid "Save Card File As ..."
271384 msgstr "????????? ?? ???? ?? ????? ????..."
Binary diff not shown
0 # German translation of Granule.
1 # Copyright (C) 2005 THE Granule'S COPYRIGHT HOLDER
2 # This file is distributed under the same license as the Granule package.
3 # arzed <ladoo@gmx.at>, 2005.
4 # , fuzzy
5 #
6 #
7 #: src/CSVImportDialog.cpp:74
8 msgid ""
9 msgstr ""
10 "Project-Id-Version: Granule 1.1.6\n"
11 "Report-Msgid-Bugs-To: \n"
12 "POT-Creation-Date: 2005-11-27 18:53-0500\n"
13 "PO-Revision-Date: 2005-09-23 11:12+0200\n"
14 "Last-Translator: arzed <ladoo@gmx.at>\n"
15 "Language-Team: German\n"
16 "MIME-Version: 1.0\n"
17 "Content-Type: text/plain; charset=UTF-8\n"
18 "Content-Transfer-Encoding: 8bit\n"
19
20 #: src/CSVImportDialog.cpp:57 src/CardView.cpp:119
21 msgid "Cancel"
22 msgstr "Abbrechen"
23
24 #: src/CSVImportDialog.cpp:64
25 msgid "Import"
26 msgstr ""
27
28 #: src/CSVImportDialog.cpp:69
29 msgid "Line Break:"
30 msgstr ""
31
32 #: src/CSVImportDialog.cpp:70
33 msgid "UNIX (LF)"
34 msgstr ""
35
36 #: src/CSVImportDialog.cpp:71
37 msgid "Windows (CR+LF)"
38 msgstr ""
39
40 #: src/CSVImportDialog.cpp:76
41 msgid "Space"
42 msgstr ""
43
44 #: src/CSVImportDialog.cpp:77
45 msgid "Tab"
46 msgstr ""
47
48 #: src/CSVImportDialog.cpp:78
49 msgid "Semicolon (;)"
50 msgstr ""
51
52 #: src/CSVImportDialog.cpp:79
53 msgid "Colon (:)"
54 msgstr ""
55
56 #: src/CSVImportDialog.cpp:81
57 msgid "Comma (,)"
58 msgstr ""
59
60 #: src/CSVImportDialog.cpp:85
61 msgid "Separators"
62 msgstr ""
63
64 #: src/CSVImportDialog.cpp:88
65 msgid "See two separators as one"
66 msgstr ""
67
68 #: src/CSVImportDialog.cpp:214
69 msgid "CSV Text Import"
70 msgstr ""
71
72 #: src/CardBox.cpp:184
73 msgid "0 cards"
74 msgstr "0 Karten"
75
76 #: src/CardBox.cpp:325
77 msgid ""
78 "Failed to parse file\n"
79 " "
80 msgstr ""
81 "Einlesen der Datei fehlgeschlagen\n"
82 " "
83
84 #: src/CardBox.cpp:326
85 msgid ""
86 "\n"
87 "Reason: invalid file syntax/DTD"
88 msgstr ""
89 "\n"
90 "Ursache: Datei ist nicht konform (DTD)"
91
92 #: src/CardBox.cpp:539
93 msgid "File \n"
94 msgstr "Datei \n"
95
96 #: src/CardBox.cpp:540
97 msgid ""
98 "\n"
99 "already exists.\n"
100 "Would you like to delete it first?"
101 msgstr ""
102 "\n"
103 "existiert bereits.\n"
104 "Möchten Sie sie zuerst löschen?"
105
106 #: src/CardBox.cpp:547 src/CardBox.cpp:815 src/DeckPlayer.cpp:988
107 msgid "Yes"
108 msgstr "Ja"
109
110 #: src/CardBox.cpp:548 src/CardBox.cpp:816 src/DeckPlayer.cpp:989
111 msgid "No"
112 msgstr "Nein"
113
114 #: src/CardBox.cpp:583
115 msgid "Trying to access index out of range!"
116 msgstr ""
117 "Versuche auf einen Index außerhalb des Gültigkeitsbereiches zuzugreifen!"
118
119 #: src/CardBox.cpp:594
120 msgid "Card Deck you've selected is empty"
121 msgstr "Das ausgewählte Deck ist leer"
122
123 #: src/CardBox.cpp:613
124 msgid ""
125 "First, open or create\n"
126 "a Card Box file."
127 msgstr ""
128 "Öffnen oder erstellen Sie erst\n"
129 "eine neue Kartei."
130
131 #: src/CardBox.cpp:652
132 msgid "First, open or create a Card File."
133 msgstr "Erstellen oder öffnen sie zuerst eine Kartei."
134
135 #: src/CardBox.cpp:696
136 msgid ""
137 "You have learnt all\n"
138 "expired cards in this deck."
139 msgstr ""
140 "Sie haben alle abgelaufenen Karten\n"
141 "in diesem Karteikasten gelernt."
142
143 #: src/CardBox.cpp:729
144 msgid ""
145 "First Open or Create\n"
146 "a New Card File!"
147 msgstr ""
148 "Öffnen oder erstellen Sie\n"
149 "erst eine neue Kartei!"
150
151 #: src/CardDeck.cpp:26
152 msgid "Card Box 1"
153 msgstr "Kartei 1"
154
155 #: src/CardDeck.cpp:26
156 msgid "Card Box 2"
157 msgstr "Kartei 2"
158
159 #: src/CardDeck.cpp:27
160 msgid "Card Box 3"
161 msgstr "Kartei 3"
162
163 #: src/CardDeck.cpp:27
164 msgid "Card Box 4"
165 msgstr "Kartei 4"
166
167 #: src/CardDeck.cpp:28
168 msgid "Card Box 5"
169 msgstr "Kartei 5"
170
171 #: src/CardView.cpp:111
172 msgid "Clear"
173 msgstr "Löschen"
174
175 #: src/CardView.cpp:128
176 msgid "Add"
177 msgstr "Hinzufügen"
178
179 #: src/CardView.cpp:137
180 msgid "Ok"
181 msgstr "Ok"
182
183 #: src/CardView.cpp:146
184 msgid "Help"
185 msgstr "Hilfe"
186
187 #: src/CardView.cpp:155
188 msgid "Front : "
189 msgstr "Vorderseite : "
190
191 #: src/CardView.cpp:161
192 msgid "Back :"
193 msgstr "Rückseite : "
194
195 #: src/CardView.cpp:167
196 msgid "Example : "
197 msgstr "Beispiel : "
198
199 #: src/CardView.cpp:269
200 msgid "Fill up the back of the card"
201 msgstr "Beschreiben Sie die Kartenrückseite"
202
203 #: src/CardView.cpp:301
204 msgid "Fill up an example"
205 msgstr "Geben sie ein Beispiel"
206
207 #: src/CardView.cpp:353
208 msgid "Fill up the front of the card"
209 msgstr "Beschreiben Sie die Kartenvorderseite"
210
211 #: src/CardView.cpp:591
212 msgid "FRONT field contains illegal markup tag(s)."
213 msgstr "Vorderseite beinhaltet ungültige markup tags."
214
215 #: src/CardView.cpp:600
216 msgid "BACK field contains illegal markup tag(s)."
217 msgstr "Rückseite beinhaltet ungültige markup tags."
218
219 #: src/CardView.cpp:609
220 msgid "EXAMPLE field contains illegal markup tag(s)."
221 msgstr "Das Beispiel enthält ungültige markup tags."
222
223 #: src/Deck.cpp:310
224 msgid ""
225 "Failed to open import file.\n"
226 "Check file permissions."
227 msgstr ""
228
229 #: src/DeckPlayer.cpp:55
230 msgid "Check"
231 msgstr "Überprüfen"
232
233 #: src/DeckPlayer.cpp:55
234 msgid "Next "
235 msgstr "Nächste "
236
237 #: src/DeckPlayer.cpp:55
238 msgid "Correct "
239 msgstr "Richtig "
240
241 #: src/DeckPlayer.cpp:55
242 msgid "Incorrect"
243 msgstr "Falsch "
244
245 #: src/DeckPlayer.cpp:319
246 msgid "Close"
247 msgstr "schließen"
248
249 #: src/DeckPlayer.cpp:321
250 msgid "Shuffle"
251 msgstr "mischen"
252
253 #: src/DeckPlayer.cpp:324
254 msgid "View/Edit Deck"
255 msgstr "Deck ansehen/editieren"
256
257 #: src/DeckPlayer.cpp:326
258 msgid "Edit Card"
259 msgstr "Karte bearbeiten"
260
261 #: src/DeckPlayer.cpp:412
262 #, fuzzy
263 msgid "Front"
264 msgstr "Vorderseite : "
265
266 #: src/DeckPlayer.cpp:444
267 #, fuzzy
268 msgid "Back"
269 msgstr "Rückseite : "
270
271 #: src/DeckPlayer.cpp:458
272 msgid "Ask front"
273 msgstr ""
274
275 #: src/DeckPlayer.cpp:464
276 msgid "Ask back"
277 msgstr ""
278
279 #: src/DeckPlayer.cpp:475
280 msgid "Test line: "
281 msgstr ""
282
283 #: src/DeckPlayer.cpp:537
284 msgid "Say It!"
285 msgstr ""
286
287 #: src/DeckPlayer.cpp:547
288 msgid "I know it!"
289 msgstr ""
290
291 #: src/DeckPlayer.cpp:557
292 msgid "No clue"
293 msgstr ""
294
295 #: src/DeckPlayer.cpp:724
296 msgid ""
297 "The card you are about to see has invalid markup.\n"
298 "To proceed further, first, fix the broken markup.\n"
299 "If unsure about the correct syntax, consult Help."
300 msgstr ""
301
302 #: src/DeckPlayer.cpp:983
303 msgid ""
304 "Would you like to make cards\n"
305 "order changes permanent?"
306 msgstr ""
307 "Wollen sie die Veränderungen der\n"
308 "Karteinreihenfolge speichern?"
309
310 #: src/DeckPlayer.cpp:1062
311 msgid "The deck is empty!"
312 msgstr "Das Deck ist leer!"
313
314 #: src/GeneralPref.cpp:112
315 msgid ""
316 "Remove duplicates when inserting new\n"
317 "cards from a Deck to the CardBox"
318 msgstr ""
319
320 #: src/GeneralPref.cpp:118
321 msgid "Record all dynamic links in CardFile as relative paths"
322 msgstr ""
323
324 #: src/GeneralPref.cpp:124
325 msgid ""
326 "Some keyboard input methods may conflict with keyboard\n"
327 "shortcuts. If checked, disable all shortcuts in DeckPlayer\n"
328 "dialog (requires restart)."
329 msgstr ""
330
331 #: src/MainWindow.cpp:95
332 msgid "CardBox"
333 msgstr "Kartei"
334
335 #: src/MainWindow.cpp:212 src/MainWindow.cpp:300
336 msgid ""
337 "Project has been modified.\n"
338 "Please, save and close it first"
339 msgstr ""
340 "Das Projekt wurde verändert.\n"
341 "Bitte speichern und schließen Sie es erst"
342
343 #: src/MainWindow.cpp:220 src/MainWindow.cpp:308
344 msgid ""
345 "Project is opened.\n"
346 "Please, close it first"
347 msgstr ""
348 "Ein Projekt ist offen.\n"
349 "Bitte schließen Sie es zuerst"
350
351 #: src/MainWindow.cpp:251
352 msgid ""
353 "Project has been modified\n"
354 "Please, save and close it first"
355 msgstr ""
356 "Das Projekt wurde verändert.\n"
357 "Bitte speichern und schließen Sie es erst"
358
359 #: src/MainWindow.cpp:260
360 msgid ""
361 "Project is opened\n"
362 "Please, close it first"
363 msgstr ""
364 "Ein Projekt ist geöffnet\n"
365 "Bitte, schließen Sie es erst"
366
367 #: src/MainWindow.cpp:327 src/MainWindow.cpp:364
368 msgid ""
369 "Please open or create\n"
370 "project first"
371 msgstr ""
372 "Bitte öffnen oder erstellen\n"
373 "Sie zuerst ein Projekt."
374
375 #: src/MainWindow.cpp:342
376 msgid ""
377 "Project is not modified.\n"
378 "Close it to proceed."
379 msgstr ""
380 "Das Projekt ist unverändert.\n"
381 "Schließen Sie es um fortzufahren."
382
383 #: src/MainWindow.cpp:504
384 msgid "Choose New CardFile name"
385 msgstr ""
386 "Wählen Sie einen neuen\n"
387 "Dateinamen für das Deck"
388
389 #: src/MainWindow.cpp:544
390 msgid "Save Card File As ..."
391 msgstr "Deck speichern unter ..."
22 # This file is distributed under the same license as the PACKAGE package.
33 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
44 #
5 #: src/CSVImportDialog.cpp:74
56 #, fuzzy
67 msgid ""
78 msgstr ""
89 "Project-Id-Version: PACKAGE VERSION\n"
910 "Report-Msgid-Bugs-To: \n"
10 "POT-Creation-Date: 2005-07-12 22:08-0400\n"
11 "POT-Creation-Date: 2005-11-27 18:53-0500\n"
1112 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1213 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1314 "Language-Team: LANGUAGE <LL@li.org>\n"
1516 "Content-Type: text/plain; charset=CHARSET\n"
1617 "Content-Transfer-Encoding: 8bit\n"
1718
19 #: src/CSVImportDialog.cpp:57 src/CardView.cpp:119
20 msgid "Cancel"
21 msgstr ""
22
23 #: src/CSVImportDialog.cpp:64
24 msgid "Import"
25 msgstr ""
26
27 #: src/CSVImportDialog.cpp:69
28 msgid "Line Break:"
29 msgstr ""
30
31 #: src/CSVImportDialog.cpp:70
32 msgid "UNIX (LF)"
33 msgstr ""
34
35 #: src/CSVImportDialog.cpp:71
36 msgid "Windows (CR+LF)"
37 msgstr ""
38
39 #: src/CSVImportDialog.cpp:76
40 msgid "Space"
41 msgstr ""
42
43 #: src/CSVImportDialog.cpp:77
44 msgid "Tab"
45 msgstr ""
46
47 #: src/CSVImportDialog.cpp:78
48 msgid "Semicolon (;)"
49 msgstr ""
50
51 #: src/CSVImportDialog.cpp:79
52 msgid "Colon (:)"
53 msgstr ""
54
55 #: src/CSVImportDialog.cpp:81
56 msgid "Comma (,)"
57 msgstr ""
58
59 #: src/CSVImportDialog.cpp:85
60 msgid "Separators"
61 msgstr ""
62
63 #: src/CSVImportDialog.cpp:88
64 msgid "See two separators as one"
65 msgstr ""
66
67 #: src/CSVImportDialog.cpp:214
68 msgid "CSV Text Import"
69 msgstr ""
70
1871 #: src/CardBox.cpp:184
1972 msgid "0 cards"
2073 msgstr ""
2174
22 #: src/CardBox.cpp:311
75 #: src/CardBox.cpp:325
2376 msgid ""
2477 "Failed to parse file\n"
2578 " "
2679 msgstr ""
2780
28 #: src/CardBox.cpp:312
81 #: src/CardBox.cpp:326
2982 msgid ""
3083 "\n"
3184 "Reason: invalid file syntax/DTD"
3285 msgstr ""
3386
34 #: src/CardBox.cpp:499
87 #: src/CardBox.cpp:539
3588 msgid "File \n"
3689 msgstr ""
3790
38 #: src/CardBox.cpp:500
91 #: src/CardBox.cpp:540
3992 msgid ""
4093 "\n"
4194 "already exists.\n"
4295 "Would you like to delete it first?"
4396 msgstr ""
4497
45 #: src/CardBox.cpp:507 src/CardBox.cpp:775 src/DeckPlayer.cpp:886
98 #: src/CardBox.cpp:547 src/CardBox.cpp:815 src/DeckPlayer.cpp:988
4699 msgid "Yes"
47100 msgstr ""
48101
49 #: src/CardBox.cpp:508 src/CardBox.cpp:776 src/DeckPlayer.cpp:887
102 #: src/CardBox.cpp:548 src/CardBox.cpp:816 src/DeckPlayer.cpp:989
50103 msgid "No"
51104 msgstr ""
52105
53 #: src/CardBox.cpp:543
106 #: src/CardBox.cpp:583
54107 msgid "Trying to access index out of range!"
55108 msgstr ""
56109
57 #: src/CardBox.cpp:554
110 #: src/CardBox.cpp:594
58111 msgid "Card Deck you've selected is empty"
59112 msgstr ""
60113
61 #: src/CardBox.cpp:573
114 #: src/CardBox.cpp:613
62115 msgid ""
63116 "First, open or create\n"
64117 "a Card Box file."
65118 msgstr ""
66119
67 #: src/CardBox.cpp:612
120 #: src/CardBox.cpp:652
68121 msgid "First, open or create a Card File."
69122 msgstr ""
70123
71 #: src/CardBox.cpp:656
124 #: src/CardBox.cpp:696
72125 msgid ""
73126 "You have learnt all\n"
74127 "expired cards in this deck."
75128 msgstr ""
76129
77 #: src/CardBox.cpp:689
130 #: src/CardBox.cpp:729
78131 msgid ""
79132 "First Open or Create\n"
80133 "a New Card File!"
81134 msgstr ""
82135
83 #: src/CardDeck.cpp:25
136 #: src/CardDeck.cpp:26
84137 msgid "Card Box 1"
85138 msgstr ""
86139
87 #: src/CardDeck.cpp:25
140 #: src/CardDeck.cpp:26
88141 msgid "Card Box 2"
89142 msgstr ""
90143
91 #: src/CardDeck.cpp:26
144 #: src/CardDeck.cpp:27
92145 msgid "Card Box 3"
93146 msgstr ""
94147
95 #: src/CardDeck.cpp:26
148 #: src/CardDeck.cpp:27
96149 msgid "Card Box 4"
97150 msgstr ""
98151
99 #: src/CardDeck.cpp:27
152 #: src/CardDeck.cpp:28
100153 msgid "Card Box 5"
101154 msgstr ""
102155
103 #: src/CardView.cpp:109
156 #: src/CardView.cpp:111
104157 msgid "Clear"
105158 msgstr ""
106159
107 #: src/CardView.cpp:117
108 msgid "Cancel"
109 msgstr ""
110
111 #: src/CardView.cpp:126
160 #: src/CardView.cpp:128
112161 msgid "Add"
113162 msgstr ""
114163
115 #: src/CardView.cpp:135
164 #: src/CardView.cpp:137
116165 msgid "Ok"
117166 msgstr ""
118167
119 #: src/CardView.cpp:144
168 #: src/CardView.cpp:146
120169 msgid "Help"
121170 msgstr ""
122171
123 #: src/CardView.cpp:153
172 #: src/CardView.cpp:155
124173 msgid "Front : "
125174 msgstr ""
126175
127 #: src/CardView.cpp:159
176 #: src/CardView.cpp:161
128177 msgid "Back :"
129178 msgstr ""
130179
131 #: src/CardView.cpp:165
180 #: src/CardView.cpp:167
132181 msgid "Example : "
133182 msgstr ""
134183
135 #: src/CardView.cpp:266
184 #: src/CardView.cpp:269
136185 msgid "Fill up the back of the card"
137186 msgstr ""
138187
139 #: src/CardView.cpp:297
188 #: src/CardView.cpp:301
140189 msgid "Fill up an example"
141190 msgstr ""
142191
143 #: src/CardView.cpp:327
192 #: src/CardView.cpp:353
144193 msgid "Fill up the front of the card"
145194 msgstr ""
146195
147 #: src/CardView.cpp:544
196 #: src/CardView.cpp:591
148197 msgid "FRONT field contains illegal markup tag(s)."
149198 msgstr ""
150199
151 #: src/CardView.cpp:551
200 #: src/CardView.cpp:600
152201 msgid "BACK field contains illegal markup tag(s)."
153202 msgstr ""
154203
155 #: src/CardView.cpp:558
204 #: src/CardView.cpp:609
156205 msgid "EXAMPLE field contains illegal markup tag(s)."
157206 msgstr ""
158207
159 #: src/DeckPlayer.cpp:51
208 #: src/Deck.cpp:310
209 msgid ""
210 "Failed to open import file.\n"
211 "Check file permissions."
212 msgstr ""
213
214 #: src/DeckPlayer.cpp:55
160215 msgid "Check"
161216 msgstr ""
162217
163 #: src/DeckPlayer.cpp:51
218 #: src/DeckPlayer.cpp:55
164219 msgid "Next "
165220 msgstr ""
166221
167 #: src/DeckPlayer.cpp:51
222 #: src/DeckPlayer.cpp:55
168223 msgid "Correct "
169224 msgstr ""
170225
171 #: src/DeckPlayer.cpp:51
226 #: src/DeckPlayer.cpp:55
172227 msgid "Incorrect"
173228 msgstr ""
174229
175 #: src/DeckPlayer.cpp:279
230 #: src/DeckPlayer.cpp:319
176231 msgid "Close"
177232 msgstr ""
178233
179 #: src/DeckPlayer.cpp:281
234 #: src/DeckPlayer.cpp:321
180235 msgid "Shuffle"
181236 msgstr ""
182237
183 #: src/DeckPlayer.cpp:284
238 #: src/DeckPlayer.cpp:324
184239 msgid "View/Edit Deck"
185240 msgstr ""
186241
187 #: src/DeckPlayer.cpp:286
242 #: src/DeckPlayer.cpp:326
188243 msgid "Edit Card"
189244 msgstr ""
190245
191 #: src/DeckPlayer.cpp:881
246 #: src/DeckPlayer.cpp:412
247 msgid "Front"
248 msgstr ""
249
250 #: src/DeckPlayer.cpp:444
251 msgid "Back"
252 msgstr ""
253
254 #: src/DeckPlayer.cpp:458
255 msgid "Ask front"
256 msgstr ""
257
258 #: src/DeckPlayer.cpp:464
259 msgid "Ask back"
260 msgstr ""
261
262 #: src/DeckPlayer.cpp:475
263 msgid "Test line: "
264 msgstr ""
265
266 #: src/DeckPlayer.cpp:537
267 msgid "Say It!"
268 msgstr ""
269
270 #: src/DeckPlayer.cpp:547
271 msgid "I know it!"
272 msgstr ""
273
274 #: src/DeckPlayer.cpp:557
275 msgid "No clue"
276 msgstr ""
277
278 #: src/DeckPlayer.cpp:724
279 msgid ""
280 "The card you are about to see has invalid markup.\n"
281 "To proceed further, first, fix the broken markup.\n"
282 "If unsure about the correct syntax, consult Help."
283 msgstr ""
284
285 #: src/DeckPlayer.cpp:983
192286 msgid ""
193287 "Would you like to make cards\n"
194288 "order changes permanent?"
195289 msgstr ""
196290
197 #: src/DeckPlayer.cpp:960
291 #: src/DeckPlayer.cpp:1062
198292 msgid "The deck is empty!"
293 msgstr ""
294
295 #: src/GeneralPref.cpp:112
296 msgid ""
297 "Remove duplicates when inserting new\n"
298 "cards from a Deck to the CardBox"
299 msgstr ""
300
301 #: src/GeneralPref.cpp:118
302 msgid "Record all dynamic links in CardFile as relative paths"
303 msgstr ""
304
305 #: src/GeneralPref.cpp:124
306 msgid ""
307 "Some keyboard input methods may conflict with keyboard\n"
308 "shortcuts. If checked, disable all shortcuts in DeckPlayer\n"
309 "dialog (requires restart)."
199310 msgstr ""
200311
201312 #: src/MainWindow.cpp:95
226337 "Please, close it first"
227338 msgstr ""
228339
229 #: src/MainWindow.cpp:327 src/MainWindow.cpp:362
340 #: src/MainWindow.cpp:327 src/MainWindow.cpp:364
230341 msgid ""
231342 "Please open or create\n"
232343 "project first"
238349 "Close it to proceed."
239350 msgstr ""
240351
241 #: src/MainWindow.cpp:499
352 #: src/MainWindow.cpp:504
242353 msgid "Choose New CardFile name"
243354 msgstr ""
244355
245 #: src/MainWindow.cpp:539
356 #: src/MainWindow.cpp:544
246357 msgid "Save Card File As ..."
247358 msgstr ""
Binary diff not shown
0 # Japanese translation of Granule.
1 # Copyright (C) 2005 THE Granule'S COPYRIGHT HOLDER
2 # This file is distributed under the same license as the Granule package.
3 # Jeff <jeffames@gmail.com>, 2005.
4 #
5 #
6 #: src/CSVImportDialog.cpp:74
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: Granule 1.1.6\n"
10 "Report-Msgid-Bugs-To: \n"
11 "POT-Creation-Date: 2005-11-27 18:53-0500\n"
12 "PO-Revision-Date: 2005-09-23 11:12+0200\n"
13 "Last-Translator: Jeff <jeffames@gmail.com>\n"
14 "Language-Team: Japanese\n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #: src/CSVImportDialog.cpp:57 src/CardView.cpp:119
20 msgid "Cancel"
21 msgstr "キャンセル"
22
23 #: src/CSVImportDialog.cpp:64
24 msgid "Import"
25 msgstr ""
26
27 #: src/CSVImportDialog.cpp:69
28 msgid "Line Break:"
29 msgstr ""
30
31 #: src/CSVImportDialog.cpp:70
32 msgid "UNIX (LF)"
33 msgstr ""
34
35 #: src/CSVImportDialog.cpp:71
36 msgid "Windows (CR+LF)"
37 msgstr ""
38
39 #: src/CSVImportDialog.cpp:76
40 msgid "Space"
41 msgstr ""
42
43 #: src/CSVImportDialog.cpp:77
44 msgid "Tab"
45 msgstr ""
46
47 #: src/CSVImportDialog.cpp:78
48 msgid "Semicolon (;)"
49 msgstr ""
50
51 #: src/CSVImportDialog.cpp:79
52 msgid "Colon (:)"
53 msgstr ""
54
55 #: src/CSVImportDialog.cpp:81
56 msgid "Comma (,)"
57 msgstr ""
58
59 #: src/CSVImportDialog.cpp:85
60 msgid "Separators"
61 msgstr ""
62
63 #: src/CSVImportDialog.cpp:88
64 msgid "See two separators as one"
65 msgstr ""
66
67 #: src/CSVImportDialog.cpp:214
68 msgid "CSV Text Import"
69 msgstr ""
70
71 #: src/CardBox.cpp:184
72 msgid "0 cards"
73 msgstr "0 カード"
74
75 #: src/CardBox.cpp:325
76 msgid ""
77 "Failed to parse file\n"
78 " "
79 msgstr ""
80 "ファイルがの構文解析できません\n"
81 " "
82
83 #: src/CardBox.cpp:326
84 msgid ""
85 "\n"
86 "Reason: invalid file syntax/DTD"
87 msgstr ""
88 "\n"
89 "理由: ファイル構文かDTDが間違います"
90
91 #: src/CardBox.cpp:539
92 msgid "File \n"
93 msgstr "ファイル \n"
94
95 #: src/CardBox.cpp:540
96 msgid ""
97 "\n"
98 "already exists.\n"
99 "Would you like to delete it first?"
100 msgstr ""
101 "\n"
102 "もうあります。\n"
103 "まず消したいですか?"
104
105 #: src/CardBox.cpp:547 src/CardBox.cpp:815 src/DeckPlayer.cpp:988
106 msgid "Yes"
107 msgstr "はい"
108
109 #: src/CardBox.cpp:548 src/CardBox.cpp:816 src/DeckPlayer.cpp:989
110 msgid "No"
111 msgstr "いいえ"
112
113 #: src/CardBox.cpp:583
114 msgid "Trying to access index out of range!"
115 msgstr "範囲外のインデックスをアクセスしようとしています!"
116
117 #: src/CardBox.cpp:594
118 msgid "Card Deck you've selected is empty"
119 msgstr "選ばれたカードデックが空虚です"
120
121 #: src/CardBox.cpp:613
122 msgid ""
123 "First, open or create\n"
124 "a Card Box file."
125 msgstr ""
126 "まず、カードファイルを開くか作成するか\n"
127 "どちらかして下さい。"
128
129 #: src/CardBox.cpp:652
130 msgid "First, open or create a Card File."
131 msgstr "まず、カードファイルを開くか作成するかどちらかして下さい。"
132
133 #: src/CardBox.cpp:696
134 msgid ""
135 "You have learnt all\n"
136 "expired cards in this deck."
137 msgstr ""
138 "このデックの満期になったカードを\n"
139 "全部習いました。"
140
141 #: src/CardBox.cpp:729
142 msgid ""
143 "First Open or Create\n"
144 "a New Card File!"
145 msgstr ""
146 "まず、新しいカードファイルを開くか作成するか\n"
147 "どちらかして下さい。"
148
149 #: src/CardDeck.cpp:26
150 msgid "Card Box 1"
151 msgstr "カードボックス 1"
152
153 #: src/CardDeck.cpp:26
154 msgid "Card Box 2"
155 msgstr "カードボックス 2"
156
157 #: src/CardDeck.cpp:27
158 msgid "Card Box 3"
159 msgstr "カードボックス 3"
160
161 #: src/CardDeck.cpp:27
162 msgid "Card Box 4"
163 msgstr "カードボックス 4"
164
165 #: src/CardDeck.cpp:28
166 msgid "Card Box 5"
167 msgstr "カードボックス 5"
168
169 #: src/CardView.cpp:111
170 msgid "Clear"
171 msgstr "クリア"
172
173 #: src/CardView.cpp:128
174 msgid "Add"
175 msgstr "追加"
176
177 #: src/CardView.cpp:137
178 msgid "Ok"
179 msgstr "Ok"
180
181 #: src/CardView.cpp:146
182 msgid "Help"
183 msgstr "ヘルプ"
184
185 #: src/CardView.cpp:155
186 msgid "Front : "
187 msgstr "表面:"
188
189 #: src/CardView.cpp:161
190 msgid "Back :"
191 msgstr "裏面:"
192
193 #: src/CardView.cpp:167
194 msgid "Example : "
195 msgstr "例:"
196
197 #: src/CardView.cpp:269
198 msgid "Fill up the back of the card"
199 msgstr "カードの裏面を記入して下さい"
200
201 #: src/CardView.cpp:301
202 msgid "Fill up an example"
203 msgstr "例を記入して下さい"
204
205 #: src/CardView.cpp:353
206 msgid "Fill up the front of the card"
207 msgstr "カードの表面を記入して下さい"
208
209 #: src/CardView.cpp:591
210 msgid "FRONT field contains illegal markup tag(s)."
211 msgstr "表面フィールドは違法のマークアップがあります。"
212
213 #: src/CardView.cpp:600
214 msgid "BACK field contains illegal markup tag(s)."
215 msgstr "裏面フィールドは違法のマークアップがあります。"
216
217 #: src/CardView.cpp:609
218 msgid "EXAMPLE field contains illegal markup tag(s)."
219 msgstr "例フィールドは違法のマークアップがあります。"
220
221 #: src/Deck.cpp:310
222 msgid ""
223 "Failed to open import file.\n"
224 "Check file permissions."
225 msgstr ""
226
227 #: src/DeckPlayer.cpp:55
228 msgid "Check"
229 msgstr "照合"
230
231 #: src/DeckPlayer.cpp:55
232 msgid "Next "
233 msgstr "次 "
234
235 #: src/DeckPlayer.cpp:55
236 msgid "Correct "
237 msgstr "正解 "
238
239 #: src/DeckPlayer.cpp:55
240 msgid "Incorrect"
241 msgstr "違う "
242
243 #: src/DeckPlayer.cpp:319
244 msgid "Close"
245 msgstr "閉じる"
246
247 #: src/DeckPlayer.cpp:321
248 msgid "Shuffle"
249 msgstr "シャッフル"
250
251 #: src/DeckPlayer.cpp:324
252 msgid "View/Edit Deck"
253 msgstr "デックを見る/編集する"
254
255 #: src/DeckPlayer.cpp:326
256 msgid "Edit Card"
257 msgstr "カードを編集する"
258
259 #: src/DeckPlayer.cpp:412
260 #, fuzzy
261 msgid "Front"
262 msgstr "表面:"
263
264 #: src/DeckPlayer.cpp:444
265 #, fuzzy
266 msgid "Back"
267 msgstr "裏面:"
268
269 #: src/DeckPlayer.cpp:458
270 msgid "Ask front"
271 msgstr ""
272
273 #: src/DeckPlayer.cpp:464
274 msgid "Ask back"
275 msgstr ""
276
277 #: src/DeckPlayer.cpp:475
278 msgid "Test line: "
279 msgstr ""
280
281 #: src/DeckPlayer.cpp:537
282 msgid "Say It!"
283 msgstr ""
284
285 #: src/DeckPlayer.cpp:547
286 msgid "I know it!"
287 msgstr ""
288
289 #: src/DeckPlayer.cpp:557
290 msgid "No clue"
291 msgstr ""
292
293 #: src/DeckPlayer.cpp:724
294 msgid ""
295 "The card you are about to see has invalid markup.\n"
296 "To proceed further, first, fix the broken markup.\n"
297 "If unsure about the correct syntax, consult Help."
298 msgstr ""
299
300 #: src/DeckPlayer.cpp:983
301 msgid ""
302 "Would you like to make cards\n"
303 "order changes permanent?"
304 msgstr "カードの順位が永久にしたいですか?"
305
306 #: src/DeckPlayer.cpp:1062
307 msgid "The deck is empty!"
308 msgstr "デックが空虚です!"
309
310 #: src/GeneralPref.cpp:112
311 msgid ""
312 "Remove duplicates when inserting new\n"
313 "cards from a Deck to the CardBox"
314 msgstr ""
315
316 #: src/GeneralPref.cpp:118
317 msgid "Record all dynamic links in CardFile as relative paths"
318 msgstr ""
319
320 #: src/GeneralPref.cpp:124
321 msgid ""
322 "Some keyboard input methods may conflict with keyboard\n"
323 "shortcuts. If checked, disable all shortcuts in DeckPlayer\n"
324 "dialog (requires restart)."
325 msgstr ""
326
327 #: src/MainWindow.cpp:95
328 msgid "CardBox"
329 msgstr "カードボックス"
330
331 #: src/MainWindow.cpp:212 src/MainWindow.cpp:300
332 msgid ""
333 "Project has been modified.\n"
334 "Please, save and close it first"
335 msgstr ""
336 "プロジェクトは変わりました。\n"
337 "まず、セーブし、閉じて下さい。"
338
339 #: src/MainWindow.cpp:220 src/MainWindow.cpp:308
340 msgid ""
341 "Project is opened.\n"
342 "Please, close it first"
343 msgstr ""
344 "プロジェクトは開いています。\n"
345 "まず、閉じて下さい。"
346
347 #: src/MainWindow.cpp:251
348 msgid ""
349 "Project has been modified\n"
350 "Please, save and close it first"
351 msgstr ""
352 "プロジェクトは変わりました\n"
353 "まず、セーブし、閉じて下さい。"
354
355 #: src/MainWindow.cpp:260
356 msgid ""
357 "Project is opened\n"
358 "Please, close it first"
359 msgstr ""
360 "プロジェクトは開いています\n"
361 "まず、閉じて下さい。"
362
363 #: src/MainWindow.cpp:327 src/MainWindow.cpp:364
364 msgid ""
365 "Please open or create\n"
366 "project first"
367 msgstr ""
368 "まず、プロジェクトを\n"
369 "開くか作成するかどちらかして下さい"
370
371 #: src/MainWindow.cpp:342
372 msgid ""
373 "Project is not modified.\n"
374 "Close it to proceed."
375 msgstr ""
376 "プロジェクトは変わっていません。\n"
377 "続くために閉じて下さい。"
378
379 #: src/MainWindow.cpp:504
380 msgid "Choose New CardFile name"
381 msgstr "新しいカードファイル名前を選んで下さい"
382
383 #: src/MainWindow.cpp:544
384 msgid "Save Card File As ..."
385 msgstr "カードファイルを…でセーブする"
Binary diff not shown
22 # This file is distributed under the same license as the PACKAGE package.
33 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
44 #
5 #: src/CSVImportDialog.cpp:74
56 #, fuzzy
67 msgid ""
78 msgstr ""
89 "Project-Id-Version: granule 1.1.5\n"
910 "Report-Msgid-Bugs-To: \n"
10 "POT-Creation-Date: 2005-07-12 22:08-0400\n"
11 "POT-Creation-Date: 2005-11-27 18:53-0500\n"
1112 "PO-Revision-Date: 2005-04-12 21:34-0000\n"
1213 "Last-Translator: Vladislav Grinchenko <vlg@users.sourceforge.net>\n"
1314 "Language-Team: Russian <LL@li.org>\n"
1516 "Content-Type: text/plain; charset=UTF-8\n"
1617 "Content-Transfer-Encoding: 8bit\n"
1718
19 #: src/CSVImportDialog.cpp:57 src/CardView.cpp:119
20 msgid "Cancel"
21 msgstr "Отменить"
22
23 #: src/CSVImportDialog.cpp:64
24 msgid "Import"
25 msgstr "Импорт"
26
27 #: src/CSVImportDialog.cpp:69
28 msgid "Line Break:"
29 msgstr "Разделитель"
30
31 #: src/CSVImportDialog.cpp:70
32 msgid "UNIX (LF)"
33 msgstr ""
34
35 #: src/CSVImportDialog.cpp:71
36 msgid "Windows (CR+LF)"
37 msgstr ""
38
39 #: src/CSVImportDialog.cpp:76
40 msgid "Space"
41 msgstr "Пробел"
42
43 #: src/CSVImportDialog.cpp:77
44 msgid "Tab"
45 msgstr "Таб"
46
47 #: src/CSVImportDialog.cpp:78
48 msgid "Semicolon (;)"
49 msgstr "Точка с запятой (;)"
50
51 #: src/CSVImportDialog.cpp:79
52 msgid "Colon (:)"
53 msgstr "Двоеточие (:)"
54
55 #: src/CSVImportDialog.cpp:81
56 msgid "Comma (,)"
57 msgstr "Запятая (,)"
58
59 #: src/CSVImportDialog.cpp:85
60 msgid "Separators"
61 msgstr "Разделители"
62
63 #: src/CSVImportDialog.cpp:88
64 msgid "See two separators as one"
65 msgstr "Слить 2 сепаратора в один"
66
67 #: src/CSVImportDialog.cpp:214
68 msgid "CSV Text Import"
69 msgstr "Импортировать текст"
70
1871 #: src/CardBox.cpp:184
1972 msgid "0 cards"
2073 msgstr "0 карточек"
2174
22 #: src/CardBox.cpp:311
75 #: src/CardBox.cpp:325
2376 msgid ""
2477 "Failed to parse file\n"
2578 " "
2780 "Ошибка при чтении файла\n"
2881 " "
2982
30 #: src/CardBox.cpp:312
83 #: src/CardBox.cpp:326
3184 msgid ""
3285 "\n"
3386 "Reason: invalid file syntax/DTD"
3588 "\n"
3689 "Причина: ошибка в семантике файла/ДТД"
3790
38 #: src/CardBox.cpp:499
91 #: src/CardBox.cpp:539
3992 msgid "File \n"
4093 msgstr "Файл \n"
4194
42 #: src/CardBox.cpp:500
95 #: src/CardBox.cpp:540
4396 msgid ""
4497 "\n"
4598 "already exists.\n"
49102 "уже существует.\n"
50103 "Не хотите-ли вначале удалить его?"
51104
52 #: src/CardBox.cpp:507 src/CardBox.cpp:775 src/DeckPlayer.cpp:886
105 #: src/CardBox.cpp:547 src/CardBox.cpp:815 src/DeckPlayer.cpp:988
53106 msgid "Yes"
54107 msgstr "Да"
55108
56 #: src/CardBox.cpp:508 src/CardBox.cpp:776 src/DeckPlayer.cpp:887
109 #: src/CardBox.cpp:548 src/CardBox.cpp:816 src/DeckPlayer.cpp:989
57110 msgid "No"
58111 msgstr "Нет"
59112
60 #: src/CardBox.cpp:543
113 #: src/CardBox.cpp:583
61114 msgid "Trying to access index out of range!"
62115 msgstr "Попытка чтения вне инексного предела"
63116
64 #: src/CardBox.cpp:554
117 #: src/CardBox.cpp:594
65118 msgid "Card Deck you've selected is empty"
66119 msgstr "Выбранная колода карточек пуста"
67120
68 #: src/CardBox.cpp:573
121 #: src/CardBox.cpp:613
69122 msgid ""
70123 "First, open or create\n"
71124 "a Card Box file."
73126 "Вначале откройте или создайте\n"
74127 "Card Box файл (для хранение картотеки)."
75128
76 #: src/CardBox.cpp:612
129 #: src/CardBox.cpp:652
77130 msgid "First, open or create a Card File."
78131 msgstr "Вначале откройте или создайте Card файл."
79132
80 #: src/CardBox.cpp:656
133 #: src/CardBox.cpp:696
81134 msgid ""
82135 "You have learnt all\n"
83136 "expired cards in this deck."
85138 "Вы выучили все просроченные\n"
86139 "карточки в этой колоде."
87140
88 #: src/CardBox.cpp:689
141 #: src/CardBox.cpp:729
89142 msgid ""
90143 "First Open or Create\n"
91144 "a New Card File!"
93146 "Вначале откройте или создайте\n"
94147 "новый Card File (для хранения картотеки)."
95148
96 #: src/CardDeck.cpp:25
149 #: src/CardDeck.cpp:26
97150 msgid "Card Box 1"
98151 msgstr "1-ая Ячейка"
99152
100 #: src/CardDeck.cpp:25
153 #: src/CardDeck.cpp:26
101154 msgid "Card Box 2"
102155 msgstr "2-ая Ячейка"
103156
104 #: src/CardDeck.cpp:26
157 #: src/CardDeck.cpp:27
105158 msgid "Card Box 3"
106159 msgstr "3-я Ячейка"
107160
108 #: src/CardDeck.cpp:26
161 #: src/CardDeck.cpp:27
109162 msgid "Card Box 4"
110163 msgstr "4-я Ячейка"
111164
112 #: src/CardDeck.cpp:27
165 #: src/CardDeck.cpp:28
113166 msgid "Card Box 5"
114167 msgstr "5-я Ячейка"
115168
116 #: src/CardView.cpp:109
169 #: src/CardView.cpp:111
117170 msgid "Clear"
118171 msgstr "Очистить"
119172
120 #: src/CardView.cpp:117
121 msgid "Cancel"
122 msgstr "Отменить"
123
124 #: src/CardView.cpp:126
173 #: src/CardView.cpp:128
125174 msgid "Add"
126 msgstr ""
127
128 #: src/CardView.cpp:135
175 msgstr "Добавить"
176
177 #: src/CardView.cpp:137
129178 msgid "Ok"
130179 msgstr "Выполнить"
131180
132 #: src/CardView.cpp:144
181 #: src/CardView.cpp:146
133182 msgid "Help"
134 msgstr ""
135
136 #: src/CardView.cpp:153
183 msgstr "Подсказка"
184
185 #: src/CardView.cpp:155
137186 msgid "Front : "
138187 msgstr "Лицевая:"
139188
140 #: src/CardView.cpp:159
189 #: src/CardView.cpp:161
141190 msgid "Back :"
142191 msgstr "Оборот: "
143192
144 #: src/CardView.cpp:165
193 #: src/CardView.cpp:167
145194 msgid "Example : "
146195 msgstr "Пример : "
147196
148 #: src/CardView.cpp:266
197 #: src/CardView.cpp:269
149198 msgid "Fill up the back of the card"
150199 msgstr "Заполните оборот карточки"
151200
152 #: src/CardView.cpp:297
201 #: src/CardView.cpp:301
153202 msgid "Fill up an example"
154203 msgstr "Заполните пример"
155204
156 #: src/CardView.cpp:327
205 #: src/CardView.cpp:353
157206 msgid "Fill up the front of the card"
158207 msgstr "Заполните лицевую сторону"
159208
160 #: src/CardView.cpp:544
209 #: src/CardView.cpp:591
161210 msgid "FRONT field contains illegal markup tag(s)."
162211 msgstr "Лицевая сторона содержит неудобоваримую маркировку."
163212
164 #: src/CardView.cpp:551
213 #: src/CardView.cpp:600
165214 msgid "BACK field contains illegal markup tag(s)."
166215 msgstr "Оборотная сторона содержит неудобоваримую маркировку."
167216
168 #: src/CardView.cpp:558
217 #: src/CardView.cpp:609
169218 msgid "EXAMPLE field contains illegal markup tag(s)."
170219 msgstr "Пример содержит неудобоваримую маркировку."
171220
172 #: src/DeckPlayer.cpp:51
221 #: src/Deck.cpp:310
222 msgid ""
223 "Failed to open import file.\n"
224 "Check file permissions."
225 msgstr ""
226 "Ошибка при импорте файла.\n"
227 "Проверьте аттрибуты доступа."
228
229 #: src/DeckPlayer.cpp:55
173230 msgid "Check"
174231 msgstr "Сравнить"
175232
176 #: src/DeckPlayer.cpp:51
233 #: src/DeckPlayer.cpp:55
177234 msgid "Next "
178235 msgstr "Следующий"
179236
180 #: src/DeckPlayer.cpp:51
237 #: src/DeckPlayer.cpp:55
181238 msgid "Correct "
182239 msgstr "Угадал "
183240
184 #: src/DeckPlayer.cpp:51
241 #: src/DeckPlayer.cpp:55
185242 msgid "Incorrect"
186243 msgstr "Не угадал"
187244
188 #: src/DeckPlayer.cpp:279
245 #: src/DeckPlayer.cpp:319
189246 msgid "Close"
190247 msgstr "Закрыть"
191248
192 #: src/DeckPlayer.cpp:281
249 #: src/DeckPlayer.cpp:321
193250 msgid "Shuffle"
194251 msgstr "Перемешать"
195252
196 #: src/DeckPlayer.cpp:284
253 #: src/DeckPlayer.cpp:324
197254 msgid "View/Edit Deck"
198255 msgstr "Поправка Колоды"
199256
200 #: src/DeckPlayer.cpp:286
257 #: src/DeckPlayer.cpp:326
201258 msgid "Edit Card"
202259 msgstr "Поправка Карточки"
203260
204 #: src/DeckPlayer.cpp:881
261 #: src/DeckPlayer.cpp:412
262 msgid "Front"
263 msgstr "Перед"
264
265 #: src/DeckPlayer.cpp:444
266 msgid "Back"
267 msgstr "Оборот"
268
269 #: src/DeckPlayer.cpp:458
270 msgid "Ask front"
271 msgstr "Проверь перед"
272
273 #: src/DeckPlayer.cpp:464
274 msgid "Ask back"
275 msgstr "Проверь оборот"
276
277 #: src/DeckPlayer.cpp:475
278 msgid "Test line: "
279 msgstr "Строка"
280
281 #: src/DeckPlayer.cpp:537
282 msgid "Say It!"
283 msgstr "Произнеси"
284
285 #: src/DeckPlayer.cpp:547
286 msgid "I know it!"
287 msgstr "Я знаю"
288
289 #: src/DeckPlayer.cpp:557
290 msgid "No clue"
291 msgstr "Я не знаю"
292
293 #: src/DeckPlayer.cpp:724
294 msgid ""
295 "The card you are about to see has invalid markup.\n"
296 "To proceed further, first, fix the broken markup.\n"
297 "If unsure about the correct syntax, consult Help."
298 msgstr ""
299 "Карточта которую вы сейчас увидете содержит\n"
300 "неудобоваримую маркировку. Чтобы продолжить,\n"
301 "пожалуйста, исправье. Обратитесь к Подсказке за помощью."
302
303 #: src/DeckPlayer.cpp:983
205304 msgid ""
206305 "Would you like to make cards\n"
207306 "order changes permanent?"
209308 "Не желаете-ли сохранить новый\n"
210309 "порядок карточек?"
211310
212 #: src/DeckPlayer.cpp:960
311 #: src/DeckPlayer.cpp:1062
213312 msgid "The deck is empty!"
214313 msgstr "Колода пуста!"
314
315 #: src/GeneralPref.cpp:112
316 msgid ""
317 "Remove duplicates when inserting new\n"
318 "cards from a Deck to the CardBox"
319 msgstr ""
320 "Избавиться от дубликатов при добавлении\n"
321 "новых карточек из Колоды в Ячейку"
322
323 #: src/GeneralPref.cpp:118
324 msgid "Record all dynamic links in CardFile as relative paths"
325 msgstr "Записать все динамические ссылки в CardFile как относительные"
326
327 #: src/GeneralPref.cpp:124
328 msgid ""
329 "Some keyboard input methods may conflict with keyboard\n"
330 "shortcuts. If checked, disable all shortcuts in DeckPlayer\n"
331 "dialog (requires restart)."
332 msgstr ""
333 "Некоторые методы клавиатурного ввода могут противоречить\n"
334 "клавиатурным упрощениям. Если отмечено, заблокировать\n"
335 "упрощения в DeckPlayer диалоге (перестартовка необходима)"
215336
216337 #: src/MainWindow.cpp:95
217338 msgid "CardBox"
249370 "Проэкт открыт.\n"
250371 "Пожалуйста, закройте его вначале."
251372
252 #: src/MainWindow.cpp:327 src/MainWindow.cpp:362
373 #: src/MainWindow.cpp:327 src/MainWindow.cpp:364
253374 msgid ""
254375 "Please open or create\n"
255376 "project first"
265386 "Проэкт не был изменен.\n"
266387 "Закройте его чтобы продолжить."
267388
268 #: src/MainWindow.cpp:499
389 #: src/MainWindow.cpp:504
269390 msgid "Choose New CardFile name"
270391 msgstr "Выберите новое имя для картотеки"
271392
272 #: src/MainWindow.cpp:539
393 #: src/MainWindow.cpp:544
273394 msgid "Save Card File As ..."
274395 msgstr "Сохранить картотеку Как ..."
po/ru_RU.gmo less more
Binary diff not shown
+0
-275
po/ru_RU.po less more
0 # SOME DESCRIPTIVE TITLE.
1 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
2 # This file is distributed under the same license as the PACKAGE package.
3 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4 #
5 #, fuzzy
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: granule 1.1.5\n"
9 "Report-Msgid-Bugs-To: \n"
10 "POT-Creation-Date: 2005-07-12 22:08-0400\n"
11 "PO-Revision-Date: 2005-04-12 21:34-0000\n"
12 "Last-Translator: Vladislav Grinchenko <vlg@users.sourceforge.net>\n"
13 "Language-Team: Russian <LL@li.org>\n"
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17
18 #: src/CardBox.cpp:184
19 msgid "0 cards"
20 msgstr "0 карточек"
21
22 #: src/CardBox.cpp:311
23 msgid ""
24 "Failed to parse file\n"
25 " "
26 msgstr ""
27 "Ошибка при чтении файла\n"
28 " "
29
30 #: src/CardBox.cpp:312
31 msgid ""
32 "\n"
33 "Reason: invalid file syntax/DTD"
34 msgstr ""
35 "\n"
36 "Причина: ошибка в семантике файла/ДТД"
37
38 #: src/CardBox.cpp:499
39 msgid "File \n"
40 msgstr "Файл \n"
41
42 #: src/CardBox.cpp:500
43 msgid ""
44 "\n"
45 "already exists.\n"
46 "Would you like to delete it first?"
47 msgstr ""
48 "\n"
49 "уже существует.\n"
50 "Не хотите-ли вначале удалить его?"
51
52 #: src/CardBox.cpp:507 src/CardBox.cpp:775 src/DeckPlayer.cpp:886
53 msgid "Yes"
54 msgstr "Да"
55
56 #: src/CardBox.cpp:508 src/CardBox.cpp:776 src/DeckPlayer.cpp:887
57 msgid "No"
58 msgstr "Нет"
59
60 #: src/CardBox.cpp:543
61 msgid "Trying to access index out of range!"
62 msgstr "Попытка чтения вне инексного предела"
63
64 #: src/CardBox.cpp:554
65 msgid "Card Deck you've selected is empty"
66 msgstr "Выбранная колода карточек пуста"
67
68 #: src/CardBox.cpp:573
69 msgid ""
70 "First, open or create\n"
71 "a Card Box file."
72 msgstr ""
73 "Вначале откройте или создайте\n"
74 "Card Box файл (для хранение картотеки)."
75
76 #: src/CardBox.cpp:612
77 msgid "First, open or create a Card File."
78 msgstr "Вначале откройте или создайте Card файл."
79
80 #: src/CardBox.cpp:656
81 msgid ""
82 "You have learnt all\n"
83 "expired cards in this deck."
84 msgstr ""
85 "Вы выучили все просроченные\n"
86 "карточки в этой колоде."
87
88 #: src/CardBox.cpp:689
89 msgid ""
90 "First Open or Create\n"
91 "a New Card File!"
92 msgstr ""
93 "Вначале откройте или создайте\n"
94 "новый Card File (для хранения картотеки)."
95
96 #: src/CardDeck.cpp:25
97 msgid "Card Box 1"
98 msgstr "1-ая Ячейка"
99
100 #: src/CardDeck.cpp:25
101 msgid "Card Box 2"
102 msgstr "2-ая Ячейка"
103
104 #: src/CardDeck.cpp:26
105 msgid "Card Box 3"
106 msgstr "3-я Ячейка"
107
108 #: src/CardDeck.cpp:26
109 msgid "Card Box 4"
110 msgstr "4-я Ячейка"
111
112 #: src/CardDeck.cpp:27
113 msgid "Card Box 5"
114 msgstr "5-я Ячейка"
115
116 #: src/CardView.cpp:109
117 msgid "Clear"
118 msgstr "Очистить"
119
120 #: src/CardView.cpp:117
121 msgid "Cancel"
122 msgstr "Отменить"
123
124 #: src/CardView.cpp:126
125 msgid "Add"
126 msgstr ""
127
128 #: src/CardView.cpp:135
129 msgid "Ok"
130 msgstr "Выполнить"
131
132 #: src/CardView.cpp:144
133 msgid "Help"
134 msgstr ""
135
136 #: src/CardView.cpp:153
137 msgid "Front : "
138 msgstr "Лицевая:"
139
140 #: src/CardView.cpp:159
141 msgid "Back :"
142 msgstr "Оборот: "
143
144 #: src/CardView.cpp:165
145 msgid "Example : "
146 msgstr "Пример : "
147
148 #: src/CardView.cpp:266
149 msgid "Fill up the back of the card"
150 msgstr "Заполните оборот карточки"
151
152 #: src/CardView.cpp:297
153 msgid "Fill up an example"
154 msgstr "Заполните пример"
155
156 #: src/CardView.cpp:327
157 msgid "Fill up the front of the card"
158 msgstr "Заполните лицевую сторону"
159
160 #: src/CardView.cpp:544
161 msgid "FRONT field contains illegal markup tag(s)."
162 msgstr "Лицевая сторона содержит неудобоваримую маркировку."
163
164 #: src/CardView.cpp:551
165 msgid "BACK field contains illegal markup tag(s)."
166 msgstr "Оборотная сторона содержит неудобоваримую маркировку."
167
168 #: src/CardView.cpp:558
169 msgid "EXAMPLE field contains illegal markup tag(s)."
170 msgstr "Пример содержит неудобоваримую маркировку."
171
172 #: src/DeckPlayer.cpp:51
173 msgid "Check"
174 msgstr "Сравнить"
175
176 #: src/DeckPlayer.cpp:51
177 msgid "Next "
178 msgstr "Следующий"
179
180 #: src/DeckPlayer.cpp:51
181 msgid "Correct "
182 msgstr "Угадал "
183
184 #: src/DeckPlayer.cpp:51
185 msgid "Incorrect"
186 msgstr "Не угадал"
187
188 #: src/DeckPlayer.cpp:279
189 msgid "Close"
190 msgstr "Закрыть"
191
192 #: src/DeckPlayer.cpp:281
193 msgid "Shuffle"
194 msgstr "Перемешать"
195
196 #: src/DeckPlayer.cpp:284
197 msgid "View/Edit Deck"
198 msgstr "Поправка Колоды"
199
200 #: src/DeckPlayer.cpp:286
201 msgid "Edit Card"
202 msgstr "Поправка Карточки"
203
204 #: src/DeckPlayer.cpp:881
205 msgid ""
206 "Would you like to make cards\n"
207 "order changes permanent?"
208 msgstr ""
209 "Не желаете-ли сохранить новый\n"
210 "порядок карточек?"
211
212 #: src/DeckPlayer.cpp:960
213 msgid "The deck is empty!"
214 msgstr "Колода пуста!"
215
216 #: src/MainWindow.cpp:95
217 msgid "CardBox"
218 msgstr "Картотека"
219
220 #: src/MainWindow.cpp:212 src/MainWindow.cpp:300
221 msgid ""
222 "Project has been modified.\n"
223 "Please, save and close it first"
224 msgstr ""
225 "Проэкт был изменен,\n"
226 "Пожалуйста, вначале сохраните и закройте его."
227
228 #: src/MainWindow.cpp:220 src/MainWindow.cpp:308
229 msgid ""
230 "Project is opened.\n"
231 "Please, close it first"
232 msgstr ""
233 "Проэкт открыт.\n"
234 "Пожалуйста, закройте его вначале."
235
236 #: src/MainWindow.cpp:251
237 msgid ""
238 "Project has been modified\n"
239 "Please, save and close it first"
240 msgstr ""
241 "Проэкт был изменен,\n"
242 "Пожалуйста, вначале сохраните и закройте его."
243
244 #: src/MainWindow.cpp:260
245 msgid ""
246 "Project is opened\n"
247 "Please, close it first"
248 msgstr ""
249 "Проэкт открыт.\n"
250 "Пожалуйста, закройте его вначале."
251
252 #: src/MainWindow.cpp:327 src/MainWindow.cpp:362
253 msgid ""
254 "Please open or create\n"
255 "project first"
256 msgstr ""
257 "Вначале, откройте или создайте\n"
258 "новый проэкт."
259
260 #: src/MainWindow.cpp:342
261 msgid ""
262 "Project is not modified.\n"
263 "Close it to proceed."
264 msgstr ""
265 "Проэкт не был изменен.\n"
266 "Закройте его чтобы продолжить."
267
268 #: src/MainWindow.cpp:499
269 msgid "Choose New CardFile name"
270 msgstr "Выберите новое имя для картотеки"
271
272 #: src/MainWindow.cpp:539
273 msgid "Save Card File As ..."
274 msgstr "Сохранить картотеку Как ..."
00 // -*- c++ -*-
11 // generated by glade--
22 //------------------------------------------------------------------------------
3 // $Id: AboutGRAPP.cpp,v 1.3 2004/07/06 04:34:22 vlg Exp $
3 // $Id: AboutGRAPP.cpp,v 1.4 2005/11/27 04:59:22 vlg Exp $
44 //------------------------------------------------------------------------------
55 // AboutGRAPP.cpp
66 //------------------------------------------------------------------------------
5757
5858 /** Label is the rest of it
5959 */
60 Glib::ustring info_msg ("\nThe Index Cards Program.\n");
61 info_msg += "Copyright (C) 2004 Vladislav Grinchenko\n";
60 Glib::ustring info_msg ("\nThe FlashCards Program.\n");
61 info_msg += "Copyright (C) 2004-2005 Vladislav Grinchenko\n";
6262 label = manage (new Gtk::Label (info_msg));
6363
6464 contents->pack_start (*label);
00 // -*- c++ -*-
11 //------------------------------------------------------------------------------
2 // $Id: CardBox.cpp,v 1.45 2005/07/06 02:52:26 vlg Exp $
2 // $Id: CardBox.cpp,v 1.47 2005/11/13 02:50:48 vlg Exp $
33 //------------------------------------------------------------------------------
44 // CardBox.cpp
55 //------------------------------------------------------------------------------
225225 show_all ();
226226 }
227227
228 CardBox::
229 ~CardBox ()
230 {
231 trace_with_mask("CardBox::~CardBox",GUITRACE);
232 }
233
234228 void
235229 CardBox::
236230 update_count (int idx_)
273267 {
274268 trace_with_mask("CardBox::load",GUITRACE);
275269
270 int ret = 0;
271 string error_msg;
272 xmlParserCtxtPtr context;
273 xmlDocPtr parser;
274
276275 /** Test to see if file exists
277276 */
278277 struct stat file_stat;
279278 if (stat (fname_.c_str (), &file_stat) < 0 ||
280 S_ISREG (file_stat.st_mode) == false) // invalid project file
279 S_ISREG (file_stat.st_mode) == false) // invalid project file
281280 {
282 string msg ("Invalid CardBox file:\n");
283 msg += fname_;
284 Gtk::MessageDialog md_error (msg, false, Gtk::MESSAGE_ERROR);
281 error_msg = "Invalid CardBox file:\n";
282 error_msg += fname_;
283 Gtk::MessageDialog md_error (error_msg, false, Gtk::MESSAGE_ERROR);
284 md_error.run ();
285285 return -1;
286286 }
287287
288288 CONFIG->set_proj_name (fname_);
289289
290 try {
291 xmlpp::DomParser parser;
292 parser.set_validate ();
293 parser.parse_file (fname_);
294 if (!parser) {
295 DL((GRAPP,"Failed to parse \"%s\"\n", fname_.c_str ()));
296 return -1;
297 }
298 DL((GRAPP,"Parsing the card file ...\n"));
299 const xmlpp::Node* root_node = parser.get_document ()->get_root_node ();
300 Assert_exit (root_node);
301
302 if (parse_xml_tree (root_node) == 0) {
303 m_fname = fname_;
304 MAINWIN->set_mw_name ();
305 CONFIG->set_filesel_path (fname_);
306 return 0;
307 }
308 }
309 catch (const std::exception& ex_) {
310 string msg (_("Failed to parse file\n "));
311 msg += fname_ + _("\nReason: invalid file syntax/DTD");
312 Gtk::MessageDialog e (msg, false, MESSAGE_ERROR);
313 e.run ();
314 }
315 return -1;
290 context = xmlCreateFileParserCtxt (fname_.c_str ()); // new
291 if (!context) {
292 DL ((GRAPP,"Failed to create file context\n"));
293 xmlFreeParserCtxt (context);
294 return -1;
295 }
296 // Initialize context
297 context->linenumbers = 1;
298 context->validate = 1;
299 context->replaceEntities = 1;
300
301 // Parse the document
302 xmlParseDocument (context);
303
304 if(!context->wellFormed || context->errNo != 0) {
305 error_msg = "File is not well-formed:\n";
306 error_msg += fname_;
307 Gtk::MessageDialog md_error (error_msg, false, Gtk::MESSAGE_ERROR);
308 md_error.run ();
309 xmlFreeParserCtxt (context);
310 return -1;
311 }
312
313 parser = context->myDoc;
314 xmlFreeParserCtxt (context); // not needed anymore?
315
316 DL((GRAPP,"Parsing the card file ...\n"));
317
318 if (parse_xml_tree (parser, error_msg) == 0) {
319 m_fname = fname_;
320 MAINWIN->set_mw_name ();
321 CONFIG->set_filesel_path (fname_);
322 }
323 else {
324 string msg (_("Failed to parse file\n "));
325 msg += fname_ + _("\nReason: invalid file syntax/DTD");
326 Gtk::MessageDialog e (msg, false, MESSAGE_ERROR);
327 e.run ();
328 DL ((ASSA::ERROR,"Failed to parse file: %s\n", error_msg.c_str ()));
329 ret = -1;
330 }
331
332 xmlFreeDoc (parser);
333 return ret;
316334 }
317335
318336 int
319337 CardBox::
320 parse_xml_tree (const xmlpp::Node* node_)
338 parse_xml_tree (const xmlDocPtr parser_, string error_msg_)
321339 {
322340 trace_with_mask("CardBox::parse_xml_tree",GUITRACE);
341
342 char total_count [32];
323343 char xpath [64];
324 char total_count [32];
325 const xmlpp::TextNode* text_node;
326 const xmlpp::Attribute* attr_node;
327 xmlpp::NodeSet nset; // set of cards
328 xmlpp::NodeSet::iterator nset_iter;
329 long card_id;
330 string abs_path; // absolute deck path
331 string deck_path; // deck path as recorded in CDF file
332 int ccount; // card counter
333 int cloaded; // count of cards loaded
334 Card* cardptr;
344 xmlChar* result;
345
346 string attr_node;
347 long card_id;
348 string abs_path; // absolute deck path
349 string deck_path; // deck path as recorded in CDF file
350 int ccount; // card counter
351 int cloaded; // count of cards loaded
352 Card* cardptr;
335353 CardRef* card_ref;
336354
337 for (int i = 0; i < CARD_BOX_SIZE; i++) {
355 for (int i = 0; i < CARD_BOX_SIZE; i++)
356 {
338357 DL((GRAPP,"Filling Card Deck # %d ...\n", i+1));
339358 m_card_deck [i].set_name (i);
340359 cloaded = 0;
341 for (ccount = 1; ccount < MAX_CARDS; ccount++) {
360 for (ccount = 1; ccount < MAX_CARDS; ccount++)
361 {
342362 DL((GRAPP,"Parsing Card # %d/%d ...\n", i+1, ccount));
363
343364 sprintf(xpath, "/cardfile/carddeck[%d]/card[%d]", i+1, ccount);
344 nset = node_->find (xpath);
345 if ((nset_iter = nset.begin ()) == nset.end ()) {
365 result = Granule::get_node_by_xpath (parser_, xpath);
366 if (result == NULL) {
346367 break;
347368 }
369 xmlFree (result);
370
348371 /** Parse card's ID
349372 */
350373 sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/@id", i+1, ccount);
351 nset = node_->find (xpath);
352 if ((nset_iter = nset.begin ()) == nset.end ()) return -1;
353 attr_node = dynamic_cast<const xmlpp::Attribute*> (*nset_iter);
354 if (attr_node == NULL) {
374 result = Granule::get_node_by_xpath (parser_, xpath);
375 if (result == NULL) {
376 error_msg_ = "Failed to retrieve card id for ";
377 error_msg_ += xpath;
355378 return -1;
356379 }
357 card_id = ::atol ((attr_node->get_value ().substr (1)).c_str ());
380 attr_node = (const char*) result;
381 card_id = ::atol ((attr_node.substr (1)).c_str ());
382 xmlFree (result);
358383
359384 /** Parse the expiration time of the card (expdate tag). If
360385 tag is not found, then we are dealing with an older file.
361386 */
362387 ASSA::TimeVal exp_time;
363 sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/expdate/text()",
388 sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/expdate",
364389 i+1, ccount);
365 nset = node_->find (xpath);
366 if ((nset_iter = nset.begin ()) == nset.end ()) {
390 result = Granule::get_node_by_xpath (parser_, xpath);
391 if (result == NULL) {
367392 exp_time = CONFIG->get_load_time (); // card expires today
368393 }
369394 else {
370 text_node = dynamic_cast<const xmlpp::TextNode*> (*nset_iter);
371 if (text_node == NULL) {
372 return -1;
373 }
374 exp_time.sec (::atol (text_node->get_content ().c_str ()));
395 exp_time.sec (::atol ((const char*) result));
396 xmlFree (result);
375397 }
376398
377399 /** Parse the source Deck path of the card
378400 */
379 sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/fromdeck/text()",
401 sprintf (xpath, "/cardfile/carddeck[%d]/card[%d]/fromdeck",
380402 i+1, ccount);
381 nset = node_->find (xpath);
382 if ((nset_iter = nset.begin ()) == nset.end ()) {
403 result = Granule::get_node_by_xpath (parser_, xpath);
404 if (result == NULL) {
383405 return -1;
384406 }
385 text_node = dynamic_cast<const xmlpp::TextNode*> (*nset_iter);
386 if (text_node == NULL) {
387 return -1;
388 }
389
390 deck_path = Glib::locale_from_utf8 (text_node->get_content ());
407 deck_path = Glib::locale_from_utf8 ((const char*) result);
408 xmlFree (result);
391409
392410 if (deck_path[0] != G_DIR_SEPARATOR) {
393411 abs_path = calculate_absolute_path (CONFIG->get_proj_path (),
416434 }
417435 } // for (each card)
418436
437 DL((GRAPP,"Processed %d cards\n", m_card_deck [i].size ()));
419438 m_card_deck [i].sort_by_expiration_time ();
420439 sprintf (total_count, "%d cards", cloaded);
421440 update_count (i);
433452 {
434453 trace_with_mask("CardBox::save",GUITRACE);
435454
436 xmlpp::Document deck_xml;
437 xmlpp::Element* deck_node;
438 xmlpp::Element* carddeck;
439 xmlpp::Element* card;
440 xmlpp::Element* path;
441 xmlpp::TextNode* txt_node;
455 static const char dtd_url[] = "http://granule.sourceforge.net/cardfile.dtd";
442456
443457 std::string abs_fname;
444458 const std::string proj_path (CONFIG->get_proj_path ());
445459 std::string deck_fname;
446460 VDeck::cardlist_iterator citer;
447 CardRef* card_ref;
461 CardRef* card_ref = NULL;
462 int ret = 0;
463
464 xmlTextWriterPtr writer;
448465
449466 DL((GRAPP,"Saving to \"%s\"\n", m_fname.c_str ()));
450467 ::unlink (m_fname.c_str ());
451 deck_xml.set_internal_subset ("cardfile", "", "http://granule.sourceforge.net/cardfile.dtd");
452 deck_node = deck_xml.create_root_node ("cardfile");
468
469 writer = xmlNewTextWriterFilename (m_fname.c_str (), 0);
470 if (writer == NULL) {
471 return -1;
472 }
473
474 ret = xmlTextWriterStartDocument (writer, NULL, "UTF-8", NULL);
475 if (ret < 0) {
476 xmlFreeTextWriter (writer);
477 return -1;
478 }
479
480 xmlTextWriterSetIndent(writer, 0);
481 xmlTextWriterStartDTD (writer, BAD_CAST "cardfile", NULL, BAD_CAST dtd_url);
482 xmlTextWriterSetIndent(writer, 1);
483 xmlTextWriterEndDTD (writer);
484
485 ret = xmlTextWriterStartElement (writer, BAD_CAST "cardfile");
453486
454487 for (int i = 0; i < CARD_BOX_SIZE; i++) {
455 carddeck = deck_node->add_child ("carddeck");
488 ret = xmlTextWriterStartElement (writer, BAD_CAST "carddeck");
456489 citer = m_card_deck [i].begin ();
490
457491 while (citer != m_card_deck [i].end ()) {
492
458493 if ((card_ref = dynamic_cast<CardRef*> (*citer)) != NULL) {
459 card = carddeck->add_child ("card");
460 card->set_attribute ("id", (*citer)->get_id_str ());
461
462 path = card->add_child ("fromdeck");
494 ret = xmlTextWriterStartElement (writer, BAD_CAST "card");
495 ret = xmlTextWriterWriteAttribute (writer, BAD_CAST "id",
496 BAD_CAST (*citer)->get_id_str ().c_str ());
497
463498 abs_fname = card_ref->get_deck ().get_name ();
464499 if (CONFIG->with_relpaths ()) {
465500 deck_fname = calculate_relative_path (proj_path, abs_fname);
467502 else {
468503 deck_fname = abs_fname;
469504 }
470 txt_node = path->add_child_text (
471 Glib::locale_to_utf8 (deck_fname));
472
473 path = card->add_child ("expdate");
474 txt_node = path->add_child_text (
475 card_ref->get_expiration_str ());
505 ret = xmlTextWriterWriteElement (writer, BAD_CAST "fromdeck",
506 BAD_CAST Glib::locale_to_utf8 (deck_fname).c_str ());
507
508 ret = xmlTextWriterWriteElement (writer, BAD_CAST "expdate",
509 BAD_CAST card_ref->get_expiration_str ().c_str ());
510 ret = xmlTextWriterEndElement (writer);
476511 }
477512 citer++;
478513 }
479 }
480 deck_xml.write_to_file_formatted (m_fname, "UTF-8");
514 ret = xmlTextWriterEndElement (writer); // carddeck
515 }
516
517 xmlTextWriterEndElement (writer); // @end cardfile
518 xmlFreeTextWriter (writer); // cleanup
519
520 return ret;
481521 }
482522
483523 int
565605 add_deck_to_box (int idx_, Deck* from_deck_)
566606 {
567607 trace_with_mask("CardBox::add_deck_to_box",GUITRACE);
568 Assert_exit (idx_ < CARD_BOX_SIZE);
569 Assert_exit (from_deck_);
608 Assure_exit (idx_ < CARD_BOX_SIZE);
609 Assure_exit (from_deck_);
570610
571611 if (m_fname.empty ()) {
572612 Gtk::MessageDialog em (_("First, open or create\na Card Box file."),
00 // -*- c++ -*-
11 //------------------------------------------------------------------------------
2 // $Id: CardBox.h,v 1.23 2004/12/13 04:29:03 vlg Exp $
2 // $Id: CardBox.h,v 1.24 2005/11/13 02:50:48 vlg Exp $
33 //------------------------------------------------------------------------------
44 // CardBox.h
55 //------------------------------------------------------------------------------
6 // Copyright (c) 2004 by Vladislav Grinchenko
6 // Copyright (c) 2004,2005 by Vladislav Grinchenko
77 //
88 // This program is free software; you can redistribute it and/or
99 // modify it under the terms of the GNU General Public License
8686 void repaint_deck_players ();
8787
8888 private:
89 struct CardBoxIF {
89 struct CardBoxIF
90 {
9091 Gtk::Image* m_sched_light; // Light button to indicate % of overdue
9192 Gtk::Label* m_sched_count; // How many cards are overdue
9293 Gtk::VBox* m_sched_vbox; // Vbox to hold scheduling widgets
99100 m_total_count (NULL), m_expired_count (0)
100101 { /* no-op */ }
101102
102 void reset () {
103 void reset ()
104 {
103105 m_sched_count->set_text ("0");
104106 m_total_count->set_text ("0 cards");
105107 m_expired_count = 0;
107109 void add_one () { m_expired_count++; }
108110 };
109111
110 int parse_xml_tree (const xmlpp::Node* node_);
112 int parse_xml_tree (xmlDocPtr parser_, string error_msg_);
111113 void update_count (int idx_);
112114
113115 /** Take an absolute path and absolute file name and calculate resultant
145147 DeckPlayer* m_cdplayers [CARD_BOX_SIZE];
146148 };
147149
150 inline CardBox::
151 ~CardBox ()
152 {
153 trace_with_mask("CardBox::~CardBox",GUITRACE);
154 }
155
148156 #endif /* CARD_BOX_H */
11 //------------------------------------------------------------------------------
22 // CardDeck.cpp
33 //------------------------------------------------------------------------------
4 // $Id: CardDeck.cpp,v 1.16 2005/05/08 18:48:00 vlg Exp $
4 // $Id: CardDeck.cpp,v 1.18 2005/11/13 02:50:48 vlg Exp $
55 //
66 // Copyright (c) 2004 by Vladislav Grinchenko
77 //
2020 #include "Granule-main.h"
2121 #include "Intern.h"
2222
23 static const char* box_names[] = {
23 static const char* box_names [] =
24 {
2425 N_("Card Box 1"), N_("Card Box 2"),
2526 N_("Card Box 3"), N_("Card Box 4"),
2627 N_("Card Box 5")
2728 };
29
2830 void
2931 CardDeck::
3032 set_name (int idx_)
4143 return (idx);
4244 }
4345 }
44 Assert_exit (false);
46 Assure_exit (false);
4547 }
4648
4749 bool
4951 erase (VCard* vcard_)
5052 {
5153 trace_with_mask("CardDeck::erase(VCard)",GUITRACE|DECK);
54
5255 cardlist_iterator p = m_cards.begin ();
5356 while (p != m_cards.end ()) {
5457 if ((*p) == vcard_) {
6366 play_card (VDeck::cardlist_iterator& iter_)
6467 {
6568 CardRef* cref = dynamic_cast<CardRef*>(*iter_);
66 Assert_exit (cref);
69 Assure_exit (cref);
6770 cref->get_deck ().play_card (iter_);
6871 }
6972
8386 while (q != m_cards.end ()) {
8487 cr_p = dynamic_cast<CardRef*> (*p);
8588 cr_q = dynamic_cast<CardRef*> (*q);
86 Assert_exit (cr_p && cr_q);
89 Assure_exit (cr_p && cr_q);
8790 if (cr_p->get_card ().get_id () == cr_q->get_card ().get_id ()) {
8891 delete (*q);
8992 m_cards.erase (q);
11 //------------------------------------------------------------------------------
22 // CardDeck.h
33 //------------------------------------------------------------------------------
4 // $Id: CardDeck.h,v 1.14 2004/11/27 20:44:39 vlg Exp $
4 // $Id: CardDeck.h,v 1.16 2005/11/13 02:50:48 vlg Exp $
55 //
66 // Copyright (c) 2004 by Vladislav Grinchenko
77 //
2525 class Compare_CardRefs {
2626 public:
2727 int operator () (VCard* const& vc1_, VCard* const& vc2_)
28 {
29 CardRef* cr1 = dynamic_cast<CardRef*> (vc1_);
30 CardRef* cr2 = dynamic_cast<CardRef*> (vc2_);
31 Assert_exit (cr1 && cr2);
32 return (cr1->get_card ().get_id () < cr2->get_card ().get_id ());
33 }
28 {
29 CardRef* cr1 = dynamic_cast<CardRef*> (vc1_);
30 CardRef* cr2 = dynamic_cast<CardRef*> (vc2_);
31 Assure_exit (cr1 && cr2);
32 return (cr1->get_card ().get_id () < cr2->get_card ().get_id ());
33 }
3434 };
3535
3636 class Compare_ExpTime_CardRefs {
3737 public:
3838 int operator () (VCard* const& vc1_, VCard* const& vc2_)
39 {
40 /*
41 CardRef* cr1 = dynamic_cast<CardRef*> (vc1_);
42 CardRef* cr2 = dynamic_cast<CardRef*> (vc2_);
43 Assert_exit (cr1 && cr2);
44 return (cr1->get_expiration () < cr2->get_expiration ());
45 */
46 return ((*vc1_) < (*vc2_));
47 }
39 {
40 return ((*vc1_) < (*vc2_));
41 }
4842 };
4943
5044 /**
11 //------------------------------------------------------------------------------
22 // CardView.cpp
33 //------------------------------------------------------------------------------
4 // $Id: CardView.cpp,v 1.21 2005/06/11 04:42:43 vlg Exp $
4 // $Id: CardView.cpp,v 1.28 2005/11/27 23:54:36 vlg Exp $
55 //
66 // Copyright (c) 2004-2005 by Vladislav Grinchenko
77 //
3030 #include "DeckView.h"
3131 #include "Card.h"
3232 #include "CardRef.h"
33 #include "EditControls.h"
3334 #include "Intern.h"
3435
3536 CardView::
4243 m_front_text (NULL),
4344 m_back_text (NULL),
4445 m_example_text (NULL),
46 m_edit_controls (NULL),
4547 m_syntax_error (false),
4648 m_keep_open (false),
4749 m_help_dialog (*this)
245247 hbox5->pack_start (*label5, Gtk::PACK_SHRINK, 0);
246248 alignment8->add (*hbox5);
247249
248 m_help_button->set_flags (Gtk::CAN_FOCUS);
250 m_help_button->unset_flags (Gtk::CAN_FOCUS); // Take help off the chain
249251 m_help_button->set_relief (Gtk::RELIEF_NORMAL);
250252 m_help_button->add (*alignment8);
251253
262264 m_back_text->set_indent (0);
263265 m_back_text->set_wrap_mode (Gtk::WRAP_WORD);
264266 m_back_text->set_justification (Gtk::JUSTIFY_LEFT);
267 m_back_text->set_accepts_tab (false);
265268 m_back_text->get_buffer ()->set_text (_("Fill up the back of the card"));
266269
267270 backtext_scrollwin->set_flags (Gtk::CAN_FOCUS);
293296 m_example_text->set_indent (0);
294297 m_example_text->set_wrap_mode (Gtk::WRAP_WORD);
295298 m_example_text->set_justification (Gtk::JUSTIFY_LEFT);
299 m_example_text->set_accepts_tab (false);
296300 m_example_text->get_buffer ()->set_text (_("Fill up an example"));
297301
298302 example_scrollwin->set_flags (Gtk::CAN_FOCUS);
310314 example_label->set_selectable (false);
311315 vbox_examplelabel->pack_start (*example_label, Gtk::PACK_SHRINK, 0);
312316
313 // Front Text
317 /** Add EditControls
318 */
319 m_edit_controls = Gtk::manage(new EditControls(m_front_text->get_buffer()));
320 vbox_examplelabel->pack_end (*m_edit_controls, Gtk::PACK_SHRINK, 0);
321
322 m_front_text->signal_grab_focus ().connect (
323 bind<Gtk::TextView*> (mem_fun (*m_edit_controls,
324 &EditControls::on_focus_changed),
325 m_front_text));
326
327 m_back_text->signal_grab_focus ().connect (
328 bind<Gtk::TextView*> (mem_fun (*m_edit_controls,
329 &EditControls::on_focus_changed),
330 m_back_text));
331
332 m_example_text->signal_grab_focus ().connect (
333 bind<Gtk::TextView*> (mem_fun (*m_edit_controls,
334 &EditControls::on_focus_changed),
335 m_example_text));
336
337 /** Front Text
338 */
314339 m_front_text->set_flags (Gtk::CAN_FOCUS);
315340 m_front_text->set_border_width (3);
316341 m_front_text->set_editable (true);
323348 m_front_text->set_indent (0);
324349 m_front_text->set_wrap_mode (Gtk::WRAP_WORD);
325350 m_front_text->set_justification (Gtk::JUSTIFY_LEFT);
351 m_front_text->set_accepts_tab (false);
326352 m_front_text->get_buffer ()->set_text (_("Fill up the front of the card"));
327353
328354 front_scrollwin->set_flags (Gtk::CAN_FOCUS);
340366 front_label->set_selectable (false);
341367 alignment6->add (*front_label);
342368 vbox_frontlabel->pack_start (*alignment6, Gtk::PACK_SHRINK, 0);
343
369
344370 /**
345371 * Table holds elements together:
346372 *
351377 elems_table->set_border_width (4);
352378 elems_table->set_row_spacings (8);
353379 elems_table->set_col_spacings (2);
380 elems_table->set_name ("CardViewElemsTable");
354381
355382 elems_table->attach (*vbox_frontlabel, 0, 1, 0, 1,
356383 Gtk::FILL, Gtk::FILL, 0, 0);
379406 hbuttonbox->set_homogeneous ();
380407 hbuttonbox->set_spacing (8);
381408 hbuttonbox->set_layout (Gtk::BUTTONBOX_END);
409 hbuttonbox->set_name ("CardView_CtrlButtonBox");
382410
383411 hbuttonbox->pack_end (*m_cancel_button, false, false, 1);
384412 hbuttonbox->pack_end (*m_add_button, false, false, 1);
416444 m_example_text->get_buffer ()->set_text (m_card->get_example ());
417445 }
418446
447 /** Set Widget names - very helpful with debugging!
448 */
449 m_front_text->set_name ("FrontText");
450 m_back_text ->set_name ("BackText");
451 m_example_text->set_name ("ExampleText");
452 m_help_button->set_name ("HelpButton");
453 m_cancel_button->set_name ("CancelButton");
454 m_add_button->set_name ("AddButton");
455 m_add_n_close_button->set_name ("AddNCloseButton");
456
457 vbox_all->set_name ("CardView_VBoxAll");
458
419459 show_all_children ();
420460 }
421461
424464 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
425465
426466 /**
427 * Called to just edit an existing card:
467 * Called by the following methods to edit an existing card:
428468 *
429469 * - DeckPlayer::on_vcard_edit_clicked ()
430470 * - DeckView::on_edit_clicked ()
431471 */
432472 int
433473 CardView::
434 run ()
435 {
436 trace_with_mask("CardView::run",GUITRACE);
474 run (bool disable_cancel_)
475 {
476 trace_with_mask("CardView::run(bool)",GUITRACE);
437477
438478 m_syntax_error = false;
439479 m_add_button->set_sensitive (false);
480 if (disable_cancel_) {
481 m_cancel_button->set_sensitive (false);
482 }
483 take_snapshot ();
440484 Gtk::Main::run (*this);
441
442485 return (m_syntax_error ? Gtk::RESPONSE_REJECT : m_response);
443486 }
444487
463506 trace_with_mask("CardView::run(DeckView&)",GUITRACE);
464507 int ret = 0;
465508 m_syntax_error = false;
509 take_snapshot ();
466510
467511 Gtk::Main::run (*this);
468512
469513 if (m_syntax_error) {
514 DL ((GRAPP,"Caught a syntax error (RESPONSE_REJECT)\n"));
470515 delete m_card;
471516 return (Gtk::RESPONSE_REJECT);
472517 }
473518
474 if (ret == Gtk::RESPONSE_CANCEL) {
519 if (m_response == Gtk::RESPONSE_CANCEL) {
520 DL ((GRAPP,"Dialog cancelled (RESPONSE_CANCEL)\n"));
475521 delete m_card;
476522 return (m_response);
477523 }
539585
540586 m_response = Gtk::RESPONSE_OK;
541587
542 if (!check_markup (m_front_text->get_buffer ()->get_text ())) {
543 Gtk::MessageDialog err1 (_("FRONT field contains illegal markup tag(s)."),
544 false, Gtk::MESSAGE_ERROR);
588 if (!Granule::check_markup (m_front_text->get_buffer ()->get_text ())) {
589 Gtk::MessageDialog err1 (
590 _("FRONT field contains illegal markup tag(s)."),
591 false, Gtk::MESSAGE_ERROR);
545592 err1.run ();
546593 m_syntax_error = true;
547594 return;
548595 }
549 if (!check_markup (m_back_text->get_buffer ()->get_text ())) {
550 Gtk::MessageDialog err2 (_("BACK field contains illegal markup tag(s)."),
551 false, Gtk::MESSAGE_ERROR);
596
597 if (!Granule::check_markup (m_back_text->get_buffer ()->get_text ())) {
598 Gtk::MessageDialog err2 (
599 _("BACK field contains illegal markup tag(s)."),
600 false, Gtk::MESSAGE_ERROR);
552601 err2.run ();
553602 m_syntax_error = true;
554603 return;
555604 }
556 if (!check_markup (m_example_text->get_buffer ()->get_text ())) {
557 Gtk::MessageDialog err2 (_("EXAMPLE field contains illegal markup tag(s)."),
558 false, Gtk::MESSAGE_ERROR);
605
606 if (!Granule::check_markup (m_example_text->get_buffer ()->get_text ())) {
607 Gtk::MessageDialog err2 (
608 _("EXAMPLE field contains illegal markup tag(s)."),
609 false, Gtk::MESSAGE_ERROR);
559610 err2.run ();
560611 m_syntax_error = true;
561612 return;
563614
564615 /** Transfer data from the widget to the card
565616 */
566 if (m_card != NULL) {
617 if (m_card != NULL && text_modified ()) {
567618 m_card->set_question (m_front_text ->get_buffer ()->get_text ());
568619 m_card->set_answer (m_back_text ->get_buffer ()->get_text ());
569620 m_card->set_example (m_example_text->get_buffer ()->get_text ());
570621 }
571622 m_keep_open = false;
623 m_front_text->grab_focus ();
572624
573625 Gtk::Main::quit ();
626 }
627
628 void
629 CardView::
630 take_snapshot ()
631 {
632 trace_with_mask("CardView::take_snapshot",GUITRACE);
633
634 m_snapshot_front = m_front_text ->get_buffer ()->get_text ();
635 m_snapshot_back = m_back_text ->get_buffer ()->get_text ();
636 m_snapshot_example = m_example_text->get_buffer ()->get_text ();
637 }
638
639 bool
640 CardView::
641 text_modified ()
642 {
643 return (m_snapshot_front != m_front_text ->get_buffer ()->get_text () ||
644 m_snapshot_back != m_back_text ->get_buffer ()->get_text () ||
645 m_snapshot_example != m_example_text->get_buffer ()->get_text ());
574646 }
575647
576648 void
601673 m_front_text ->get_buffer ()->set_text ("");
602674 m_back_text ->get_buffer ()->set_text ("");
603675 m_example_text->get_buffer ()->set_text ("");
604 }
605
606 bool
607 CardView::
608 check_markup (const Glib::ustring& str_)
609 {
610 PangoAttrList* attrs = NULL;
611 gchar* ptext = NULL;
612 gboolean ret = FALSE;
613
614 ret = pango_parse_markup (str_.c_str (), -1, 0, &attrs, &ptext, NULL, NULL);
615
616 g_free (attrs);
617 g_free (ptext);
618
619 return ret;
676
677 m_snapshot_front = "";
678 m_snapshot_back = "";
679 m_snapshot_example = "";
620680 }
621681
622682 void
11 //------------------------------------------------------------------------------
22 // CardView.h
33 //------------------------------------------------------------------------------
4 // $Id: CardView.h,v 1.12 2005/06/11 04:42:43 vlg Exp $
4 // $Id: CardView.h,v 1.15 2005/11/27 04:59:22 vlg Exp $
55 //
66 // Copyright (c) 2004-2005 by Vladislav Grinchenko
77 //
2929
3030 class VCard;
3131 class DeckView;
32 class EditControls;
3233
3334 class CardView : public Gtk::Window
3435 {
4445 void size_allocate_cb (Gtk::Allocation& size_);
4546
4647 /** Our own implementation of run().
48 *
49 * @param disable_cancel_ if true, disables cancel button.
4750 */
48 int run ();
51 int run (bool disable_cancel_ = false);
4952
5053 /** This run is called by DeckView to add a new card
5154 (or multiple cards without closing the dialog)
5255 */
5356 int run (DeckView& deckview_);
57
58 private:
59 class Snapshot
60 {
61
62 private:
63 };
5464
5565 private:
5666 virtual bool on_key_press_event (GdkEventKey* event_);
6070 void on_help_clicked ();
6171 void on_cancel_clicked ();
6272
63 bool check_markup (const Glib::ustring& str_);
6473 void clear_dialog ();
74
75 void take_snapshot ();
76 bool text_modified ();
6577
6678 private:
6779 VCard* m_card;
8092 Gtk::TextView* m_back_text;
8193 Gtk::TextView* m_example_text;
8294
95 // -*- Snapshot to detect true changes -*-
96 Glib::ustring m_snapshot_front;
97 Glib::ustring m_snapshot_back;
98 Glib::ustring m_snapshot_example;
99
100 EditControls* m_edit_controls;
101
83102 CardViewHelpDialog m_help_dialog;
84103 };
85104
11 //------------------------------------------------------------------------------
22 // Config.cpp
33 //------------------------------------------------------------------------------
4 // $Id: Config.cpp,v 1.34 2005/05/08 19:39:44 vlg Exp $
4 // $Id: Config.cpp,v 1.37 2005/11/22 01:39:53 vlg Exp $
55 //------------------------------------------------------------------------------
66 // Copyright (c) 2004-2005 by Vladislav Grinchenko
77 //
3636 #include "Granule.h"
3737
3838 using namespace ASSA;
39 using ASSA::Utils::split_pair;
3940
4041 ASSA_DECL_SINGLETON(Config);
4142
4647 int secs_in_day_,
4748 int secs_in_week_)
4849 {
50 ASSA::TimeVal hhmm (::atoi (m_hours.c_str ()) * 360 +
51 ::atoi (m_mins.c_str ()) * 60);
4952 m_tv = load_time_ +
5053 ASSA::TimeVal (::atoi (m_days.c_str ()) * secs_in_day_) +
51 ASSA::TimeVal (::atoi (m_weeks.c_str ()) * secs_in_week_);
54 ASSA::TimeVal (::atoi (m_weeks.c_str ()) * secs_in_week_) +
55 hhmm;
5256 }
5357
5458 /******************************************************************************/
5660 SchedReview::
5761 dump (int idx_)
5862 {
59 DL((GRAPP,"Deck %d sched = %s/%s (%ld secs : %s)\n", idx_,
60 m_days.c_str (), m_weeks.c_str (),
63 DL((GRAPP,"Deck %d sched = %s/%s/%s/%s (%ld secs : %s)\n", idx_,
64 m_weeks.c_str (), m_days.c_str (), m_hours.c_str (), m_mins.c_str (),
6165 m_tv.sec (), m_tv.fmtString ("%c").c_str ()));
62
6366 }
6467
6568 /******************************************************************************/
8790 */
8891 char* ptr = NULL;
8992 ptr = new char [PATH_MAX+1];
90 Assert_exit (getcwd (ptr, PATH_MAX) != NULL);
93 Assure_exit (getcwd (ptr, PATH_MAX) != NULL);
9194 m_path_name = ptr;
9295 delete [] ptr;
9396
258261 * {front|back}<index>=/path/to/file
259262 *
260263 * [Scheduling]
261 * 1=7/0
262 * 2=0/1
263 * 3=0/2
264 * 4=0/3
265 * 5=0/4
264 * 1=7/0/0/0
265 * 2=0/1/0/0
266 * 3=0/2/0/0
267 * 4=0/3/0/0
268 * 5=0/4/0/0
266269 *
267270 * [Default]
268271 * filesel_path=/path/to/
295298 IniFile::const_config_iterator section;
296299
297300 if (m_config == NULL) {
298 s = GRANULE->getAltConfigName ();
301 s = GRANULE->get_config_file ();
299302 if (s.size () == 0) {
300 s = GRANULE->getStdConfigName ();
303 s = GRANULE->get_default_config_file ();
301304 }
302305 m_config = new IniFile (s);
303306 if (m_config->load () < 0) {
348351 DL((APP,"Section [FlipSide] was not found in \"~/.granule\".\n"));
349352 }
350353
351 /** Load [Scheduling] section:
354 /** Load [Scheduling] section.
355 We have to detect and convert old format:
356
357 old: days/weeks
358 new: weeks/days/hours/minutes
352359 */
353360 section = m_config->find_section ("Scheduling");
361
354362 if (section != m_config->sect_end ()) {
355363 DL((APP,"Scanning [History] section ...\n"));
356364 IniFile::const_tuple_iterator k = (*section).second.begin ();
365 std::string lhs;
366 std::string rhs;
367
357368 while (k != (*section).second.end ()) {
358369 idx = ::atoi ((*k).first.c_str ()) - 1;
359 ASSA::Utils::split_pair ((*k).second,
360 '/',
361 m_sched [idx].m_days,
362 m_sched [idx].m_weeks);
370 split_pair ((*k).second, '/',
371 m_sched [idx].m_days, m_sched [idx].m_weeks);
372
373 if (split_pair (m_sched [idx].m_weeks, '/', lhs, rhs) == 0) {
374 m_sched [idx].m_weeks = m_sched [idx].m_days;
375 m_sched [idx].m_days = lhs;
376 m_sched [idx].m_hours = rhs;
377 split_pair (m_sched [idx].m_hours, '/', lhs, rhs);
378 m_sched [idx].m_hours = lhs;
379 m_sched [idx].m_mins = rhs;
380 }
363381 m_sched [idx].set_delay (m_load_time, secs_in_day_, secs_in_week_);
364382 m_sched [idx].dump (idx);
365383 k++;
458476
459477 m_root_x = ::atoi (m_config->get_value ("Default", "root_x").c_str ());
460478 m_root_y = ::atoi (m_config->get_value ("Default", "root_y").c_str ());
479
480 if (m_config->get_value ("Default", "disable_key_shortcuts") == "true") {
481 m_disable_key_shortcuts = true;
482 }
483 else {
484 m_disable_key_shortcuts = false;
485 }
461486 }
462487
463488 /******************************************************************************
472497 std::string s;
473498
474499 if (m_config == NULL) {
475 s = GRANULE->getAltConfigName ();
500 s = GRANULE->get_config_file ();
476501 if (s.size () == 0) {
477 s = GRANULE->getStdConfigName ();
502 s = GRANULE->get_default_config_file ();
478503 }
479504 m_config = new IniFile (s);
480505 s = "";
519544 ckey << (j + 1);
520545 m_config->set_pair ("Scheduling",
521546 IniFile::tuple_type (ckey.str (),
522 m_sched [j].m_days + '/' + m_sched [j].m_weeks));
547 m_sched [j].m_weeks + '/' +
548 m_sched [j].m_days + '/' +
549 m_sched [j].m_hours + '/' +
550 m_sched [j].m_mins));
523551 }
524552
525553 /** Flip the side so that next time it would be the back of the Deck.
592620 sprintf (buf, "%d", m_root_y);
593621 m_config->set_pair ("Default", IniFile::tuple_type ("root_y", buf));
594622
623 m_config->set_pair ("Default", IniFile::tuple_type ("disable_key_shortcuts",
624 (m_disable_key_shortcuts ? "true":"false")));
595625 /** Flush to disk
596626 */
597627 m_config->sync ();
11 //------------------------------------------------------------------------------
22 // Config.h
33 //------------------------------------------------------------------------------
4 // $Id: Config.h,v 1.26 2005/01/16 22:14:46 vlg Exp $
5 //------------------------------------------------------------------------------
6 // Copyright (c) 2004 by Vladislav Grinchenko
4 // $Id: Config.h,v 1.29 2005/11/22 01:39:53 vlg Exp $
5 //------------------------------------------------------------------------------
6 // Copyright (c) 2004,2005 by Vladislav Grinchenko
77 //
88 // This program is free software; you can redistribute it and/or
99 // modify it under the terms of the GNU General Public License
3636 {
3737 string m_days; // number of days
3838 string m_weeks; // number of weeks
39 string m_hours;
40 string m_mins;
41
42 SchedReview () : m_days ("0"), m_weeks ("0"), m_hours ("0"), m_mins ("0")
43 { /* no-op */ }
44
3945 ASSA::TimeVal m_tv; // time in seconds
4046
41 string days () const { return m_days; }
42 string weeks () const { return m_weeks; }
43 void days (const string& d_) { m_days = d_; }
44 void weeks (const string& w_) { m_weeks = w_; }
45
46 void set_delay (const ASSA::TimeVal& load_time_,
47 int secs_in_day_,
48 int secs_in_week_);
49 void dump (int idx_);
47 string days () const { return m_days; }
48 string weeks () const { return m_weeks; }
49 string hours () const { return m_hours; }
50 string mins () const { return m_mins; }
51
52 void days (const string& d_) { m_days = d_; }
53 void weeks (const string& w_) { m_weeks = w_; }
54 void hours (const string& h_) { m_hours = h_; }
55 void mins (const string& m_) { m_mins = m_; }
56
57 void set_delay (const ASSA::TimeVal& load_time_,
58 int secs_in_day_,
59 int secs_in_week_);
60 void dump (int idx_);
5061 };
5162
5263 class Config : public ASSA::Singleton<Config>
96107 */
97108 string get_sched_review_days (int idx_) { return m_sched [idx_].days (); }
98109 string get_sched_review_weeks (int idx_) { return m_sched [idx_].weeks (); }
99
100 void set_sched_review_days (int idx_, const string& s_) {
101 m_sched [idx_].days (s_);
102 }
103 void set_sched_review_weeks (int idx_, const string& s_) {
104 m_sched [idx_].weeks (s_);
105 }
110 string get_sched_review_hours (int idx_) { return m_sched [idx_].hours (); }
111 string get_sched_review_mins (int idx_) { return m_sched [idx_].mins (); }
112
113 void set_sched_review_days (int idx_, const string& s_);
114 void set_sched_review_weeks (int idx_, const string& s_);
115 void set_sched_review_hours (int idx_, const string& s_);
116 void set_sched_review_mins (int idx_, const string& s_);
106117
107118 /// Return timestamp when the program was started.
108119 ASSA::TimeVal get_load_time () const { return m_load_time; }
166177 /// Dump object's state
167178 void dump () const;
168179 void dump_document_history () const;
180
181 /** If true, ignore key_press events in DeckPlayer. This allows
182 IM with conflicting key strokes to be still functional.
183 */
184 bool disable_key_shortcuts () const { return m_disable_key_shortcuts; }
185 void disable_key_shortcuts (bool b_) { m_disable_key_shortcuts = b_; }
169186
170187 private:
171188 Config (const Config&); // copy constructor
214231 int m_secs_in_week; // Seconds in a week
215232 int m_root_x; // X-coordinate of MainWindow on desktop
216233 int m_root_y; // Y-coordinate of MainWindow on desktop
234 bool m_disable_key_shortcuts; // No keyboard navigation
217235 };
218236
219237 // Global locator
220238
221 #define CONFIG Config::getInstance()
239 #define CONFIG Config::get_instance()
222240
223241 //------------------------------------------------------------------------------
224242 // Inlines
299317 {
300318 return (m_sched [idx_].m_tv);
301319 }
320
321 inline void Config::set_sched_review_days (int idx_, const string& s_)
322 {
323 m_sched [idx_].days (s_);
324 }
325
326 inline void Config::set_sched_review_weeks (int idx_, const string& s_)
327 {
328 m_sched [idx_].weeks (s_);
329 }
330
331 inline void Config::set_sched_review_hours (int idx_, const string& s_)
332 {
333 m_sched [idx_].hours (s_);
334 }
335
336 inline void Config::set_sched_review_mins (int idx_, const string& s_)
337 {
338 m_sched [idx_].mins (s_);
339 }
302340
303341 #endif /* CONFIG_H */
11 //------------------------------------------------------------------------------
22 // Deck.cpp
33 //------------------------------------------------------------------------------
4 // $Id: Deck.cpp,v 1.39 2005/06/17 03:09:31 vlg Exp $
4 // $Id: Deck.cpp,v 1.41 2005/11/13 02:50:48 vlg Exp $
55 //
6 // Copyright (c) 2004 by Vladislav Grinchenko
6 // Copyright (c) 2004-2005 by Vladislav Grinchenko
77 //
88 // This program is free software; you can redistribute it and/or
99 // modify it under the terms of the GNU General Public License
3333
3434 /** Compare real cards by their IDs
3535 */
36 class Compare_Cards {
36 class Compare_Cards
37 {
3738 public:
3839 int operator () (VCard* const& vc1_, VCard* const& vc2_)
39 {
40 Card* cr1 = dynamic_cast<Card*> (vc1_);
41 Card* cr2 = dynamic_cast<Card*> (vc2_);
42 Assert_exit (cr1 && cr2);
43 return (cr1->get_id () < cr2->get_id ());
44 }
40 {
41 Card* cr1 = dynamic_cast<Card*> (vc1_);
42 Card* cr2 = dynamic_cast<Card*> (vc2_);
43 Assure_exit (cr1 && cr2);
44 return (cr1->get_id () < cr2->get_id ());
45 }
4546 };
4647
4748 /** C'tor for the new deck
6566 dump_deck_status ();
6667 }
6768
69 int
70 Deck::
71 load (const string& fname_, DeckAction action_)
72 {
73 trace_with_mask("Deck::load",GUITRACE|DECK);
74 DL((DECK|APP,"Loading \"%s\" ...\n", fname_.c_str ()));
75
76 string error_msg;
77 xmlParserCtxtPtr context;
78 xmlDocPtr parser;
79
80 context = xmlCreateFileParserCtxt (fname_.c_str ()); // new
81
82 if (!context) {
83 DL((GRAPP,"Failed to parse \"%s\"\n", fname_.c_str ()));
84 DECKMGR->on_deck_loaded (this, LOAD_FAILED);
85 xmlFreeParserCtxt (context);
86 return -1;
87 }
88 // Initialize context
89 context->linenumbers = 1;
90 context->validate = 1;
91
92 //Tell the validity context about the callbacks:
93 //(These are only called if validation is on - see above)
94 //
95 // context->vctxt.error = &callback_validity_error;
96 // context->vctxt.warning = &callback_validity_warning;
97
98 context->replaceEntities = 1;
99
100 // Parse the document
101 xmlParseDocument (context);
102
103 if(!context->wellFormed) {
104 xmlFreeParserCtxt (context);
105 return -1;
106 }
107 if (context->errNo != 0) {
108 xmlFreeParserCtxt (context);
109 return -1;
110 }
111 parser = context->myDoc;
112 xmlFreeParserCtxt (context); // not needed anymore?
113
114 if (action_ == INSTALL_DECK) {
115 m_fname = fname_;
116 }
117
118 DL((GRAPP,"Parsing the deck ...\n"));
119
120 if (parse_xml_tree (parser, error_msg) < 0) {
121 DECKMGR->on_deck_loaded (this, LOAD_FAILED);
122 Gtk::MessageDialog emsg (error_msg, MESSAGE_ERROR);
123 emsg.run ();
124 xmlFreeDoc (parser);
125 return -1;
126 }
127
128 if (action_ == INSTALL_DECK) {
129 DECKMGR->on_deck_loaded (this, LOAD_OK);
130 }
131 m_status = CLEAN_DECK;
132 dump_deck_status ();
133
134 xmlFreeDoc (parser);
135 return 0;
136 }
137
138 int
139 Deck::
140 parse_xml_tree (xmlDocPtr parser_, std::string& error_msg_)
141 {
142 trace_with_mask("Deck::parse_xml_tree",GUITRACE|DECK);
143
144 char xpath [64];
145 xmlChar* result;
146 Card* card;
147 std::ostringstream os;
148
149 result = Granule::get_node_by_xpath (parser_, "/deck/author");
150 if (result) {
151 m_author = (const char*) result;
152 xmlFree (result);
153 }
154
155 result = Granule::get_node_by_xpath (parser_, "/deck/description");
156 if (result) {
157 m_desc = (const char*) result;
158 xmlFree (result);
159 }
160
161 result = Granule::get_node_by_xpath (parser_, "/deck/sound_path");
162 if (result) {
163 m_snd_path = Glib::locale_from_utf8 ((const char*) result);
164 xmlFree (result);
165 }
166
167 struct stat st;
168 if (::stat (m_snd_path.c_str (), &st) != 0 || !S_ISDIR (st.st_mode)) {
169 DL((APP,"Running with sound disabled\n"));
170 DL((APP,"Path \"%s\" is wrong or non-existent\n",m_snd_path.c_str ()));
171 m_with_snd = false;
172 }
173 dump ();
174
175 /** Load the cards
176 */
177 for (int cards_counter = 1; ; cards_counter++) {
178 sprintf (xpath, "/deck/card[%d]", cards_counter);
179
180 result = Granule::get_node_by_xpath (parser_, xpath);
181 if (result == NULL) {
182 break;
183 }
184 /** Detected new card
185 */
186 card = new Card;
187
188 sprintf (xpath, "/deck/card[%d]/@id", cards_counter);
189 result = Granule::get_node_by_xpath (parser_, xpath);
190 if (result == NULL) {
191 os << "id is missing in card # " << cards_counter
192 << "\nof the deck " << m_fname;
193 error_msg_ = os.str ();
194 return -1;
195 }
196 card->set_id (::atol ((const char*) result+1));
197 xmlFree (result);
198
199 sprintf (xpath, "/deck/card[%d]/front", cards_counter);
200 result = Granule::get_node_by_xpath (parser_, xpath);
201 if (result == NULL) {
202 os << "<front> tag is missing in card # " << cards_counter
203 << "\nof the deck " << m_fname;
204 error_msg_ = os.str ();
205 return -1;
206 }
207 card->set_question ((const char*) result);
208 xmlFree (result);
209
210 sprintf (xpath, "/deck/card[%d]/back", cards_counter);
211 result = Granule::get_node_by_xpath (parser_, xpath);
212 if (result == NULL) {
213 os << "<back> tag is missing in card # " << cards_counter
214 << "\nof the deck " << m_fname;
215 error_msg_ = os.str ();
216 return -1;
217 }
218 card->set_answer ((const char*) result);
219 xmlFree (result);
220
221 /** back_example node might be empty - thus non-critical.
222 */
223 sprintf (xpath, "/deck/card[%d]/back_example", cards_counter);
224 result = Granule::get_node_by_xpath (parser_, xpath);
225 if (result) {
226 card->set_example ((const char*) result);
227 xmlFree (result);
228 }
229 card->mark_clean ();
230 m_cards.push_back (card);
231 card->dump ();
232 }
233
234 if (m_cards.size () == 0) {
235 error_msg_ = "No cards found";
236 return -1;
237 }
238
239 DL((GRAPP,"Processed %d cards\n", m_cards.size ()));
240 return 0;
241 }
242
68243 void
69244 Deck::
70 load (const string& fname_, DeckAction action_)
71 {
72 trace_with_mask("Deck::load",GUITRACE|DECK);
73
74 DL((DECK|APP,"Loading \"%s\" ...\n", fname_.c_str ()));
75
76 /** Load the Deck in XML format
77 */
78 try {
79 xmlpp::DomParser parser;
80 parser.set_validate ();
81 parser.parse_file (fname_);
82 if (!parser) {
83 DL((GRAPP,"Failed to parse \"%s\"\n", fname_.c_str ()));
84 DECKMGR->on_deck_loaded (this, LOAD_FAILED);
85 return;
86 }
87 if (action_ == INSTALL_DECK) {
88 m_fname = fname_;
89 }
90
91 /** Root node is managed by the parser
92 */
93 DL((GRAPP,"Parsing the deck ...\n"));
94 const xmlpp::Node* root_node = parser.get_document ()->get_root_node ();
95 Assert_exit (root_node);
96 parse_xml_tree (root_node);
97
98 if (action_ == INSTALL_DECK) {
99 DECKMGR->on_deck_loaded (this, LOAD_OK);
100 }
101 m_status = CLEAN_DECK;
102 dump_deck_status ();
103 }
104 catch (const std::exception& ex_) {
105 DL ((GRAPP,"Caught XML parsing exception!\n"));
106 DECKMGR->on_deck_loaded (this, LOAD_FAILED);
107 return;
108 }
109 }
110
111 void
112 Deck::
113245 insert (const string& from_fname_)
114246 {
115247 trace_with_mask("Deck::insert",GUITRACE|DECK);
248
249 Card* cr_p = NULL;
250 Card* cr_q = NULL;
116251
117252 load (from_fname_, ADD_TO_DECK);
118253 m_status = MODIFIED_DECK;
119254
120 /**
121 * Wack duplicates
122 */
123 Card* cr_p;
124 Card* cr_q;
125
255 /** Wack duplicates
256 */
126257 std::sort (m_cards.begin (), m_cards.end (), Compare_Cards ());
127258 cardlist_iterator p = m_cards.begin ();
128259 cardlist_iterator q = p + 1;
260
129261 while (q != m_cards.end ()) {
130262 cr_p = dynamic_cast<Card*> (*p);
131263 cr_q = dynamic_cast<Card*> (*q);
132 Assert_exit (cr_p && cr_q);
264 Assure_exit (cr_p && cr_q);
133265 if (cr_p->get_id () == cr_q->get_id ()) {
134266 delete (*q);
135267 m_cards.erase (q);
242374 return true;
243375 }
244376
245 void
246 Deck::
247 parse_xml_tree (const xmlpp::Node* node_)
248 {
249 trace_with_mask("Deck::traverse_xml_tree",GUITRACE|DECK);
250
251 char xpath [64];
252 const xmlpp::TextNode* text_node;
253 const xmlpp::Attribute* attr_node;
254 string id;
255 xmlpp::NodeSet nset;
256 xmlpp::NodeSet::iterator nset_iter;
257 Card* card;
258
259 nset = node_->find ("/deck/author/text()");
260 if ((nset_iter = nset.begin ()) != nset.end ()) {
261 text_node = dynamic_cast<const xmlpp::TextNode*> (*nset_iter);
262 if (text_node) {
263 m_author = text_node->get_content ();
264 }
265 }
266
267 nset = node_->find ("/deck/description/text()");
268 if ((nset_iter = nset.begin ()) != nset.end ()) {
269 text_node = dynamic_cast<const xmlpp::TextNode*> (*nset_iter);
270 if (text_node) {
271 m_desc = text_node->get_content ();
272 }
273 }
274
275 nset = node_->find ("/deck/sound_path/text()");
276 Assert_exit ((nset_iter = nset.begin ()) != nset.end ());
277 text_node = dynamic_cast<const xmlpp::TextNode*> (*nset_iter);
278 Assert_exit (text_node);
279 m_snd_path = Glib::locale_from_utf8 (text_node->get_content ());
280
281 struct stat st;
282 if (::stat (m_snd_path.c_str (), &st) != 0 || !S_ISDIR (st.st_mode)) {
283 DL((APP,"Running with sound disabled\n"));
284 DL((APP,"Path \"%s\" is wrong/non-existed\n",m_snd_path.c_str ()));
285 m_with_snd = false;
286 }
287 dump ();
288
289 for (int cards_counter = 1; ; cards_counter++) {
290 sprintf (xpath, "/deck/card[%d]", cards_counter);
291 nset = node_->find (xpath);
292 if ((nset_iter = nset.begin ()) == nset.end ()) {
293 break;
294 }
295 card = new Card;
296
297 sprintf (xpath, "/deck/card[%d]/@id", cards_counter);
298 nset = node_->find (xpath);
299 Assert_exit ((nset_iter = nset.begin ()) != nset.end ());
300 attr_node = dynamic_cast<const xmlpp::Attribute*> (*nset_iter);
301 Assert_exit (attr_node);
302 id = (attr_node->get_value ()).substr (1);
303 card->set_id (::atol (id.c_str ()));
304
305 sprintf (xpath, "/deck/card[%d]/front/text()", cards_counter);
306 nset = node_->find (xpath);
307 Assert_exit ((nset_iter = nset.begin ()) != nset.end ());
308 text_node = dynamic_cast<const xmlpp::TextNode*> (*nset_iter);
309 Assert_exit (text_node);
310 card->set_question (text_node->get_content ());
311
312 sprintf (xpath, "/deck/card[%d]/back/text()", cards_counter);
313 nset = node_->find (xpath);
314 Assert_exit ((nset_iter = nset.begin ()) != nset.end ());
315 text_node = dynamic_cast<const xmlpp::TextNode*> (*nset_iter);
316 Assert_exit (text_node);
317 card->set_answer (text_node->get_content ());
318
319 /** back_example clause might be empty - thus non-critical.
320 */
321 sprintf (xpath, "/deck/card[%d]/back_example/text()", cards_counter);
322 nset = node_->find (xpath);
323 nset_iter = nset.begin ();
324 if (nset_iter != nset.end ()) {
325 text_node = dynamic_cast<const xmlpp::TextNode*> (*nset_iter);
326 if (text_node) {
327 card->set_example (text_node->get_content ());
328 }
329 }
330
331 card->mark_clean ();
332 m_cards.push_back (card);
333 card->dump ();
334 }
335 DL((ASSA::APP,"Processed %d cards\n", m_cards.size ()));
336 }
337
338377 bool
339378 Deck::
340379 erase (VCard* vcard_)
342381 trace_with_mask("Deck::erase",GUITRACE|DECK);
343382
344383 cardlist_iterator pos;
345 Assert_exit (vcard_);
384 Assure_exit (vcard_);
346385
347386 pos = find (m_cards.begin (), m_cards.end (), vcard_);
348387 if (pos != m_cards.end ()) {
375414 Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE,
376415 true);
377416 qm.add_button ("Yes", Gtk::RESPONSE_YES);
378 qm.add_button ("No", Gtk::RESPONSE_NO);
417 qm.add_button ("No", Gtk::RESPONSE_NO);
379418 if (qm.run () == Gtk::RESPONSE_NO) {
380419 return -1;
381420 }
402441 {
403442 trace_with_mask("Deck::save",GUITRACE|DECK);
404443
405 xmlpp::Document deck_xml;
406 xmlpp::Element* deck_node;
407 xmlpp::Element* card_node;
408 xmlpp::Element* element;
409 xmlpp::TextNode* txt_node;
444 static const char dtd_url [] = "http://granule.sourceforge.net/granule.dtd";
445 int ret = 0;
446 xmlTextWriterPtr writer;
410447
411448 ::unlink (m_fname.c_str ());
412 deck_xml.set_internal_subset ("deck", "", "http://granule.sourceforge.net/granule.dtd");
413 deck_node = deck_xml.create_root_node ("deck");
414
415 element = deck_node->add_child ("author");
416 txt_node = element->add_child_text (m_author);
417
418 element = deck_node->add_child ("description");
419 txt_node = element->add_child_text (m_desc);
420
421 element = deck_node->add_child ("sound_path");
422 txt_node = element->add_child_text (Glib::locale_to_utf8 (m_snd_path));
449
450 writer = xmlNewTextWriterFilename (m_fname.c_str (), 0);
451 if (writer == NULL) {
452 return -1;
453 }
454
455 ret = xmlTextWriterStartDocument (writer, NULL, "UTF-8", NULL);
456 if (ret < 0) {
457 xmlFreeTextWriter (writer);
458 return -1;
459 }
460
461 /** We have to disable indent prior to StartDTD call and
462 enable it back again before EndDTD call to generate expected
463 indentation of XML file. Oddly enough, xmlTextWriterWriteDTD()
464 doesn't do the right thing itself.
465 */
466 xmlTextWriterSetIndent (writer, 0);
467 xmlTextWriterStartDTD (writer, BAD_CAST "deck", NULL, BAD_CAST dtd_url);
468 xmlTextWriterSetIndent (writer, 1);
469 xmlTextWriterEndDTD (writer);
470
471 xmlTextWriterSetIndentString (writer, (xmlChar*) " ");
472
473 ret = xmlTextWriterStartElement (writer, BAD_CAST "deck");
474 ret = xmlTextWriterWriteElement (writer, BAD_CAST "author",
475 BAD_CAST m_author.c_str ());
476 ret = xmlTextWriterWriteElement (writer, BAD_CAST "description",
477 BAD_CAST m_desc.c_str ());
478 ret = xmlTextWriterWriteElement (writer, BAD_CAST "sound_path",
479 BAD_CAST Glib::locale_to_utf8 (m_snd_path).c_str ());
423480
424481 cardlist_const_iterator citer = m_cards.begin ();
425482 while (citer != m_cards.end ()) {
426 card_node = deck_node->add_child ("card");
427 card_node->set_attribute ("id", (*citer)->get_id_str ());
428
429 element = card_node->add_child ("front");
430 txt_node = element->add_child_text ((*citer)->get_question ());
431
432 element = card_node->add_child ("back");
433 txt_node = element->add_child_text ((*citer)->get_answer ());
434
435 element = card_node->add_child ("back_example");
436 txt_node = element->add_child_text ((*citer)->get_example ());
437
483 ret = xmlTextWriterStartElement (writer, BAD_CAST "card");
484 ret = xmlTextWriterWriteAttribute (writer, BAD_CAST "id",
485 BAD_CAST (*citer)->get_id_str ().c_str ());
486 ret = xmlTextWriterWriteElement (writer, BAD_CAST "front",
487 BAD_CAST (*citer)->get_question ().c_str ());
488 ret = xmlTextWriterWriteElement (writer, BAD_CAST "back",
489 BAD_CAST (*citer)->get_answer ().c_str ());
490 ret = xmlTextWriterWriteElement (writer, BAD_CAST "back_example",
491 BAD_CAST (*citer)->get_example ().c_str ());
492 ret = xmlTextWriterEndElement (writer); // @end card
438493 citer++;
439494 }
440
441 deck_xml.write_to_file_formatted (m_fname, "UTF-8");
495 /** Close <deck> and write out the file
496 */
497 xmlTextWriterEndElement (writer); // @end deck
498 xmlTextWriterEndDocument (writer);
499 xmlTextWriterFlush (writer);
500 xmlFreeTextWriter (writer); // clenup
501
442502 m_status = CLEAN_DECK;
443503 m_needs_renaming = false;
444504
451511 }
452512
453513 dump_deck_status ();
514 return (ret);
454515 }
455516
456517 void
480541
481542 cardlist_iterator iter = m_cards.begin ();
482543 while (iter != m_cards.end ()) {
544 DL ((GRAPP,"Trying id=%ld\n", (*iter)->get_id ()));
483545 if ((*iter)->get_id () == id_) {
546 DL ((GRAPP,"... that's a match\n"));
484547 return (*iter);
485548 }
486549 iter++;
11 //------------------------------------------------------------------------------
22 // Deck.h
33 //------------------------------------------------------------------------------
4 // $Id: Deck.h,v 1.23 2005/05/16 03:02:02 vlg Exp $
4 // $Id: Deck.h,v 1.24 2005/11/13 02:50:48 vlg Exp $
55 //
66 // Copyright (c) 2004 by Vladislav Grinchenko
77 //
1616 #define DECK_H
1717
1818 #include "VDeck.h"
19 #include <libxml/tree.h> // xmlDocPtr
1920
2021 class Card;
2122
2627 Deck (const string& fname_, DeckEditStatus status_);
2728 ~Deck ();
2829
29 virtual void load (const string& fname_, DeckAction = INSTALL_DECK);
30 virtual int load (const string& fname_, DeckAction = INSTALL_DECK);
3031 void insert (const string& from_file_);
3132 bool import_from_csv (const string& file_);
3233 virtual int save ();
7071 void dump_deck_status () const;
7172
7273 private:
73 void parse_xml_tree (const xmlpp::Node* node_);
74 /** Parse the Deck file card by card.
75 @return 0 on success; -1 on error with error_ explaining the reason.
76 */
77 int parse_xml_tree (xmlDocPtr parser_, std::string& error_);
78
7479 void reset_snd_setup ();
7580
7681 private:
00 // -*- c++ -*-
11 // Generated by assa-genesis
22 //------------------------------------------------------------------------------
3 // $Id: DeckManager.cpp,v 1.31 2005/05/16 03:02:02 vlg Exp $
3 // $Id: DeckManager.cpp,v 1.33 2005/11/13 02:50:48 vlg Exp $
44 //------------------------------------------------------------------------------
55 // DeckManager.cpp
66 //------------------------------------------------------------------------------
108108 */
109109 if (iter == DECKLIST->end ()) {
110110 deck = new Deck (INVALID_DECK);
111 deck->load (path_);
111 if (deck->load (path_) < 0) {
112 DL ((GRAPP,"Failed to load deck \"%s\"\n", path_.c_str ()));
113 return (NULL);
114 }
112115 }
113116
114117 if ((card = deck->find_card_by_id (id_)) != NULL) {
115118 return (new CardRef (*card, *deck));
119 }
120 else {
121 DL ((GRAPP,"Cound not find card id=%d in deck %s\n",
122 id_, path_.c_str ()));
116123 }
117124 return (NULL);
118125 }
144151 if (f.run () != Gtk::RESPONSE_OK) {
145152 return;
146153 }
154 f.hide ();
155
147156 DeckList::iterator iter = DECKLIST->begin ();
148157 while (iter != DECKLIST->end ()) {
149158 if (f.get_filename () == DECKLIST->get_deck (iter)->get_name ()) {
156165 }
157166
158167 Deck* deck = new Deck (INVALID_DECK);
159 deck->load (f.get_filename ());
160 CONFIG->set_filesel_path (f.get_filename ());
168 if (deck->load (f.get_filename ()) == 0) {
169 CONFIG->set_filesel_path (f.get_filename ());
170 }
161171 }
162172
163173 /** Insert cards from a deck to the one currently selected.
219229 w.run ();
220230 return;
221231 }
222
232 DL((GRAPP,"Step #1\n"));
223233 Gtk::FileChooserDialog f ("Select File To Import",
224234 Gtk::FILE_CHOOSER_ACTION_OPEN);
235 DL((GRAPP,"Step #2\n"));
225236 f.set_transient_for (*MAINWIN);
237 DL((GRAPP,"Step #3\n"));
226238 f.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
227239 f.add_button ("Select", Gtk::RESPONSE_OK);
240 DL((GRAPP,"Step #4\n"));
228241 f.set_current_folder (CONFIG->get_filesel_path ());
242 DL((GRAPP,"Step #5\n"));
229243 f.set_local_only ();
244 DL((GRAPP,"Step #6\n"));
230245
231246 if (f.run () == Gtk::RESPONSE_OK) {
232247 f.hide ();
397412 trace_with_mask("DeckManager::on_deck_loaded", GUITRACE);
398413
399414 if (status_ == LOAD_FAILED) {
415 string msg ("Failed to load deck file\n");
416 msg += "\"" + deck_->get_name () + "\"!\n";
417 msg += "Check your file syntax with\n";
418 msg += "\"xmllint --valid <fname>\"";
419
420 Gtk::MessageDialog emsg (msg, false, MESSAGE_ERROR);
421 emsg.run ();
400422 delete deck_;
401 Gtk::MessageDialog emsg ("Failed to load deck file!\n"
402 "Check your file syntax with\n"
403 "\"xmllint --valid <fname>\"",
404 false, MESSAGE_ERROR);
405 emsg.run ();
406423 }
407424 else {
408425 DECKLIST->push_back (deck_);
00 // -*- c++ -*-
11 //------------------------------------------------------------------------------
2 // $Id: DeckPlayer.cpp,v 1.80 2005/06/20 02:41:59 vlg Exp $
2 // $Id: DeckPlayer.cpp,v 1.83 2005/11/22 01:39:53 vlg Exp $
33 //------------------------------------------------------------------------------
44 // DeckPlayer.cpp
55 //------------------------------------------------------------------------------
1717
1818 #include <gtkmm/stock.h>
1919 #include <gtkmm/separator.h>
20 #include <gtkmm/spinbutton.h>
2021 #include <gtkmm/box.h>
2122 #include <gtkmm/handlebox.h>
2223 #include <gtkmm/buttonbox.h>
2728 #include <gtkmm/main.h>
2829 #include <gtkmm/progressbar.h>
2930 #include <gtkmm/eventbox.h>
31
32 using sigc::bind;
33 using sigc::mem_fun;
3034
3135 #include "ButtonWithImageLabel.h"
3236
6468 m_green ("MediumSeaGreen"),
6569 m_white ("white"),
6670 m_black ("black"),
67 m_state (VC_START)
71 m_state (VC_START),
72 m_test_line (NULL),
73 m_line_num (1)
74
6875 {
6976 trace_with_mask("VerifyControl::VerifyControl", GUITRACE);
7077
133140 Gtk::EXPAND|Gtk::SHRINK|Gtk::FILL, Gtk::FILL, 0, 0);
134141
135142 m_entry->signal_changed ().connect (
136 sigc::mem_fun (*this, &VerifyControl::on_entry_changed));
143 mem_fun (*this, &VerifyControl::on_entry_changed));
137144
138145 m_button->signal_clicked ().connect (
139 sigc::mem_fun (m_parent, &DeckPlayer::on_verify_clicked));
146 mem_fun (m_parent, &DeckPlayer::on_verify_clicked));
147 }
148
149 void
150 VerifyControl::
151 on_test_line_changed ()
152 {
153 trace_with_mask("VerifyControl::on_test_line_changed", GUITRACE);
154
155 if (m_test_line != NULL) {
156 m_line_num = m_test_line->get_value_as_int ();
157 DL ((GRAPP,"test line = %d\n", m_line_num));
158 }
140159 }
141160
142161 /**
160179 pc1 = text1 = pc2 = text2 = NULL;
161180
162181 Glib::ustring tmp (answer_);
182
183 /** If we are comparing the back of the card and
184 the m_line_num > 1, then we fetch that line instead.
185 If we are short of lines, that's a failed match.
186 */
187 if (m_parent.get_selected_size () == BACK && m_line_num > 1) {
188 std::vector<Glib::ustring> vec;
189 std::istringstream input (tmp.c_str ());
190 Glib::ustring token;
191 while (input >> token) {
192 vec.push_back (token);
193 }
194 if (vec.size () >= m_line_num) {
195 tmp = vec [m_line_num-1];
196 }
197 else {
198 tmp = ""; // Selected answer line is missing
199 }
200 }
201
163202 DeckPlayer::shrink_to_single_line (tmp);
164203
165204 DL ((GRAPP,"tmp = \"%s\"\n", tmp.c_str ()));
205
166206 text1 = pc1 = Granule::strip_pango_markup (tmp.c_str ());
167207 Granule::remove_common_prefixes (text1);
168208
175215
176216 if (!strcmp (text1, text2)) {
177217 m_report_box->modify_fg (Gtk::STATE_INSENSITIVE, m_green);
178 m_report->modify_fg (Gtk::STATE_INSENSITIVE, m_green);
179 m_report->set_label (clabels [CORRECT]);
218 m_report->modify_fg (Gtk::STATE_INSENSITIVE, m_green);
219 m_report->set_label (clabels [CORRECT]);
180220 }
181221 else {
182222 m_report_box->modify_fg (Gtk::STATE_INSENSITIVE, m_red);
183 m_report->modify_fg (Gtk::STATE_INSENSITIVE, m_red);
184 m_report->set_label (clabels [INCORRECT]);
223 m_report->modify_fg (Gtk::STATE_INSENSITIVE, m_red);
224 m_report->set_label (clabels [INCORRECT]);
185225
186226 m_was_equal= false;
187227
368408 frame->add (m_front);
369409
370410 m_notebook->pages ().push_back (
371 Gtk::Notebook_Helpers::TabElem (*frame, "Front"));
411 Gtk::Notebook_Helpers::TabElem (*frame, _("Front")));
372412
373413 /** Back of the card
374414 */
400440 m_answer_box->pack_start (m_example, Gtk::PACK_SHRINK, 5);
401441
402442 m_notebook->pages ().push_back (
403 Gtk::Notebook_Helpers::TabElem (*m_answer_box, "Back"));
443 Gtk::Notebook_Helpers::TabElem (*m_answer_box, _("Back")));
404444 m_answer_box->show ();
405445
406446 /** Side-panel controls
414454 vbuttonbox->set_homogeneous ();
415455 vbuttonbox->set_spacing (1);
416456
417 radio_fb = manage (new Gtk::RadioButton (group, "Ask front"));
457 radio_fb = manage (new Gtk::RadioButton (group, _("Ask front")));
418458 radio_fb->signal_clicked ().connect (
419 sigc::bind<SideSelection>(
420 sigc::mem_fun (*this, &DeckPlayer::on_radio_selected), FRONT));
459 bind<SideSelection>(
460 mem_fun (*this, &DeckPlayer::on_radio_selected), FRONT));
421461 vbuttonbox->pack_end (*radio_fb, false, false, 1);
422462
423 radio_bb = manage (new Gtk::RadioButton (group, "Ask back"));
463 radio_bb = manage (new Gtk::RadioButton (group, _("Ask back")));
424464 radio_bb->signal_clicked ().connect (
425 sigc::bind<SideSelection>(
426 sigc::mem_fun (*this, &DeckPlayer::on_radio_selected), BACK));
465 bind<SideSelection>(
466 mem_fun (*this, &DeckPlayer::on_radio_selected), BACK));
427467 vbuttonbox->pack_end (*radio_bb, false, false, 1);
428468 vbox->pack_start (*vbuttonbox, false, false, 0);
429469
470 /** Add Line selection spin button
471 */
472 Gtk::HBox* sb_hbox = manage (new Gtk::HBox);
473 Gtk::Adjustment* sb_adjust = manage (new Gtk::Adjustment (1,1,10));
474 Gtk::Label* sb_label = manage (new Gtk::Label (_("Test line: ")));
475 m_test_line_button = manage (new Gtk::SpinButton (*sb_adjust));
476
477 sb_hbox->pack_start (*sb_label, false, false, 0);
478 sb_hbox->pack_start (*m_test_line_button, false, false, 0);
479 vbox->pack_start (*sb_hbox, false, false, 0);
480 m_test_line_button->signal_value_changed ().connect (
481 mem_fun (*m_verify_control, &VerifyControl::on_test_line_changed));
482 m_verify_control->attach (m_test_line_button);
483
484 /** Fetch out the side history and adjust accordingly
485 */
430486 if (m_is_real_deck) {
431487 m_selected_side = CONFIG->get_flipside_history (m_deck.get_name ());
432488 if (m_selected_side == FRONT) {
433489 radio_fb->set_active ();
490 m_test_line_button->set_sensitive (false);
434491 }
435492 else {
436493 radio_bb->set_active ();
494 m_test_line_button->set_sensitive (true);
437495 }
438496 }
439497
440498 /** Side-panel buttons
441499 */
442500 m_shuffle_button->signal_clicked ().connect (
443 sigc::mem_fun (*this, &DeckPlayer::on_shuffle_clicked));
501 mem_fun (*this, &DeckPlayer::on_shuffle_clicked));
444502 vbox->pack_start (*m_shuffle_button, false, false, 0);
445503
446504 m_edit_button->signal_clicked ().connect (
447 sigc::mem_fun (*this, &DeckPlayer::on_edit_clicked));
505 mem_fun (*this, &DeckPlayer::on_edit_clicked));
448506 vbox->pack_start (*m_edit_button, false, false, 0);
449507
450508 m_vcard_edit_button->signal_clicked ().connect (
451 sigc::mem_fun (*this, &DeckPlayer::on_vcard_edit_clicked));
509 bind<bool>(mem_fun (*this, &DeckPlayer::on_vcard_edit_clicked), false));
452510 vbox->pack_start (*m_vcard_edit_button, false, false, 0);
453511
454512 m_count_label.set_alignment (0.5, 0.5);
475533 spkr_source.set_size (Gtk::ICON_SIZE_BUTTON);
476534 spkr_set.add_source (spkr_source);
477535 icon_factory->add (DeckPlayer::SAY_IT, spkr_set);
478 Gtk::Stock::add (Gtk::StockItem (DeckPlayer::SAY_IT, "Say It!"));
536 Gtk::Stock::add (Gtk::StockItem (DeckPlayer::SAY_IT, _("Say It!")));
479537
480538 Glib::RefPtr<Gdk::Pixbuf> thumbup_xpm =
481539 Gdk::Pixbuf::create_from_file (GRAPPDATADIR "/pixmaps/thumbup.xpm");
485543 thumbup_source.set_size (Gtk::ICON_SIZE_BUTTON);
486544 thumbup_set.add_source (thumbup_source);
487545 icon_factory->add (DeckPlayer::THUMB_UP, thumbup_set);
488 Gtk::Stock::add (Gtk::StockItem (DeckPlayer::THUMB_UP, "I know it!"));
546 Gtk::Stock::add (Gtk::StockItem (DeckPlayer::THUMB_UP, _("I know it!")));
489547
490548 Glib::RefPtr<Gdk::Pixbuf> thumbdown_xpm =
491549 Gdk::Pixbuf::create_from_file (GRAPPDATADIR "/pixmaps/thumbdown.xpm");
495553 thumbdown_source.set_size (Gtk::ICON_SIZE_BUTTON);
496554 thumbdown_set.add_source (thumbdown_source);
497555 icon_factory->add (DeckPlayer::THUMB_DOWN, thumbdown_set);
498 Gtk::Stock::add (Gtk::StockItem (DeckPlayer::THUMB_DOWN, "No clue"));
556 Gtk::Stock::add (Gtk::StockItem (DeckPlayer::THUMB_DOWN, _("No clue")));
499557
500558 icon_factory->add_default ();
501559
502560 m_actgroup = Gtk::ActionGroup::create ();
503561
504562 m_actgroup->add (Gtk::Action::create ("Say_It", DeckPlayer::SAY_IT),
505 sigc::mem_fun (*this, &DeckPlayer::on_sayit_clicked));
563 mem_fun (*this, &DeckPlayer::on_sayit_clicked));
506564
507565 m_actgroup->add (Gtk::Action::create ("First", Gtk::Stock::GOTO_FIRST),
508 sigc::mem_fun (*this, &DeckPlayer::go_first_cb));
566 mem_fun (*this, &DeckPlayer::go_first_cb));
509567
510568 m_actgroup->add (Gtk::Action::create ("Prev", Gtk::Stock::GO_BACK),
511 sigc::mem_fun (*this, &DeckPlayer::go_prev_cb));
569 mem_fun (*this, &DeckPlayer::go_prev_cb));
512570
513571 m_actgroup->add (Gtk::Action::create ("Next", Gtk::Stock::GO_FORWARD),
514 sigc::mem_fun (*this, &DeckPlayer::go_next_cb));
572 mem_fun (*this, &DeckPlayer::go_next_cb));
515573
516574 m_actgroup->add (Gtk::Action::create ("Last", Gtk::Stock::GOTO_LAST),
517 sigc::mem_fun (*this, &DeckPlayer::go_last_cb));
575 mem_fun (*this, &DeckPlayer::go_last_cb));
518576
519577 m_actgroup->add (Gtk::Action::create ("IKnowIt", DeckPlayer::THUMB_UP),
520 sigc::mem_fun (*this, &DeckPlayer::know_answer_cb));
578 mem_fun (*this, &DeckPlayer::know_answer_cb));
521579
522580 m_actgroup->add (Gtk::Action::create ("NoClue", DeckPlayer::THUMB_DOWN),
523 sigc::mem_fun (*this, &DeckPlayer::no_clue_cb));
581 mem_fun (*this, &DeckPlayer::no_clue_cb));
524582
525583 m_uimanager = Gtk::UIManager::create ();
526584 m_uimanager->insert_action_group (m_actgroup);
580638 hbox->show_all ();
581639
582640 m_close_button->signal_clicked ().connect (
583 sigc::mem_fun (*this, &DeckPlayer::on_close_clicked));
641 mem_fun (*this, &DeckPlayer::on_close_clicked));
584642
585643 /**
586644 * Perhaps you should examine signal_realize() instead.
587645 * It is called once.
588646 */
589647 m_answer_box->signal_size_allocate ().connect (
590 sigc::mem_fun (*this, &DeckPlayer::answer_box_size_allocate_cb));
648 mem_fun (*this, &DeckPlayer::answer_box_size_allocate_cb));
591649
592650 signal_size_allocate ().connect (
593 sigc::mem_fun (*this, &DeckPlayer::size_allocate_cb));
651 mem_fun (*this, &DeckPlayer::size_allocate_cb));
594652
595653 add_events (Gdk::BUTTON_PRESS_MASK);
596654
598656 keypress event handling. Returning 'true' from on_key_pressed()
599657 will stop event processing.
600658 */
601 signal_key_press_event ().connect(
602 sigc::mem_fun (*this, &DeckPlayer::on_key_pressed), false);
659 if (!CONFIG->disable_key_shortcuts ()) {
660 signal_key_press_event ().connect(
661 mem_fun (*this, &DeckPlayer::on_key_pressed), false);
662 }
603663
604664 /** Grand finale
605665 */
640700 show_card ();
641701 }
642702
703 /**
704 * Always clear all fields first. Then, try to fill them up.
705 * If we were given an invalid markup text, then set_markup()
706 * would fail with
707 * "Gtk-WARNING **: Failed to set label from markup due to error parsing markup"
708 *
709 * I'd like ultimately to catch the error and show it in a warning dialog
710 * to the user, but for now I don't see a way of doing it with GTK+.
711 */
643712 void
644713 DeckPlayer::
645714 show_card (bool with_adjust_count_)
646715 {
647716 trace_with_mask("DeckPlayer::show_card",GUITRACE);
648717
718 clear_text ();
719
649720 if (m_deck_iter != m_deck.end () || m_deck.size () > 0) {
721 while (!markup_is_valid ((*m_deck_iter))) {
722 Gtk::MessageDialog em (
723 _("The card you are about to see has invalid markup.\n"
724 "To proceed further, first, fix the broken markup.\n"
725 "If unsure about the correct syntax, consult Help."),
726 Gtk::MESSAGE_ERROR);
727 em.run ();
728 em.hide ();
729 on_vcard_edit_clicked (true);
730 }
650731 m_front.set_markup ((*m_deck_iter)->get_question ());
651732 set_answer_field ((*m_deck_iter)->get_answer ());
652 m_example.set_markup (markup_tildas ((*m_deck_iter)->get_example ()));
653 }
654 else {
655 m_front. set_text ("");
656 m_back. set_text ("");
657 m_example.set_text ("");
658 }
733 m_example.set_markup (markup_tildas((*m_deck_iter)->get_example()));
734 }
735
659736 if (with_adjust_count_) {
660737 adjust_count ();
661738 }
662739 /** set focus
663740 */
664741 m_verify_control->grab_focus ();
742 }
743
744 void
745 DeckPlayer::
746 set_answer_field (Glib::ustring answer_)
747 {
748 trace_with_mask("DeckPlayer::set_answer_field",GUITRACE);
749
750 // DL ((GRAPP,"answer: \"%s\"\n", answer_.c_str ()));
751
752 m_back.set_markup (answer_);
753
754 /*
755 Multi-line right alignment works, but perhaps it should be
756 optional via Preferences
757
758 if (answer_.find ("\n") != Glib::ustring::npos) {
759 m_back.set_alignment (Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
760 }
761 else {
762 m_back.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
763 }
764 */
665765 }
666766
667767 void
852952 on_radio_selected (SideSelection selected_)
853953 {
854954 trace_with_mask("DeckPlayer::on_radio_selected",GUITRACE);
955
855956 m_selected_side = selected_;
856957 switch_side ();
857 DL((GRAPP,"Selected side : %s\n",
858 (m_selected_side == FRONT ? "FRONT" : "BACK")));
958 DL ((GRAPP,"selected = %s\n",
959 (m_selected_side == BACK ? "BACK" : "FRONT")));
960 m_test_line_button->set_sensitive ((m_selected_side == BACK));
859961 }
860962
861963 void
9421044
9431045 void
9441046 DeckPlayer::
945 on_vcard_edit_clicked ()
1047 on_vcard_edit_clicked (bool disable_cancel_)
9461048 {
9471049 trace_with_mask("DeckPlayer::on_vcard_edit_clicked",GUITRACE);
9481050
9491051 if (m_deck_iter != m_deck.end () || m_deck.size () > 0) {
9501052 VCard* vc = *m_deck_iter;
9511053 CardView cview (vc);
952 int ret = cview.run ();
1054 int ret = cview.run (disable_cancel_);
9531055
9541056 if (ret == Gtk::RESPONSE_OK) {
9551057 show_card (false);
11251227
11261228 void
11271229 DeckPlayer::
1230 on_template_clicked ()
1231 {
1232 trace_with_mask("DeckPlayer::on_template_clicked",GUITRACE);
1233
1234 }
1235
1236 void
1237 DeckPlayer::
11281238 set_win_name ()
11291239 {
11301240 string title = m_deck.get_name ();
11941304
11951305 Glib::ustring::size_type idx;
11961306
1307 idx = txt_.find_first_of ("\n");
1308 if (idx != Glib::ustring::npos) {
1309 txt_.replace (idx, txt_.size (), "");
1310 }
1311
11971312 while ((idx = txt_.find (" ")) != Glib::ustring::npos) {
11981313 txt_.replace (idx, 2, " ");
1199 }
1200
1201 idx = txt_.find_last_of ("\n");
1202 if (idx != Glib::ustring::npos) {
1203 txt_.replace (idx, txt_.size (), "");
12041314 }
12051315
12061316 idx = txt_.find_first_not_of (" \t");
12141324 }
12151325 }
12161326
1217 void
1218 DeckPlayer::
1219 set_answer_field (Glib::ustring answer_)
1220 {
1221 trace_with_mask("DeckPlayer::set_answer_field",GUITRACE);
1222
1223 DL ((GRAPP,"answer: \"%s\"\n", answer_.c_str ()));
1224 m_back.set_markup (answer_);
1225 /*
1226 Multi-line right alignment works, but perhaps it should be
1227 optional via Preferences
1228
1229 if (answer_.find ("\n") != Glib::ustring::npos) {
1230 m_back.set_alignment (Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
1231 }
1232 else {
1233 m_back.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
1234 }
1235 */
1236 }
12371327
12381328 Glib::ustring
12391329 DeckPlayer::
12661356
12671357 return ret;
12681358 }
1359
1360 bool
1361 DeckPlayer::
1362 markup_is_valid (VCard* card_)
1363 {
1364 return (Granule::check_markup (card_->get_question ()) &&
1365 Granule::check_markup (card_->get_answer ()) &&
1366 Granule::check_markup (card_->get_example ()));
1367 }
00 // -*- c++ -*-
11 //------------------------------------------------------------------------------
2 // $Id: DeckPlayer.h,v 1.35 2005/06/20 02:41:59 vlg Exp $
2 // $Id: DeckPlayer.h,v 1.37 2005/11/20 23:28:11 vlg Exp $
33 //------------------------------------------------------------------------------
44 // DeckPlayer.h
55 //------------------------------------------------------------------------------
6767 void set_state (VCState state_);
6868
6969 void on_entry_changed ();
70 void on_test_line_changed ();
71
72 void attach (Gtk::SpinButton* tl_) { m_test_line = tl_; }
7073
7174 private:
7275 static const int LABELS_SZ = 4;
8588 Gdk::Color m_green;
8689 Gdk::Color m_white;
8790 Gdk::Color m_black;
91
92 Gtk::SpinButton* m_test_line; // Which line to compare for answer.
93 int m_line_num; // Number of line to test
8894 };
8995
9096 /**
121127 void on_edit_clicked ();
122128
123129 /** User pressed <Edit Card> button to Edit current card
124 */
125 void on_vcard_edit_clicked ();
130 *
131 * @param disable_cancel_ disables <Cancel> button if set to true.
132 */
133 void on_vcard_edit_clicked (bool disable_cancel_ = false);
126134
127135 // -*- Button Actions -*-
128136 void go_first_cb (); // Go to the first card
138146 // -*- Radio Button Actions -*-
139147 void on_radio_selected (SideSelection selected_);
140148
149 // -*- Question Template button -*-
150 void on_template_clicked ();
151
141152 // -*- Catch and process keyboard events -*-
142153 bool on_key_pressed (GdkEventKey* evt_);
143154
157168 */
158169 void repaint ();
159170
171 /** Clear the text fields of the old or stale text
172 */
173 void clear_text ();
174
160175 /// Enable answer control buttons ("I know", "Not a clue")
161176 void enable_answer_controls ();
162177
166181 /// Flip the Card
167182 void flip_card ();
168183
169 /// Remove all newlines and shrink all whitespace
184 SideSelection get_selected_size () const { return m_selected_side; }
185
186 /** Remove all newlines and shrink all whitespace.
187 */
170188 static void shrink_to_single_line (Glib::ustring& txt_);
171189
172190 /** Extend Stock Icons with application-specific ones.
174192 static Gtk::StockID SAY_IT;
175193 static Gtk::StockID THUMB_UP;
176194 static Gtk::StockID THUMB_DOWN;
177
195
178196 private:
179197 void show_deck (); // Show first card of the loaded deck
180198 void switch_side (); // Show the front/back side of the card
195213 */
196214 static Glib::ustring markup_tildas (const Glib::ustring& src_);
197215
216 /** Check markup validity of the text fields of the card_
217 */
218 bool markup_is_valid (VCard* card_);
219
198220 private:
199221 Gtk::Button* m_close_button;
200222 Gtk::Button* m_shuffle_button;
201223 Gtk::Button* m_edit_button; // View/Edit a Deck
202224 Gtk::Button* m_vcard_edit_button; // Edit a Card
225 int m_match_front_row; // Which row to select for answer
203226 Gtk::Label m_count_label;
204227 SideSelection m_selected_side;
205228 Gtk::Notebook* m_notebook;
207230 Gtk::Label m_front;
208231 Gtk::Label m_back;
209232 Gtk::Label m_example;
233 Gtk::SpinButton* m_test_line_button;
210234
211235 Gtk::VBox* m_answer_box; /* VBox that holds the back of a card */
212236 int m_answer_box_width; /* last resize width */
254278 m_verify_control->grab_focus ();
255279 }
256280
281 inline void
282 DeckPlayer::
283 clear_text ()
284 {
285 m_front. set_text ("");
286 m_back. set_text ("");
287 m_example.set_text ("");
288 }
289
257290
258291 #endif /* DECK_PLAYER_H */
00 // -*- c++ -*-
11 //------------------------------------------------------------------------------
2 // $Id: DeckView.cpp,v 1.33 2005/06/06 02:29:39 vlg Exp $
2 // $Id: DeckView.cpp,v 1.35 2005/11/27 04:59:22 vlg Exp $
33 //------------------------------------------------------------------------------
44 // DeckView.cpp
55 //------------------------------------------------------------------------------
3030 #include "DeckView.h"
3131 #include "DeckInfo.h"
3232 #include "ButtonWithImageLabel.h"
33
34 using sigc::bind;
35 using sigc::mem_fun;
3336
3437 DeckView::
3538 DeckView (VDeck& deck_, int selected_row_) :
121124 m_close_button->set_relief (Gtk::RELIEF_NORMAL);
122125
123126 m_close_button->signal_clicked ().connect (
124 sigc::mem_fun (*this, &DeckView::on_close_clicked));
127 mem_fun (*this, &DeckView::on_close_clicked));
125128
126129 /** List View
127130 */
141144 row [m_columns.m_card ] = *iter;
142145 iter++;
143146 }
147
148 /** Make both Front and Back columns sortable.
149 */
144150 m_list_store_ref->set_sort_func (
145 0, sigc::mem_fun (*this, &DeckView::on_sort_compare));
151 0, (mem_fun (*this, &DeckView::on_sort_compare_front)));
152
153 m_list_store_ref->set_sort_func (
154 1, (mem_fun (*this, &DeckView::on_sort_compare_back)));
146155
147156 /** Create TreeView
148157 */
153162 Gtk::TreeView::Column* column;
154163 Gtk::CellRendererText* renderer;
155164
165 /** Front: Column
166 */
156167 column = Gtk::manage (new Gtk::TreeView::Column ("Front"));
157168 m_tree_view.append_column (*column);
158169 renderer = Gtk::manage (new Gtk::CellRendererText);
170181 column->set_sort_column_id (m_columns.m_front_row);
171182 column->set_sort_indicator (true);
172183 column->signal_clicked ().connect (
173 sigc::mem_fun (*this, &DeckView::on_column_sorted));
174
184 mem_fun (*this, &DeckView::on_column_sorted));
185
186 /** Back: Column
187 */
175188 column = Gtk::manage (new Gtk::TreeView::Column ("Back"));
176189 m_tree_view.append_column (*column);
177190 renderer = Gtk::manage (new Gtk::CellRendererText);
183196 column->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED);
184197 column->set_fixed_width (140);
185198
199 /** Enable column sorting
200 */
201 column->set_sort_column_id (m_columns.m_back_row);
202 column->set_sort_indicator (true);
203 column->signal_clicked ().connect (
204 mem_fun (*this, &DeckView::on_column_sorted));
205
186206 m_tree_sel_ref = m_tree_view.get_selection ();
187207 m_tree_sel_ref->set_mode (Gtk::SELECTION_SINGLE);
188208 m_tree_sel_ref->signal_changed ().connect (
189 sigc::mem_fun (*this, &DeckView::on_card_selected));
209 mem_fun (*this, &DeckView::on_card_selected));
190210
191211 m_scrollwin->add (m_tree_view);
192212
193213 /** Initialize callbacks
194214 */
195215 m_add_button->signal_clicked ().connect (
196 sigc::mem_fun (*this, &DeckView::on_add_clicked));
216 mem_fun (*this, &DeckView::on_add_clicked));
197217 m_edit_button->signal_clicked ().connect (
198 sigc::mem_fun (*this, &DeckView::on_edit_clicked));
218 mem_fun (*this, &DeckView::on_edit_clicked));
199219 m_save_deck_button->signal_clicked ().connect (
200 sigc::mem_fun (*DECKMGR, &DeckManager::save_deck_cb));
220 mem_fun (*DECKMGR, &DeckManager::save_deck_cb));
201221 m_delete_button->signal_clicked ().connect (
202 sigc::mem_fun (*this, &DeckView::on_delete_clicked));
222 mem_fun (*this, &DeckView::on_delete_clicked));
203223 m_more_button->signal_clicked ().connect (
204 sigc::mem_fun (*this, &DeckView::on_more_clicked));
224 mem_fun (*this, &DeckView::on_more_clicked));
205225 m_card_up_button->signal_clicked ().connect (
206 sigc::mem_fun (*this, &DeckView::on_card_up_clicked));
226 mem_fun (*this, &DeckView::on_card_up_clicked));
207227 m_card_down_button->signal_clicked ().connect (
208 sigc::mem_fun (*this, &DeckView::on_card_down_clicked));
228 mem_fun (*this, &DeckView::on_card_down_clicked));
209229 m_add_card_to_cardbox->signal_clicked ().connect (
210 sigc::mem_fun (*this, &DeckView::on_add_card_to_cardbox));
230 mem_fun (*this, &DeckView::on_add_card_to_cardbox));
211231
212232 /** Pack 'em all
213233 */
241261 set_sensitivity ();
242262 set_win_name ();
243263 set_icon_from_file (GRAPPDATADIR "/pixmaps/deckview_32x32.png");
264
244265 }
245266
246267 DeckView::
540561 */
541562 int
542563 DeckView::
543 on_sort_compare (const Gtk::TreeModel::iterator& a_,
544 const Gtk::TreeModel::iterator& b_)
545 {
546 trace_with_mask("DeckView::on_sort_compare",GUITRACE);
564 sort_compare_impl (const Gtk::TreeModel::iterator& a_,
565 const Gtk::TreeModel::iterator& b_,
566 int column_)
567 {
568 trace_with_mask("DeckView::sort_compare_impl",GUITRACE);
547569
548570 gchar* txt_a;
549571 gchar* txt_b;
555577 const Gtk::TreeModel::Row row_a = *a_;
556578 const Gtk::TreeModel::Row row_b = *b_;
557579
558 const Glib::ustring a = row_a [m_columns.m_front_row];
559 const Glib::ustring b = row_b [m_columns.m_front_row];
580 Glib::ustring a;
581 Glib::ustring b;
582
583 // DL ((GRAPP, "Sorting %s column\n", (column_ == 0 ? "Front" : "Back")));
584
585 if (column_ == 0) {
586 a = row_a [m_columns.m_front_row];
587 b = row_b [m_columns.m_front_row];
588 }
589 else {
590 a = row_a [m_columns.m_back_row];
591 b = row_b [m_columns.m_back_row];
592 }
560593
561594 pa = txt_a = Granule::strip_pango_markup (a.c_str ());
562595 pb = txt_b = Granule::strip_pango_markup (b.c_str ());
606639 /**
607640 * For multiline entries (starting with v 1.1.5),
608641 * remove part of the string following first newline character.
642 * But first, strip possible Pango markup. Markup can span across
643 * multiple lines and interpreting only first line might result
644 * in invalid syntax.
609645 */
610646 Glib::ustring
611647 DeckView::
612 trim_multiline (const Glib::ustring& text_)
613 {
648 trim_multiline (const Glib::ustring& orig_text_)
649 {
650 gchar* pc = Granule::strip_pango_markup (orig_text_.c_str ());
651 Glib::ustring text_ = pc;
652 g_free (pc);
614653 Glib::ustring::size_type idx = text_.find_first_of ("\n");
615654 Glib::ustring result (text_);
616655 if (idx != std::string::npos) {
00 // -*- c++ -*-
11 //------------------------------------------------------------------------------
2 // $Id: DeckView.h,v 1.17 2005/06/06 02:29:39 vlg Exp $
2 // $Id: DeckView.h,v 1.18 2005/11/21 00:25:17 vlg Exp $
33 //------------------------------------------------------------------------------
44 // DeckView.h
55 //------------------------------------------------------------------------------
5959 */
6060 void on_column_sorted ();
6161
62 /** Roll in our own sort function
62 /** Sort Front column
6363 */
64 int on_sort_compare (const Gtk::TreeModel::iterator& a_,
65 const Gtk::TreeModel::iterator& b_);
64 int on_sort_compare_front (const Gtk::TreeModel::iterator& a_,
65 const Gtk::TreeModel::iterator& b_)
66 {
67 return (sort_compare_impl (a_, b_, 0));
68 }
69
70 /** Sort Back column
71 */
72 int on_sort_compare_back (const Gtk::TreeModel::iterator& a_,
73 const Gtk::TreeModel::iterator& b_)
74 {
75 return (sort_compare_impl (a_, b_, 1));
76 }
6677
6778 // -*- Sidebar action button callbacks -*-
6879 void on_add_clicked ();
7687 void add_new_card (Card* card_);
7788
7889 private:
90 /** Column sorting implementation
91 */
92 int sort_compare_impl (const Gtk::TreeModel::iterator& a_,
93 const Gtk::TreeModel::iterator& b_,
94 int column_);
95
7996 void set_cards_count ();
8097 void set_win_name ();
8198
0 // -*- c++ -*-
1 //------------------------------------------------------------------------------
2 // $Id: EditControls.cpp,v 1.4 2005/11/27 04:59:22 vlg Exp $
3 //------------------------------------------------------------------------------
4 // EditControls.cpp
5 //------------------------------------------------------------------------------
6 // Copyright (c) 2005 by Vladislav Grinchenko
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version
11 // 2 of the License, or (at your option) any later version.
12 //------------------------------------------------------------------------------
13 //
14 // Date : Nov 13 2005
15 //
16 //------------------------------------------------------------------------------
17
18 #include <gtkmm/table.h>
19
20 #include "Granule-main.h"
21 #include "EditControls.h"
22
23 using Gtk::Image;
24
25 EditControls::
26 EditControls (Glib::RefPtr<Gtk::TextBuffer> tb_ref_)
27 : Gtk::HBox (false, 2),
28 m_textbuf (tb_ref_)
29 {
30 trace_with_mask("EditControls::EditControls", GUITRACE);
31
32 Glib::RefPtr<Gdk::Pixbuf> pixbuf_ref;
33
34 vector<Glib::ustring> widget_names;
35 widget_names.push_back ("TextBold");
36 widget_names.push_back ("TextItalic");
37 widget_names.push_back ("TextUnderline");
38 widget_names.push_back ("TextMonospace");
39 widget_names.push_back ("TextSubscript");
40 widget_names.push_back ("TextSuperscript");
41 widget_names.push_back ("TextBig");
42 widget_names.push_back ("TextSmall");
43 widget_names.push_back ("TextRemoveTags");
44
45 pixbuf_ref = Gdk::Pixbuf::create_from_file (
46 GRAPPDATADIR "pixmaps/text_bold.png");
47 m_icon_list.push_back (icon_t ("bold",
48 manage (new Image (pixbuf_ref))));
49
50 pixbuf_ref = Gdk::Pixbuf::create_from_file (
51 GRAPPDATADIR "pixmaps/text_italic.png");
52 m_icon_list.push_back (icon_t ("italic",
53 manage (new Image (pixbuf_ref))));
54
55 pixbuf_ref = Gdk::Pixbuf::create_from_file (
56 GRAPPDATADIR "pixmaps/text_underlined.png");
57 m_icon_list.push_back (icon_t ("underline",
58 manage (new Image (pixbuf_ref))));
59
60 pixbuf_ref = Gdk::Pixbuf::create_from_file (
61 GRAPPDATADIR "pixmaps/text_monospaced.png");
62 m_icon_list.push_back (icon_t ("monospace",
63 manage (new Image (pixbuf_ref))));
64
65 pixbuf_ref = Gdk::Pixbuf::create_from_file (
66 GRAPPDATADIR "pixmaps/text_subscript.png");
67 m_icon_list.push_back (icon_t ("subscript",
68 manage (new Image (pixbuf_ref))));
69
70 pixbuf_ref = Gdk::Pixbuf::create_from_file (
71 GRAPPDATADIR "pixmaps/text_superscript.png");
72 m_icon_list.push_back (icon_t ("superscript",
73 manage (new Image (pixbuf_ref))));
74
75 pixbuf_ref = Gdk::Pixbuf::create_from_file (
76 GRAPPDATADIR "pixmaps/text_big.png");
77 m_icon_list.push_back (icon_t ("big",
78 manage (new Image (pixbuf_ref))));
79
80 pixbuf_ref = Gdk::Pixbuf::create_from_file (
81 GRAPPDATADIR "pixmaps/text_small.png");
82 m_icon_list.push_back (icon_t ("small",
83 manage (new Image (pixbuf_ref))));
84
85 pixbuf_ref = Gdk::Pixbuf::create_from_file (
86 GRAPPDATADIR "pixmaps/text_remove_tags.png");
87 m_icon_list.push_back (icon_t ("remove_tags",
88 manage (new Image (pixbuf_ref))));
89
90 icon_list_t::iterator iter = m_icon_list.begin ();
91
92 Gtk::Button* button;
93 Gtk::Table* elems_table = Gtk::manage (new Gtk::Table (2, 5, false));
94
95 elems_table->set_border_width (0);
96 elems_table->set_row_spacings (1);
97 elems_table->set_col_spacings (1);
98 elems_table->set_name ("EditControlsTable");
99
100 int row = 0;
101 int col = 0;
102
103 /** unset_flags () takes buttons out of the dialog's focus chain.
104 There is no other way it can be achieved with set_focus_chain()
105 in CardView dialog. I tried it and it doesn't work.
106 */
107
108 while (iter != m_icon_list.end ()) {
109 button = manage (new Gtk::Button ());
110 button->unset_flags (Gtk::CAN_FOCUS);
111 button->add (*((*iter).second));
112 elems_table->attach (*button, col, col+1, row, row+1,
113 Gtk::FILL, Gtk::FILL, 0, 0);
114 if (++col == 2) {
115 row++;
116 col = 0;
117 }
118 button->signal_clicked ().connect (
119 bind<string>(mem_fun(*this, &EditControls::on_edit_button_clicked),
120 (*iter).first));
121 iter++;
122 }
123 // elems_table->unset_focus_chain ();
124
125 this->pack_start (*elems_table, Gtk::PACK_SHRINK);
126 }
127
128 void
129 EditControls::
130 on_edit_button_clicked (const string& action_)
131 {
132 trace_with_mask("EditControls::on_edit_button_clicked",GUITRACE);
133
134 DL ((GRAPP,"Inserting <%s> tag.\n", action_.c_str ()));
135
136 Gtk::TextBuffer::iterator iter;
137 Gtk::TextBuffer::iterator start_iter;
138 Gtk::TextBuffer::iterator end_iter;
139
140 /** Iterators are invalidated between text changes.
141 But marks are not. They are placed in the place where
142 the text used to be it it were deleted.
143 Comparing the marks, however, turned out to be useless -
144 you ought to compares iterators only.
145 */
146 if (!m_textbuf->get_selection_bounds (start_iter, end_iter)) {
147 DL ((GRAPP,"No selection has been made\n"));
148 return;
149 }
150
151 if (start_iter == end_iter) {
152 DL ((GRAPP,"Selection size is 0.\n"));
153 return;
154 }
155
156 /** We got a valid selection - mark it now. We cannot use
157 predefined selection marks "insert" and "selection_bound"
158 because if the user made the selection by dragging pointer
159 in the opposite direction, we would get iterators in reverse
160 and Gtkmm doesn't allow for iterators comparison.
161 */
162 Glib::RefPtr<Gtk::TextBuffer::Mark> mb;
163 Glib::RefPtr<Gtk::TextBuffer::Mark> me;
164
165 mb = m_textbuf->create_mark ("start_selection", start_iter);
166 me = m_textbuf->create_mark ("end_selection", end_iter);
167 iter = start_iter;
168
169 DL ((GRAPP,"selection: from='%c' to='%c'\n",
170 display_unichar_at (iter),
171 display_unichar_at (me->get_iter ())));
172
173 if (action_ == "bold") {
174 m_textbuf->insert (iter, "<b>");
175 m_textbuf->insert (me->get_iter (), "</b>");
176 }
177 else if (action_ == "italic") {
178 m_textbuf->insert (iter, "<i>");
179 m_textbuf->insert (me->get_iter (), "</i>");
180 }
181 else if (action_ == "underline") {
182 m_textbuf->insert (iter, "<u>");
183 m_textbuf->insert (me->get_iter (), "</u>");
184 }
185 else if (action_ == "monospace") {
186 m_textbuf->insert (iter, "<tt>");
187 m_textbuf->insert (me->get_iter (), "</tt>");
188 }
189 else if (action_ == "subscript") {
190 m_textbuf->insert (iter, "<sub>");
191 m_textbuf->insert (me->get_iter (), "</sub>");
192 }
193 else if (action_ == "superscript") {
194 m_textbuf->insert (iter, "<sup>");
195 m_textbuf->insert (me->get_iter (), "</sup>");
196 }
197 else if (action_ == "big") {
198 m_textbuf->insert (iter, "<big>");
199 m_textbuf->insert (me->get_iter (), "</big>");
200 }
201 else if (action_ == "small") {
202 m_textbuf->insert (iter, "<small>");
203 m_textbuf->insert (me->get_iter (), "</small>");
204 }
205 else if (action_ == "remove_tags") {
206 remove_tags (mb, me);
207 }
208
209 else {
210 DL ((GRAPP,"Unexpected action!\n"));
211 }
212 m_textbuf->place_cursor (m_textbuf->begin ());
213
214 m_textbuf->delete_mark (mb);
215 m_textbuf->delete_mark (me);
216 }
217
218 /** We remove all complete individual tags. The incomplete tags
219 are ignored. The tag context is also ignored - we don't match
220 open/close tags at all.
221 */
222 void
223 EditControls::
224 remove_tags (Glib::RefPtr<Gtk::TextBuffer::Mark> begin_mark_,
225 Glib::RefPtr<Gtk::TextBuffer::Mark> end_mark_)
226 {
227 trace_with_mask("EditControls::remove_tags",GUITRACE);
228
229 gunichar open_brace = '<';
230 gunichar close_brace = '>';
231
232 Gtk::TextBuffer::iterator next_ch = begin_mark_->get_iter ();
233 Gtk::TextBuffer::iterator last_ch = end_mark_->get_iter ();
234
235 DL ((GRAPP,"scanning from='%c' to='%c'\n",
236 display_unichar_at (next_ch),
237 display_unichar_at (last_ch)));
238
239 while (next_ch && next_ch != last_ch) {
240 if (next_ch.get_char () == open_brace) {
241 Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark;
242 start_mark = m_textbuf->create_mark ("start", next_ch);
243 next_ch++;
244
245 DL ((GRAPP,"outer: next_ch='%c', last_ch='%c'\n",
246 display_unichar_at (next_ch),
247 display_unichar_at (last_ch)));
248
249 while (next_ch && next_ch != last_ch) {
250 if (next_ch.get_char () == close_brace) {
251 DL ((GRAPP,"found tag - erasing from '%c' to '%c' ...\n",
252 display_unichar_at (start_mark->get_iter ()),
253 display_unichar_at (next_ch)));
254
255 next_ch++;
256 m_textbuf->erase (start_mark->get_iter (), next_ch);
257
258 next_ch = start_mark->get_iter ();
259 last_ch = end_mark_->get_iter ();
260
261 DL ((GRAPP,"erase: next_ch='%c', last_ch='%c'\n",
262 display_unichar_at (next_ch),
263 display_unichar_at (last_ch)));
264 break;
265 }
266 next_ch++;
267
268 DL ((GRAPP,"inner: next_ch='%c', last_ch='%c'\n",
269 display_unichar_at (next_ch),
270 display_unichar_at (last_ch)));
271 }
272 m_textbuf->delete_mark (start_mark);
273 }
274 next_ch++;
275
276 DL ((GRAPP,"outer: next_ch='%c', last_ch='%c'\n",
277 display_unichar_at (next_ch),
278 display_unichar_at (last_ch)));
279 }
280 }
281
282 void
283 EditControls::
284 on_focus_changed (Gtk::TextView* text_view_)
285 {
286 trace_with_mask("EditControls::on_focus_changed",GUITRACE);
287
288 m_textbuf->place_cursor (m_textbuf->begin ()); // cancel old select
289 m_textbuf = text_view_->get_buffer ();
290 }
291
0 // -*- c++ -*-
1 //------------------------------------------------------------------------------
2 // $Id: EditControls.h,v 1.2 2005/11/15 04:08:42 vlg Exp $
3 //------------------------------------------------------------------------------
4 // EditControls.h
5 //------------------------------------------------------------------------------
6 // Copyright (c) 2005 by Vladislav Grinchenko
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version
11 // 2 of the License, or (at your option) any later version.
12 //------------------------------------------------------------------------------
13 //
14 // Date : Nov 13 2005
15 //
16 //------------------------------------------------------------------------------
17 #ifndef EDIT_CONTROLS_H
18 #define EDIT_CONTROLS_H
19
20 #include <gtkmm/box.h>
21 #include <gtkmm/textview.h>
22 #include <gtkmm/box.h>
23 #include <gdkmm/pixbuf.h>
24 /*
25
26 #include <gdkmm/image.h>
27 */
28 #include <gtkmm/image.h>
29
30 using sigc::bind;
31 using sigc::mem_fun;
32
33 #include <vector>
34 #include <string>
35
36 using std::vector;
37 using std::string;
38
39 /** EditControls is a collection of markup edit buttons
40 that are embedded in CardView for quick editing
41 the text in the input fields.
42 */
43 class EditControls : public Gtk::HBox
44 {
45 public:
46 EditControls (Glib::RefPtr<Gtk::TextBuffer> tb_ref_);
47
48 void on_focus_changed (Gtk::TextView* text_view_);
49
50 private:
51 void on_edit_button_clicked (const string& action_);
52
53 void remove_tags (Glib::RefPtr<Gtk::TextBuffer::Mark> begin_mark_,
54 Glib::RefPtr<Gtk::TextBuffer::Mark> end_mark_);
55
56 static gunichar
57 display_unichar_at (Gtk::TextBuffer::iterator iter_)
58 {
59 gunichar c;
60 return ((c = iter_.get_char ()) ? c : ' ');
61 }
62
63 private:
64 typedef std::pair<string, Gtk::Image*> icon_t;
65 typedef vector<icon_t> icon_list_t;
66
67 icon_list_t m_icon_list;
68 Glib::RefPtr<Gtk::TextBuffer> m_textbuf;
69 };
70
71 #endif /* EDIT_CONTROLS_H */
00 // -*- c++ -*-
11 // generated by glade--
22 //------------------------------------------------------------------------------
3 // $Id: GeneralPref.cpp,v 1.7 2005/06/15 03:17:00 vlg Exp $
3 // $Id: GeneralPref.cpp,v 1.8 2005/11/22 01:39:53 vlg Exp $
44 //------------------------------------------------------------------------------
55 // GeneralPref.cpp
66 //------------------------------------------------------------------------------
2323 #include "Config.h"
2424 #include "PrefWindow.h"
2525 #include "GeneralPref.h"
26
27 #include "Intern.h" // i18n macros
2628
2729 using sigc::mem_fun;
2830 using sigc::bind;
101103 Gtk::Frame* frame1 = Gtk::manage(new Gtk::Frame());
102104 Gtk::Frame* frame2 = Gtk::manage(new Gtk::Frame());
103105 Gtk::Frame* frame3 = Gtk::manage(new Gtk::Frame());
106 Gtk::Frame* frame4 = Gtk::manage(new Gtk::Frame());
104107 Gtk::Label* empty_label;
105108
106109 m_dup_checkbutton =
107 Gtk::manage(new Gtk::CheckButton("Remove duplicates when inserting new"
108 "\ncards from a Deck to the Card Box"));
110 Gtk::manage(new Gtk::CheckButton(
111 _("Remove duplicates when inserting new\n"
112 "cards from a Deck to the CardBox")));
109113 m_dup_checkbutton->set_alignment (0.1, 0);
110114
111115 m_relpath_checkbutton =
112 Gtk::manage(new Gtk::CheckButton("Record all dynamic links in CardFile"
113 " as relative paths"));
116 Gtk::manage(new Gtk::CheckButton(
117 _("Record all dynamic links in CardFile"
118 " as relative paths")));
114119 m_relpath_checkbutton->set_alignment (0.1, 0);
120
121 m_keys_shortcuts_checkbutton =
122 Gtk::manage(new Gtk::CheckButton(
123 _("Some keyboard input methods may conflict with keyboard\n"
124 "shortcuts. If checked, disable all shortcuts in DeckPlayer\n"
125 "dialog (requires restart).")));
126
127 m_keys_shortcuts_checkbutton->set_alignment (0.1, 0);
115128
116129 m_hist_size = Gtk::manage (new HistSizeBox);
117130
163176 m_relpath_checkbutton->set_active (false);
164177 m_relpath_checkbutton->set_border_width (4);
165178
179 m_keys_shortcuts_checkbutton->set_flags (Gtk::CAN_FOCUS);
180 m_keys_shortcuts_checkbutton->set_relief (Gtk::RELIEF_NORMAL);
181 m_keys_shortcuts_checkbutton->set_mode (true);
182 m_keys_shortcuts_checkbutton->set_active (false);
183 m_keys_shortcuts_checkbutton->set_border_width (4);
184
166185 /** Duplicate check button
167186 */
168187 empty_label = Gtk::manage(new Gtk::Label(""));
212231 frame3->set_label_widget (*empty_label);
213232 frame3->add (*m_hist_size);
214233
234 /** Key shortcuts
235 */
236 empty_label = Gtk::manage(new Gtk::Label(""));
237
238 empty_label->set_alignment (0.5,0.5);
239 empty_label->set_padding (0,0);
240 empty_label->set_justify (Gtk::JUSTIFY_LEFT);
241 empty_label->set_line_wrap (false);
242 empty_label->set_use_markup (false);
243 empty_label->set_selectable (false);
244
245 frame4->set_shadow_type (Gtk::SHADOW_ETCHED_IN);
246 frame4->set_border_width(2);
247 frame4->set_label_align (1, 1);
248 frame4->set_label_widget (*empty_label);
249 frame4->add (*m_keys_shortcuts_checkbutton);
250
215251 /** Set callbacks
216252 */
217253 pack_start (*m_font_table, Gtk::PACK_EXPAND_WIDGET, 4);
218254 pack_start (*frame1, Gtk::PACK_SHRINK, 0);
219255 pack_start (*frame2, Gtk::PACK_SHRINK, 0);
220256 pack_start (*frame3, Gtk::PACK_SHRINK, 0);
257 pack_start (*frame4, Gtk::PACK_SHRINK, 0);
221258
222259 m_dup_checkbutton->signal_toggled().connect (
223260 mem_fun (m_pref_window, &PrefWindow::changed_cb));
224261
225262 m_relpath_checkbutton->signal_toggled().connect (
263 mem_fun (m_pref_window, &PrefWindow::changed_cb));
264
265 m_keys_shortcuts_checkbutton->signal_toggled().connect (
226266 mem_fun (m_pref_window, &PrefWindow::changed_cb));
227267
228268 m_hist_size->get_entry ()->signal_changed ().connect (
258298 m_dup_checkbutton ->set_active (CONFIG->get_remove_duplicates ());
259299 m_relpath_checkbutton->set_active (CONFIG->with_relpaths ());
260300 m_hist_size ->set_value (CONFIG->get_history_size ());
301 m_keys_shortcuts_checkbutton->set_active (CONFIG->disable_key_shortcuts ());
302
261303 }
262304
263305 void
272314
273315 CONFIG->set_remove_duplicates (m_dup_checkbutton->get_active ());
274316 CONFIG->with_relpaths (m_relpath_checkbutton->get_active ());
317
275318 if (m_hist_size->get_value () <= 0) {
276319 m_hist_size->set_value (5); // enforce sane default
277320 }
278321 CONFIG->set_history_size (m_hist_size->get_value ());
322
323 CONFIG->disable_key_shortcuts (m_keys_shortcuts_checkbutton->get_active ());
279324 }
280325
281326 void
00 // -*- c++ -*-
11 // generated by glade--
22 //------------------------------------------------------------------------------
3 // $Id: GeneralPref.h,v 1.5 2005/06/15 03:17:00 vlg Exp $
3 // $Id: GeneralPref.h,v 1.6 2005/11/22 01:39:53 vlg Exp $
44 //------------------------------------------------------------------------------
55 // GeneralPref.h
66 //------------------------------------------------------------------------------
8484 FontEntry m_fentry [FONT_ENTRY_SZ]; // Font entry
8585 Gtk::CheckButton* m_dup_checkbutton;
8686 Gtk::CheckButton* m_relpath_checkbutton;
87 Gtk::CheckButton* m_keys_shortcuts_checkbutton;
8788 HistSizeBox* m_hist_size;
8889 Gtk::Table* m_font_table;
8990 };
00 // -*- c++ -*-
11 // Generated by assa-genesis
22 //------------------------------------------------------------------------------
3 // $Id: Granule-main.cpp,v 1.6 2005/05/06 02:37:01 vlg Exp $
3 // $Id: Granule-main.cpp,v 1.8 2005/11/13 02:50:48 vlg Exp $
44 //------------------------------------------------------------------------------
55 // Granule-main.cpp
66 //------------------------------------------------------------------------------
3838 " --secs-in-week NUM - Number of seconds in a week (used for debugging) \n"
3939 " \n"
4040 " -D, --log-file NAME - Write debug to NAME file \n"
41 " -d, --log-stdout - Write debug to standard output \n"
41 " -d, --log-stdout BOOL - Write debug to standard output \n"
4242 " -z, --log-size NUM - Maximum size debug file can reach (dfl: is 10Mb) \n"
4343 " \n"
4444 " -c, --log-level NUM - Log verbosity \n"
45 " -s, --with-log-server - Redirect log messages to the log server \n"
45 " -s, --with-log-server BOOL - Redirect log messages to the log server \n"
4646 " -S, --log-server NAME - Define assa-logd server address \n"
4747 " -m, --mask MASK - Mask (default: ALL = 0x7fffffff) \n"
4848 " \n"
4949 " -h, --help - Print this messag \n"
50 " -v, --version - Print version number \n";
50 " -v, --version - Print version number \n"
51 " \n";
5152 //------------------------------------------------------------------------------
5253
5354 #include "Granule-main.h"
8081
8182 GRANULE->init (&argc, argv, help_msg);
8283
83 GRANULE->initServer ();
84 GRANULE->processServer ();
84 GRANULE->init_service ();
85 GRANULE->process_events ();
8586
8687 return GRANULE->get_exit_value ();
8788 }
00 // -*- c++ -*-
11 // Generated by assa-genesis
22 //------------------------------------------------------------------------------
3 // $Id: Granule-main.h,v 1.16 2005/05/16 03:02:02 vlg Exp $
3 // $Id: Granule-main.h,v 1.17 2005/10/13 03:04:13 vlg Exp $
44 //------------------------------------------------------------------------------
55 // Granule-main.h
66 //------------------------------------------------------------------------------
1919 #ifndef MAIN_H
2020 #define MAIN_H
2121
22 #include <assa/Assert.h>
22 #include <assa/Assure.h>
2323
2424 using ASSA::APP;
2525 using ASSA::TRACE;
00 // -*- c++ -*-
11 // Generated by assa-genesis
22 //------------------------------------------------------------------------------
3 // $Id: Granule.cpp,v 1.20 2005/06/18 18:14:26 vlg Exp $
3 // $Id: Granule.cpp,v 1.23 2005/11/22 02:28:30 vlg Exp $
44 //------------------------------------------------------------------------------
55 // Granule.cpp
66 //------------------------------------------------------------------------------
2525 #include <unistd.h> // access(2)
2626 #include <stdlib.h> // system(3)
2727
28 #include <glibmm/ustring.h>
2829 #include <gtkmm/main.h>
2930
3031 #include <assa/CommonUtils.h>
4950 *******************************************************************************/
5051 Granule::
5152 Granule () :
52 m_timeout (0.01),
53 m_kit (NULL),
54 m_main_window (NULL),
55 m_secs_in_day (86400),
53 m_timeout (0.01),
54 m_kit (NULL),
55 m_main_window (NULL),
56 m_secs_in_day (86400),
5657 m_secs_in_week (604800)
5758 {
5859 add_opt ('g', "gtk-options", &m_gtk_options );
6768 rm_opt ('b', "daemon" );
6869 rm_opt ('l', "pidfile" );
6970 rm_opt ('L', "ommit-pidfile");
70 m_ommit_pidflock_flag = 0; // don't lock up on PID
71
72 /*---
73 * By defauil disable all debugging
74 *---*/
75
76 /* m_debug_mask = GRAPP | DECK | GUITRACE | ASSA::ERROR; */
77 m_debug_mask = 0;
78
79 /* m_with_log_server = true; */
71
72 m_ommit_pidfile = "yes"; // don't lock up on PID
73
74 /* By defauil disable all debugging
75 */
76 /* m_mask = GRAPP | DECK | GUITRACE | ASSA::ERROR; */
77 m_mask = 0;
78
8079 m_log_file = "granule.log";
81
8280 }
8381
8482 /**
118116 }
119117
120118 if (cfg.load () == 0) {
121 if (cfg.find_section ("options") != cfg.sect_end ()) {
122 m_gtk_options = cfg.get_value ("options", "gtk_options");
123
124 if ((v = cfg.get_value ("options", "log_file")) != "") {
125 m_log_file = v;
126 }
127 if ((v = cfg.get_value ("options","log_stdout")) != "") {
128 m_log_stdout_flag = (v == "1" || v == "yes") ? true : false;
129 }
130 if ((v = cfg.get_value ("options", "log_size")) != "") {
131 m_log_size = strtol (v.c_str (), NULL, 16); ;
132 }
133 if ((v = cfg.get_value ("options", "mask")) != "") {
134 m_debug_mask = strtol (v.c_str (), NULL, 16);
135 }
136 if ((v = cfg.get_value ("options","log_level")) != "") {
137 m_log_level = strtol (v.c_str(), NULL, 16);
138 }
139 }
119 parse_config_file (cfg);
140120 }
141121
142122 done:
156136
157137 if (m_log_level >= 0) {
158138 switch (m_log_level) {
159 case 6: m_debug_mask = ALL; break; // Log message flood!
160 case 5: m_debug_mask = 0x3F; break; // ALL_APPS+ERRORS
161 case 4: m_debug_mask = 0x40026; break; // +FORK
162 case 3: m_debug_mask = 0x26; break; // GRAPP+GUITRACE+ERRORS
163 case 2: m_debug_mask = 0x25; break; // TRACE+GUITRACE+ERRORS
164 case 1: m_debug_mask = 0x22; break; // GRAPP+ERRORS
165 case 0: default: m_debug_mask = 0x0;
139 case 6: m_mask = ALL; break; // Log message flood!
140 case 5: m_mask = 0x3F; break; // ALL_APPS+ERRORS
141 case 4: m_mask = 0x40026; break; // +FORK
142 case 3: m_mask = 0x26; break; // GRAPP+GUITRACE+ERRORS
143 case 2: m_mask = 0x25; break; // TRACE+GUITRACE+ERRORS
144 case 1: m_mask = 0x22; break; // GRAPP+ERRORS
145 case 0: default: m_mask = 0x0;
166146 }
167147 }
168148
169 LOGGER->enable_groups (m_debug_mask);
170
171 /** Install my own entity loader
149 LOGGER->enable_groups (m_mask);
150
151 /** Install my own entity loader. This will let me redefine
152 DTD URLs and support backward compatability.
172153 */
173154 m_default_entity_loader = xmlGetExternalEntityLoader();
174155 xmlSetExternalEntityLoader (my_xml_entity_loader);
156
157 /** Initialize XML parser
158 */
159 xmlInitParser ();
160 xmlIndentTreeOutput = 1;
175161 }
176162
177163 Granule::
178164 ~Granule ()
179165 {
180166 trace_with_mask("Granule::~Granule",GUITRACE);
167
168 /** Cleanup XML parser
169 */
170 xmlCleanupParser ();
181171
182172 /** First, disconnect from the timer callback.
183173 Failing to do so causes core dumps on exit from libsigc-2.0's
206196 /* Rewrite the url of the granule dtds to local files so we can
207197 * use the local dtds.
208198 *
209 * Look for /etc/xml for backwards compatibility with old files
199 * Look for /etc/xml for backwards compatibility with old files.
210200 */
211201 xmlParserInputPtr
212202 Granule::
218208
219209 xmlParserInputPtr ret;
220210
221 if (url_ && id_) {
222 DL ((GRAPP,"xml: url = \"%s\", id = \"%s\"\n", url_, id_));
211 if (url_) {
212 DL ((GRAPP,"URL = \"%s\"\n", url_));
213 }
214
215 if (id_) {
216 DL ((GRAPP,"ID = \"%s\"\n", id_));
223217 }
224218
225219 if (strcmp (url_, "/etc/xml/granule/granule.dtd") == 0 ||
240234
241235 void
242236 Granule::
243 initServer ()
244 {
245 trace_with_mask("Granule::initServer",GUITRACE);
237 init_service ()
238 {
239 trace_with_mask("Granule::init_service",GUITRACE);
246240
247241 ASSA::Log::disable_timestamp ();
248242 int gtk_argc = 0;
249243 char** gtk_argv = NULL;
250244
251245 DL((ALL,"gtk_options = \"%s\"\n", m_gtk_options.c_str ()));
252 DL((ALL,"log_stdout = %s\n", m_log_stdout_flag ? "true" : "false"));
246 DL((ALL,"log_stdout = %s\n", m_log_stdout.c_str ()));
253247 DL((ALL,"log_file = \"%s\"\n", m_log_file.c_str ()));
254248 DL((ALL,"log_size = %d\n", m_log_size));
255249 DL((ALL,"log_level = \"%d\"\n", m_log_level));
256 DL((ALL,"mask = 0x%X\n", m_debug_mask));
250 DL((ALL,"mask = 0x%X\n", m_mask));
257251
258252 /**
259253 * Block SIGCHLD for a moment
309303
310304 void
311305 Granule::
312 processServer ()
313 {
314 trace_with_mask("Granule::processServer",GUITRACE);
306 process_events ()
307 {
308 trace_with_mask("Granule::process_events",GUITRACE);
315309
316310 m_kit->run (*m_main_window);
317311 REACTOR->stopReactor ();
320314 /* gtk_exit (0); */
321315 }
322316
323 /**
317 /*******************************************************************************
324318 * Static utilities
325 */
319 ******************************************************************************/
326320 gchar*
327321 Granule::
328322 strip_pango_markup (const char* src_)
332326 pango_parse_markup (src_, -1, 0, &attrs, &result, NULL, NULL);
333327 g_free (attrs);
334328 return result;
329 }
330
331 bool
332 Granule::
333 check_markup (const Glib::ustring& str_)
334 {
335 PangoAttrList* attrs = NULL;
336 gchar* ptext = NULL;
337 gboolean ret = FALSE;
338
339 ret = pango_parse_markup (str_.c_str (), -1, 0, &attrs, &ptext, NULL, NULL);
340 g_free (attrs);
341 g_free (ptext);
342 return ret;
335343 }
336344
337345 void
347355 }
348356 }
349357
358 xmlChar*
359 Granule::
360 get_node_by_xpath (xmlDocPtr parser_, const char* xpath_)
361 {
362 xmlXPathContextPtr context = NULL;
363 xmlXPathObjectPtr result = NULL;
364 xmlNodeSet* nodeset = NULL;
365 xmlChar* keyword = NULL;
366
367 context = xmlXPathNewContext (parser_);
368 if (context == NULL) {
369 DL ((ASSA::ERROR,"Failed to create context.\n"));
370 goto done;
371 }
372
373 result = xmlXPathEval (BAD_CAST xpath_, context);
374
375 if (xmlXPathNodeSetIsEmpty (result->nodesetval)) {
376
377 DL ((ASSA::ERROR,"Empty nodeset for xpath \"%s\"\n", xpath_));
378 goto done;
379 }
380 nodeset = result->nodesetval;
381
382 /** We expect only one node
383 */
384 // for (int i = 0; i < nodeset->nodeNr; i++) {
385 keyword = xmlNodeListGetString (parser_,
386 nodeset->nodeTab[0]->xmlChildrenNode,
387 1);
388 // }
389
390 done:
391 if (result) {
392 xmlXPathFreeObject (result);
393 }
394 if (context) {
395 xmlXPathFreeContext (context);
396 }
397
398 return keyword;
399 }
00 // -*- c++ -*-
11 // Generated by assa-genesis
22 //------------------------------------------------------------------------------
3 // $Id: Granule.h,v 1.14 2005/06/18 18:14:26 vlg Exp $
3 // $Id: Granule.h,v 1.16 2005/11/13 02:50:48 vlg Exp $
44 //------------------------------------------------------------------------------
55 // Granule.h
66 //------------------------------------------------------------------------------
2121 #ifdef HAVE_CONFIG_H
2222 # include "config.h"
2323 #endif
24
25 #include <libxml/parser.h>
26 #include <libxml/xmlIO.h>
27
2428 #include <string>
2529 using std::string;
30
2631 #include <gtkmm.h>
2732
2833 #include <assa/GenServer.h>
2934 #include <assa/Singleton.h>
3035 #include <assa/TimeVal.h>
31
32 #include <libxml/xmlIO.h>
3336
3437 #include "DeckManager.h"
3538
4548 ~Granule ();
4649
4750 virtual void init (int* argc_, char* argv_[], const char* help_);
48 virtual void initServer ();
49 virtual void processServer ();
51
52 virtual void init_service ();
53 virtual void process_events ();
5054
5155 bool timer_cb ();
5256
5862 my_xml_entity_loader (const char* url_,
5963 const char* id_,
6064 xmlParserCtxtPtr ctxt_);
61 public:
62 static gchar* strip_pango_markup (const char* src_);
63 static void remove_common_prefixes (gchar*& src_);
65
66 public: // Common utilities used everywhere
67 static gchar* strip_pango_markup (const char* src_);
68 static void remove_common_prefixes (gchar*& src_);
69
70 /** Search DOM XML parser tree for the first element that
71 matches the xpath_.
72 */
73 static xmlChar* get_node_by_xpath (xmlDocPtr parser_, const char* xpath_);
74
75 /** Validate pango markup
76 @return true on success; false if entry is invalid
77 */
78 static bool check_markup (const Glib::ustring& str_);
6479
6580 private:
6681 void dump_package_envs ();
8297
8398 /* Useful definitions */
8499
85 #define GRANULE Granule::getInstance()
100 #define GRANULE Granule::get_instance()
86101
87 #define REACTOR GRANULE->getReactor()
102 #define REACTOR GRANULE->get_reactor()
88103 #define MAINWIN GRANULE->get_main_window()
89104 #define DECKMGR MAINWIN->get_deck_manager()
90105 #define DECKLIST MAINWIN->get_deck_list()
00 // -*- c++ -*-
11 // Generated by assa-genesis
22 //------------------------------------------------------------------------------
3 // $Id: MainWindow.cpp,v 1.42 2005/05/06 02:37:01 vlg Exp $
3 // $Id: MainWindow.cpp,v 1.44 2005/11/22 02:28:30 vlg Exp $
44 //------------------------------------------------------------------------------
55 // MainWindow.cpp
66 //------------------------------------------------------------------------------
7 // Copyright (c) 2004 by Vladislav Grinchenko
7 // Copyright (c) 2004,2005 by Vladislav Grinchenko
88 //
99 // This program is free software; you can redistribute it and/or
1010 // modify it under the terms of the GNU General Public License
184184
185185 exit_cb ();
186186 this->hide ();
187 GRANULE->setStopServerFlag ();
187 GRANULE->stop_service ();
188188
189189 return true;
190190 }
353353 {
354354 trace_with_mask("MainWindow::save_as_cb",GUITRACE);
355355
356 bool was_dirty = false;
357
356358 switch (m_state)
357359 {
358360 case Start: /* ignored */
364366 break;
365367
366368 case Dirty:
369 was_dirty = true;
367370 go_state (Clean);
368371
369372 case Clean:
370 save_file_as ();
373 if (save_file_as () < 0 && was_dirty) {
374 go_state (Dirty);
375 }
371376 set_mw_name ();
372377 break;
373378
529534 set_title (_(title.c_str ()));
530535 }
531536
532 void
537 int
533538 MainWindow::
534539 save_file_as ()
535540 {
549554 f.set_filter (filter_cdf);
550555
551556 if (f.run () != Gtk::RESPONSE_OK) {
552 return;
553 }
557 return -1;
558 }
559
554560 m_cardbox->save_as (f.get_filename ());
561 return 0;
555562 }
556563
557564 /**
00 // -*- c++ -*-
11 // Generated by assa-genesis
22 //------------------------------------------------------------------------------
3 // $Id: MainWindow.h,v 1.25 2005/05/06 02:37:01 vlg Exp $
3 // $Id: MainWindow.h,v 1.26 2005/11/22 02:28:30 vlg Exp $
44 //------------------------------------------------------------------------------
55 // MainWindow.h
66 //------------------------------------------------------------------------------
9696 // -*- Internal actions -*-
9797 int open_file ();
9898 int save_file ();
99 void save_file_as ();
99 int save_file_as ();
100100 void close_file ();
101101 void go_state (WMState state_);
102102 bool change_preferences ();
11 # ------------------------------------------------------------------------------
22 # src/Makefile.am
33 #
4 # $Id: Makefile.am,v 1.24 2005/06/09 03:04:52 vlg Exp $
4 # $Id: Makefile.am,v 1.25 2005/11/14 04:11:21 vlg Exp $
55 # ------------------------------------------------------------------------------
66
77 bin_PROGRAMS = granule
2424 Card.h Card.cpp \
2525 CardView.h CardView.cpp \
2626 CardViewHelpDialog.h CardViewHelpDialog.cpp \
27 EditControls.h EditControls.cpp \
2728 FileOpen.h \
2829 Config.h Config.cpp \
2930 TopMenuBar.h TopMenuBar.cpp \
1717 # ------------------------------------------------------------------------------
1818 # src/Makefile.am
1919 #
20 # $Id: Makefile.am,v 1.24 2005/06/09 03:04:52 vlg Exp $
20 # $Id: Makefile.am,v 1.25 2005/11/14 04:11:21 vlg Exp $
2121 # ------------------------------------------------------------------------------
2222
2323 SOURCES = $(granule_SOURCES)
6161 DeckView.$(OBJEXT) DeckInfo.$(OBJEXT) DeckPlayer.$(OBJEXT) \
6262 DeckManager.$(OBJEXT) DeckList.$(OBJEXT) VCard.$(OBJEXT) \
6363 CardRef.$(OBJEXT) Card.$(OBJEXT) CardView.$(OBJEXT) \
64 CardViewHelpDialog.$(OBJEXT) Config.$(OBJEXT) \
65 TopMenuBar.$(OBJEXT) GeneralPref.$(OBJEXT) \
64 CardViewHelpDialog.$(OBJEXT) EditControls.$(OBJEXT) \
65 Config.$(OBJEXT) TopMenuBar.$(OBJEXT) GeneralPref.$(OBJEXT) \
6666 SchedulingPrefs.$(OBJEXT) SoundPrefs.$(OBJEXT) \
6767 GeometryPrefs.$(OBJEXT) PrefWindow.$(OBJEXT) \
6868 MyPropertyBox.$(OBJEXT) ButtonWithImageLabel.$(OBJEXT) \
8282 @AMDEP_TRUE@ ./$(DEPDIR)/DeckInfo.Po ./$(DEPDIR)/DeckList.Po \
8383 @AMDEP_TRUE@ ./$(DEPDIR)/DeckManager.Po \
8484 @AMDEP_TRUE@ ./$(DEPDIR)/DeckPlayer.Po ./$(DEPDIR)/DeckView.Po \
85 @AMDEP_TRUE@ ./$(DEPDIR)/EditControls.Po \
8586 @AMDEP_TRUE@ ./$(DEPDIR)/GeneralPref.Po \
8687 @AMDEP_TRUE@ ./$(DEPDIR)/GeometryPrefs.Po \
8788 @AMDEP_TRUE@ ./$(DEPDIR)/Granule-main.Po ./$(DEPDIR)/Granule.Po \
279280 Card.h Card.cpp \
280281 CardView.h CardView.cpp \
281282 CardViewHelpDialog.h CardViewHelpDialog.cpp \
283 EditControls.h EditControls.cpp \
282284 FileOpen.h \
283285 Config.h Config.cpp \
284286 TopMenuBar.h TopMenuBar.cpp \
403405 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DeckManager.Po@am__quote@
404406 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DeckPlayer.Po@am__quote@
405407 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DeckView.Po@am__quote@
408 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EditControls.Po@am__quote@
406409 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeneralPref.Po@am__quote@
407410 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeometryPrefs.Po@am__quote@
408411 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Granule-main.Po@am__quote@
00 // -*- c++ -*-
11 // generated by glade--
22 //------------------------------------------------------------------------------
3 // $Id: SchedulingPrefs.cpp,v 1.3 2004/07/06 04:34:23 vlg Exp $
3 // $Id: SchedulingPrefs.cpp,v 1.4 2005/11/21 03:58:10 vlg Exp $
44 //------------------------------------------------------------------------------
55 // SchedulingPref.h
66 //------------------------------------------------------------------------------
2222 #include "SchedulingPrefs.h"
2323 #include "PrefWindow.h"
2424
25 #define SET_TITLE_LABEL(tl) \
26 tl->set_alignment(0,0.5); \
27 tl->set_padding(0,0); \
28 tl->set_justify(Gtk::JUSTIFY_LEFT); \
29 tl->set_line_wrap(false); \
30 tl->set_use_markup(false); \
31 tl->set_selectable(false);
32
2533 SchedulingPrefs::
2634 SchedulingPrefs (PrefWindow& pwin_) :
2735 VBox(false, 0),
3038 trace_with_mask("SchedulingPref::SchedulingPrefs",GUITRACE);
3139 int i;
3240
33 Gtk::Label *label_b010 = Gtk::manage(new Gtk::Label(" days "));
34 Gtk::Label *label_b020 = Gtk::manage(new Gtk::Label(" days "));
35 Gtk::Label *label_b030 = Gtk::manage(new Gtk::Label(" days "));
36 Gtk::Label *label_b040 = Gtk::manage(new Gtk::Label(" days "));
37 Gtk::Label *label_b050 = Gtk::manage(new Gtk::Label(" days "));
38 Gtk::Label *label_b001 = Gtk::manage(new Gtk::Label(" weeks "));
39 Gtk::Label *label_b002 = Gtk::manage(new Gtk::Label(" weeks "));
40 Gtk::Label *label_b003 = Gtk::manage(new Gtk::Label(" weeks "));
41 Gtk::Label *label_b004 = Gtk::manage(new Gtk::Label(" weeks "));
42 Gtk::Label *label_b005 = Gtk::manage(new Gtk::Label(" weeks "));
41 Gtk::Label* label_b01000 = Gtk::manage(new Gtk::Label(" weeks "));
42 Gtk::Label* label_b02000 = Gtk::manage(new Gtk::Label(" weeks "));
43 Gtk::Label* label_b03000 = Gtk::manage(new Gtk::Label(" weeks "));
44 Gtk::Label* label_b04000 = Gtk::manage(new Gtk::Label(" weeks "));
45 Gtk::Label* label_b05000 = Gtk::manage(new Gtk::Label(" weeks "));
46 Gtk::Label* label_b00100 = Gtk::manage(new Gtk::Label(" days "));
47 Gtk::Label* label_b00200 = Gtk::manage(new Gtk::Label(" days "));
48 Gtk::Label* label_b00300 = Gtk::manage(new Gtk::Label(" days "));
49 Gtk::Label* label_b00400 = Gtk::manage(new Gtk::Label(" days "));
50 Gtk::Label* label_b00500 = Gtk::manage(new Gtk::Label(" days "));
51 Gtk::Label* label_b00010 = Gtk::manage(new Gtk::Label(" hours "));
52 Gtk::Label* label_b00020 = Gtk::manage(new Gtk::Label(" hours "));
53 Gtk::Label* label_b00030 = Gtk::manage(new Gtk::Label(" hours "));
54 Gtk::Label* label_b00040 = Gtk::manage(new Gtk::Label(" hours "));
55 Gtk::Label* label_b00050 = Gtk::manage(new Gtk::Label(" hours "));
56 Gtk::Label* label_b00001 = Gtk::manage(new Gtk::Label(" mins "));
57 Gtk::Label* label_b00002 = Gtk::manage(new Gtk::Label(" mins "));
58 Gtk::Label* label_b00003 = Gtk::manage(new Gtk::Label(" mins "));
59 Gtk::Label* label_b00004 = Gtk::manage(new Gtk::Label(" mins "));
60 Gtk::Label* label_b00005 = Gtk::manage(new Gtk::Label(" mins "));
61
62 SET_TITLE_LABEL(label_b01000);
63 SET_TITLE_LABEL(label_b02000);
64 SET_TITLE_LABEL(label_b03000);
65 SET_TITLE_LABEL(label_b04000);
66 SET_TITLE_LABEL(label_b05000);
67 SET_TITLE_LABEL(label_b00100);
68 SET_TITLE_LABEL(label_b00200);
69 SET_TITLE_LABEL(label_b00300);
70 SET_TITLE_LABEL(label_b00400);
71 SET_TITLE_LABEL(label_b00500);
72 SET_TITLE_LABEL(label_b00010);
73 SET_TITLE_LABEL(label_b00020);
74 SET_TITLE_LABEL(label_b00030);
75 SET_TITLE_LABEL(label_b00040);
76 SET_TITLE_LABEL(label_b00050);
77 SET_TITLE_LABEL(label_b00001);
78 SET_TITLE_LABEL(label_b00002);
79 SET_TITLE_LABEL(label_b00003);
80 SET_TITLE_LABEL(label_b00004);
81 SET_TITLE_LABEL(label_b00005);
4382
4483 for (i = 0 ; i < CARD_BOX_SIZE; i++) {
84 m_week_entry [i] = Gtk::manage(new Gtk::Entry());
4585 m_day_entry [i] = Gtk::manage(new Gtk::Entry());
46 m_week_entry [i] = Gtk::manage(new Gtk::Entry());
47 }
48
49 Gtk::Label *label_b100 = Gtk::manage(new Gtk::Label("In Box 1 after "));
50 Gtk::Label *label_b200 = Gtk::manage(new Gtk::Label("In Box 2 after "));
51 Gtk::Label *label_b300 = Gtk::manage(new Gtk::Label("In Box 3 after "));
52 Gtk::Label *label_b400 = Gtk::manage(new Gtk::Label("In Box 4 after "));
53 Gtk::Label *label_b500 = Gtk::manage(new Gtk::Label("In Box 5 after "));
54
55 m_sched_table = Gtk::manage(new Gtk::Table(2, 2, false));
86 m_hour_entry [i] = Gtk::manage(new Gtk::Entry());
87 m_mins_entry [i] = Gtk::manage(new Gtk::Entry());
88 }
89
90 Gtk::Label* label_t100 = Gtk::manage(new Gtk::Label("In Box 1 after "));
91 Gtk::Label* label_t200 = Gtk::manage(new Gtk::Label("In Box 2 after "));
92 Gtk::Label* label_t300 = Gtk::manage(new Gtk::Label("In Box 3 after "));
93 Gtk::Label* label_t400 = Gtk::manage(new Gtk::Label("In Box 4 after "));
94 Gtk::Label* label_t500 = Gtk::manage(new Gtk::Label("In Box 5 after "));
95
96 m_sched_table = Gtk::manage(new Gtk::Table(5, 10, false));
5697
57 Gtk::Label *frame_label = Gtk::manage(new Gtk::Label("Review Cards"));
58 Gtk::Frame *m_frame = Gtk::manage(new Gtk::Frame());
59
60 label_b010->set_alignment(0,0.5);
61 label_b010->set_padding(0,0);
62 label_b010->set_justify(Gtk::JUSTIFY_LEFT);
63 label_b010->set_line_wrap(false);
64 label_b010->set_use_markup(false);
65 label_b010->set_selectable(false);
66 label_b020->set_alignment(0,0.5);
67 label_b020->set_padding(0,0);
68 label_b020->set_justify(Gtk::JUSTIFY_LEFT);
69 label_b020->set_line_wrap(false);
70 label_b020->set_use_markup(false);
71 label_b020->set_selectable(false);
72 label_b030->set_alignment(0,0.5);
73 label_b030->set_padding(0,0);
74 label_b030->set_justify(Gtk::JUSTIFY_LEFT);
75 label_b030->set_line_wrap(false);
76 label_b030->set_use_markup(false);
77 label_b030->set_selectable(false);
78 label_b040->set_alignment(0,0.5);
79 label_b040->set_padding(0,0);
80 label_b040->set_justify(Gtk::JUSTIFY_LEFT);
81 label_b040->set_line_wrap(false);
82 label_b040->set_use_markup(false);
83 label_b040->set_selectable(false);
84 label_b050->set_alignment(0,0.5);
85 label_b050->set_padding(0,0);
86 label_b050->set_justify(Gtk::JUSTIFY_LEFT);
87 label_b050->set_line_wrap(false);
88 label_b050->set_use_markup(false);
89 label_b050->set_selectable(false);
90 label_b001->set_alignment(0,0.5);
91 label_b001->set_padding(0,0);
92 label_b001->set_justify(Gtk::JUSTIFY_LEFT);
93 label_b001->set_line_wrap(false);
94 label_b001->set_use_markup(false);
95 label_b001->set_selectable(false);
96 label_b002->set_alignment(0,0.5);
97 label_b002->set_padding(0,0);
98 label_b002->set_justify(Gtk::JUSTIFY_LEFT);
99 label_b002->set_line_wrap(false);
100 label_b002->set_use_markup(false);
101 label_b002->set_selectable(false);
102 label_b003->set_alignment(0,0.5);
103 label_b003->set_padding(0,0);
104 label_b003->set_justify(Gtk::JUSTIFY_LEFT);
105 label_b003->set_line_wrap(false);
106 label_b003->set_use_markup(false);
107 label_b003->set_selectable(false);
108 label_b004->set_alignment(0,0.5);
109 label_b004->set_padding(0,0);
110 label_b004->set_justify(Gtk::JUSTIFY_LEFT);
111 label_b004->set_line_wrap(false);
112 label_b004->set_use_markup(false);
113 label_b004->set_selectable(false);
114 label_b005->set_alignment(0,0.5);
115 label_b005->set_padding(0,0);
116 label_b005->set_justify(Gtk::JUSTIFY_LEFT);
117 label_b005->set_line_wrap(false);
118 label_b005->set_use_markup(false);
119 label_b005->set_selectable(false);
98 Gtk::Label* frame_label = Gtk::manage(new Gtk::Label("Review Cards"));
99 Gtk::Frame* m_frame = Gtk::manage(new Gtk::Frame());
100
120101
121102 for (i = 0; i < CARD_BOX_SIZE; i++) {
103 m_week_entry [i]->set_flags(Gtk::CAN_FOCUS);
104 m_week_entry [i]->set_visibility(true);
105 m_week_entry [i]->set_editable(true);
106 m_week_entry [i]->set_max_length(0);
107 m_week_entry [i]->set_has_frame(true);
108 m_week_entry [i]->set_activates_default(false);
109 m_week_entry [i]->set_width_chars(3);
110
122111 m_day_entry [i]->set_flags(Gtk::CAN_FOCUS);
123112 m_day_entry [i]->set_visibility(true);
124113 m_day_entry [i]->set_editable(true);
125114 m_day_entry [i]->set_max_length(0);
126 m_day_entry [i]->set_text("3");
127115 m_day_entry [i]->set_has_frame(true);
128116 m_day_entry [i]->set_activates_default(false);
129117 m_day_entry [i]->set_width_chars(3);
130118
131 m_week_entry [i]->set_flags(Gtk::CAN_FOCUS);
132 m_week_entry [i]->set_visibility(true);
133 m_week_entry [i]->set_editable(true);
134 m_week_entry [i]->set_max_length(0);
135 m_week_entry [i]->set_text("0");
136 m_week_entry [i]->set_has_frame(true);
137 m_week_entry [i]->set_activates_default(false);
138 m_week_entry [i]->set_width_chars(3);
139 }
140
141 label_b100->set_alignment(0,0.5);
142 label_b100->set_padding(0,0);
143 label_b100->set_justify(Gtk::JUSTIFY_LEFT);
144 label_b100->set_line_wrap(false);
145 label_b100->set_use_markup(false);
146 label_b100->set_selectable(false);
147 label_b200->set_alignment(0,0.5);
148 label_b200->set_padding(0,0);
149 label_b200->set_justify(Gtk::JUSTIFY_LEFT);
150 label_b200->set_line_wrap(false);
151 label_b200->set_use_markup(false);
152 label_b200->set_selectable(false);
153 label_b300->set_alignment(0,0.5);
154 label_b300->set_padding(0,0);
155 label_b300->set_justify(Gtk::JUSTIFY_LEFT);
156 label_b300->set_line_wrap(false);
157 label_b300->set_use_markup(false);
158 label_b300->set_selectable(false);
159 label_b400->set_alignment(0,0.5);
160 label_b400->set_padding(0,0);
161 label_b400->set_justify(Gtk::JUSTIFY_LEFT);
162 label_b400->set_line_wrap(false);
163 label_b400->set_use_markup(false);
164 label_b400->set_selectable(false);
165 label_b500->set_alignment(0,0.5);
166 label_b500->set_padding(0,0);
167 label_b500->set_justify(Gtk::JUSTIFY_LEFT);
168 label_b500->set_line_wrap(false);
169 label_b500->set_use_markup(false);
170 label_b500->set_selectable(false);
119 m_hour_entry [i]->set_flags(Gtk::CAN_FOCUS);
120 m_hour_entry [i]->set_visibility(true);
121 m_hour_entry [i]->set_editable(true);
122 m_hour_entry [i]->set_max_length(0);
123 m_hour_entry [i]->set_has_frame(true);
124 m_hour_entry [i]->set_activates_default(false);
125 m_hour_entry [i]->set_width_chars(3);
126
127 m_mins_entry [i]->set_flags(Gtk::CAN_FOCUS);
128 m_mins_entry [i]->set_visibility(true);
129 m_mins_entry [i]->set_editable(true);
130 m_mins_entry [i]->set_max_length(0);
131 m_mins_entry [i]->set_has_frame(true);
132 m_mins_entry [i]->set_activates_default(false);
133 m_mins_entry [i]->set_width_chars(3);
134 }
135
136 SET_TITLE_LABEL(label_t100);
137 SET_TITLE_LABEL(label_t200);
138 SET_TITLE_LABEL(label_t300);
139 SET_TITLE_LABEL(label_t400);
140 SET_TITLE_LABEL(label_t500);
171141
172142 m_sched_table->set_size_request(-1,-1);
173143 m_sched_table->set_row_spacings(3);
174144 m_sched_table->set_col_spacings(2);
175145
176 m_sched_table->attach(*label_b010,2,3,0,1,
177 Gtk::FILL,Gtk::AttachOptions(),0,0);
178 m_sched_table->attach(*label_b020,2,3,1,2,
179 Gtk::FILL,Gtk::AttachOptions(),0,0);
180 m_sched_table->attach(*label_b030,2,3,2,3,
181 Gtk::FILL,Gtk::AttachOptions(),0,0);
182 m_sched_table->attach(*label_b040,2,3,3,4,
183 Gtk::FILL,Gtk::AttachOptions(),0,0);
184 m_sched_table->attach(*label_b050,2,3,4,5,
185 Gtk::FILL,Gtk::AttachOptions(),0,0);
186 m_sched_table->attach(*label_b001,4,5,0,1,
187 Gtk::FILL,Gtk::AttachOptions(),0,0);
188 m_sched_table->attach(*label_b002,4,5,1,2,
189 Gtk::FILL,Gtk::AttachOptions(),0,0);
190 m_sched_table->attach(*label_b003,4,5,2,3,
191 Gtk::FILL,Gtk::AttachOptions(),0,0);
192 m_sched_table->attach(*label_b004,4,5,3,4,
193 Gtk::FILL,Gtk::AttachOptions(),0,0);
194 m_sched_table->attach(*label_b005,4,5,4,5,
146 /** Attach labels (left, right, top, bottom)
147 */
148 m_sched_table->attach(*label_b01000,2,3,0,1,
149 Gtk::FILL,Gtk::AttachOptions(),0,0);
150 m_sched_table->attach(*label_b02000,2,3,1,2,
151 Gtk::FILL,Gtk::AttachOptions(),0,0);
152 m_sched_table->attach(*label_b03000,2,3,2,3,
153 Gtk::FILL,Gtk::AttachOptions(),0,0);
154 m_sched_table->attach(*label_b04000,2,3,3,4,
155 Gtk::FILL,Gtk::AttachOptions(),0,0);
156 m_sched_table->attach(*label_b05000,2,3,4,5,
157 Gtk::FILL,Gtk::AttachOptions(),0,0);
158
159 m_sched_table->attach(*label_b00100,4,5,0,1,
160 Gtk::FILL,Gtk::AttachOptions(),0,0);
161 m_sched_table->attach(*label_b00200,4,5,1,2,
162 Gtk::FILL,Gtk::AttachOptions(),0,0);
163 m_sched_table->attach(*label_b00300,4,5,2,3,
164 Gtk::FILL,Gtk::AttachOptions(),0,0);
165 m_sched_table->attach(*label_b00400,4,5,3,4,
166 Gtk::FILL,Gtk::AttachOptions(),0,0);
167 m_sched_table->attach(*label_b00500,4,5,4,5,
168 Gtk::FILL,Gtk::AttachOptions(),0,0);
169
170 m_sched_table->attach(*label_b00010,6,7,0,1,
171 Gtk::FILL,Gtk::AttachOptions(),0,0);
172 m_sched_table->attach(*label_b00020,6,7,1,2,
173 Gtk::FILL,Gtk::AttachOptions(),0,0);
174 m_sched_table->attach(*label_b00030,6,7,2,3,
175 Gtk::FILL,Gtk::AttachOptions(),0,0);
176 m_sched_table->attach(*label_b00040,6,7,3,4,
177 Gtk::FILL,Gtk::AttachOptions(),0,0);
178 m_sched_table->attach(*label_b00050,6,7,4,5,
179 Gtk::FILL,Gtk::AttachOptions(),0,0);
180
181 m_sched_table->attach(*label_b00001,8,9,0,1,
182 Gtk::FILL,Gtk::AttachOptions(),0,0);
183 m_sched_table->attach(*label_b00002,8,9,1,2,
184 Gtk::FILL,Gtk::AttachOptions(),0,0);
185 m_sched_table->attach(*label_b00003,8,9,2,3,
186 Gtk::FILL,Gtk::AttachOptions(),0,0);
187 m_sched_table->attach(*label_b00004,8,9,3,4,
188 Gtk::FILL,Gtk::AttachOptions(),0,0);
189 m_sched_table->attach(*label_b00005,8,9,4,5,
195190 Gtk::FILL,Gtk::AttachOptions(),0,0);
196191
197192 for (i = 0; i < CARD_BOX_SIZE; i++) {
198 m_sched_table->attach(*m_day_entry [i], 1,2,i,i+1,
199 Gtk::EXPAND|Gtk::FILL,Gtk::AttachOptions(),0,0);
200
201 m_sched_table->attach(*m_week_entry [i], 3,4,i,i+1,
202 Gtk::EXPAND|Gtk::FILL,Gtk::AttachOptions(),0,0);
203 }
204
205 m_sched_table->attach(*label_b100,0,1,0,1,
206 Gtk::FILL,Gtk::AttachOptions(),4,0);
207 m_sched_table->attach(*label_b200,0,1,1,2,
208 Gtk::FILL,Gtk::AttachOptions(),4,0);
209 m_sched_table->attach(*label_b300,0,1,2,3,
210 Gtk::FILL,Gtk::AttachOptions(),4,0);
211 m_sched_table->attach(*label_b400,0,1,3,4,
212 Gtk::FILL,Gtk::AttachOptions(),4,0);
213 m_sched_table->attach(*label_b500,0,1,4,5,
193 m_sched_table->attach(*m_week_entry [i], 1,2,i,i+1,
194 Gtk::EXPAND|Gtk::FILL,Gtk::AttachOptions(),0,0);
195
196 m_sched_table->attach(*m_day_entry [i], 3,4,i,i+1,
197 Gtk::EXPAND|Gtk::FILL,Gtk::AttachOptions(),0,0);
198
199 m_sched_table->attach(*m_hour_entry [i], 5,6,i,i+1,
200 Gtk::EXPAND|Gtk::FILL,Gtk::AttachOptions(),0,0);
201
202 m_sched_table->attach(*m_mins_entry [i], 7,8,i,i+1,
203 Gtk::EXPAND|Gtk::FILL,Gtk::AttachOptions(),0,0);
204 }
205
206 m_sched_table->attach(*label_t100,0,1,0,1,
207 Gtk::FILL,Gtk::AttachOptions(),4,0);
208 m_sched_table->attach(*label_t200,0,1,1,2,
209 Gtk::FILL,Gtk::AttachOptions(),4,0);
210 m_sched_table->attach(*label_t300,0,1,2,3,
211 Gtk::FILL,Gtk::AttachOptions(),4,0);
212 m_sched_table->attach(*label_t400,0,1,3,4,
213 Gtk::FILL,Gtk::AttachOptions(),4,0);
214 m_sched_table->attach(*label_t500,0,1,4,5,
214215 Gtk::FILL,Gtk::AttachOptions(),4,0);
215216
216217 frame_label->set_alignment(0.5,0.5);
227228 m_frame->set_label_widget(*frame_label);
228229
229230 for (i = 0; i < CARD_BOX_SIZE; i++) {
231 m_week_entry [i]->signal_changed().connect (
232 sigc::mem_fun (m_pref_window, &PrefWindow::changed_cb));
233
230234 m_day_entry [i]->signal_changed().connect (
231235 sigc::mem_fun (m_pref_window, &PrefWindow::changed_cb));
232236
233 m_week_entry [i]->signal_changed().connect (
234 sigc::mem_fun (m_pref_window, &PrefWindow::changed_cb));
235
236 m_day_entry [i]->show ();
237 m_hour_entry [i]->signal_changed().connect (
238 sigc::mem_fun (m_pref_window, &PrefWindow::changed_cb));
239
240 m_mins_entry [i]->signal_changed().connect (
241 sigc::mem_fun (m_pref_window, &PrefWindow::changed_cb));
242
237243 m_week_entry [i]->show ();
244 m_day_entry [i]->show ();
245 m_hour_entry [i]->show ();
246 m_mins_entry [i]->show ();
247
238248 }
239249
240250 set_border_width(18);
256266 trace_with_mask("SchedulingPrefs::load_from_config",GUITRACE);
257267
258268 for (int i = 0; i < CARD_BOX_SIZE; i++) {
269 m_week_entry [i]->set_text (CONFIG->get_sched_review_weeks (i));
259270 m_day_entry [i]->set_text (CONFIG->get_sched_review_days (i));
260 m_week_entry [i]->set_text (CONFIG->get_sched_review_weeks (i));
271 m_hour_entry [i]->set_text (CONFIG->get_sched_review_hours (i));
272 m_mins_entry [i]->set_text (CONFIG->get_sched_review_mins (i));
261273 }
262274 }
263275
268280 trace_with_mask("SchedulingPrefs::save_to_config",GUITRACE);
269281
270282 for (int i = 0; i < CARD_BOX_SIZE; i++) {
271 CONFIG->set_sched_review_days (i, m_day_entry [i] ->get_text ());
272283 CONFIG->set_sched_review_weeks (i, m_week_entry [i]->get_text ());
273 }
274 }
284 CONFIG->set_sched_review_days (i, m_day_entry [i]->get_text ());
285 CONFIG->set_sched_review_hours (i, m_hour_entry [i]->get_text ());
286 CONFIG->set_sched_review_mins (i, m_mins_entry [i]->get_text ());
287 }
288 }
00 // -*- c++ -*-
11 // generated by glade--
22 //------------------------------------------------------------------------------
3 // $Id: SchedulingPrefs.h,v 1.2 2004/06/01 03:52:29 vlg Exp $
3 // $Id: SchedulingPrefs.h,v 1.3 2005/11/21 03:58:10 vlg Exp $
44 //------------------------------------------------------------------------------
55 // SchedulingPref.h
66 //------------------------------------------------------------------------------
4040 Gtk::Table* m_sched_table;
4141
4242 Gtk::Entry* m_week_entry [CARD_BOX_SIZE];
43 Gtk::Entry* m_day_entry [CARD_BOX_SIZE];
43 Gtk::Entry* m_day_entry [CARD_BOX_SIZE];
44 Gtk::Entry* m_hour_entry [CARD_BOX_SIZE];
45 Gtk::Entry* m_mins_entry [CARD_BOX_SIZE];
4446 };
4547
4648 #endif
11 //------------------------------------------------------------------------------
22 // TopMenuBar.cpp
33 //------------------------------------------------------------------------------
4 // $Id: TopMenuBar.cpp,v 1.20 2005/05/16 03:02:02 vlg Exp $
4 // $Id: TopMenuBar.cpp,v 1.21 2005/10/13 03:04:13 vlg Exp $
55 //------------------------------------------------------------------------------
66 // Copyright (c) 2004 by Vladislav Grinchenko
77 //
1515
1616 #include <gtkmm/stock.h>
1717
18 #include <assa/Assert.h>
18 #include <assa/Assure.h>
1919
2020 #include "Granule.h"
2121 #include "TopMenuBar.h"
237237 if (m_menu_bar == NULL) {
238238 DL((ASSA::ERROR,
239239 "TopMenuBar::get_menu_bar() : m_menu_bar uninitialized!\n"));
240 Assert_exit (false);
240 Assure_exit (false);
241241 }
242242 return m_menu_bar;
243243 }
11 //------------------------------------------------------------------------------
22 // VDeck.h
33 //------------------------------------------------------------------------------
4 // $Id: VDeck.h,v 1.6 2004/11/14 06:00:49 vlg Exp $
4 // $Id: VDeck.h,v 1.7 2005/11/13 02:50:48 vlg Exp $
55 //
66 // Copyright (c) 2004 by Vladislav Grinchenko
77 //
2020 #include <vector>
2121
2222 #include <glibmm/ustring.h>
23 #include <libxml++/libxml++.h>
23
24 #include <libxml/encoding.h>
25 #include <libxml/xmlwriter.h>
26 #include <libxml/xpath.h>
27 #include <libxml/xpathInternals.h>
28 #include <libxml/parserInternals.h>
2429
2530 #include "Granule-main.h"
2631
3641 public:
3742 virtual ~VDeck ();
3843
39 virtual void load (const string& fname_) { /* no-op */ }
44 virtual int load (const string& fname_) { return -1; }
4045 virtual int save () { return 0; }
4146 virtual int save_as (const string& fname_) { return 0; }
4247
4954 virtual size_t size () const = 0;
5055 virtual bool empty () const = 0;
5156
52 virtual void push_back (VCard* card_) = 0;
53 virtual void erase (cardlist_iterator iter_) = 0;
54 virtual bool erase (VCard* card_) = 0;
57 virtual void push_back (VCard* card_) = 0;
58 virtual void erase (cardlist_iterator iter_) = 0;
59 virtual bool erase (VCard* card_) = 0;
5560
5661 virtual void play_card (VDeck::cardlist_iterator& iter_) = 0;
5762