Fix reading poems from file in wxPoem demo
When using ftell to get the position in the file, it should be opened in binary mode. Regenerate the poem index file with the correct start positions. Use the wxICON macro for creating the icon, so .ico is used on Windows.
This commit is contained in:
@@ -119,7 +119,7 @@ MainWindow::MainWindow(wxFrame *frame, wxWindowID id, const wxString& title,
|
||||
ReadPreferences();
|
||||
CreateFonts();
|
||||
|
||||
SetIcon(wxpoem_xpm);
|
||||
SetIcon(wxICON(wxpoem));
|
||||
|
||||
m_corners[0] = new wxIcon( corner1_xpm );
|
||||
m_corners[1] = new wxIcon( corner2_xpm );
|
||||
@@ -788,7 +788,7 @@ bool LoadPoem(const wxChar *file_name, long position)
|
||||
}
|
||||
|
||||
wxSprintf(buf, wxT("%s.dat"), file_name);
|
||||
data_file = wxFopen(buf, wxT("r"));
|
||||
data_file = wxFopen(buf, wxT("rb"));
|
||||
|
||||
if (data_file == NULL)
|
||||
{
|
||||
@@ -862,7 +862,7 @@ long MainWindow::DoSearch(void)
|
||||
if (data_filename)
|
||||
wxSprintf(buf, wxT("%s.dat"), data_filename);
|
||||
|
||||
file = wxFopen(buf, wxT("r"));
|
||||
file = wxFopen(buf, wxT("rb"));
|
||||
if (! (data_filename && file))
|
||||
{
|
||||
wxSprintf(error_buf, wxT("Poetry data file %s not found\n"), buf);
|
||||
@@ -948,7 +948,7 @@ bool Compile(void)
|
||||
if (data_filename)
|
||||
wxSprintf(buf, wxT("%s.dat"), data_filename);
|
||||
|
||||
file = wxFopen(buf, wxT("r"));
|
||||
file = wxFopen(buf, wxT("rb"));
|
||||
if (! (data_filename && file))
|
||||
{
|
||||
wxSprintf(error_buf, wxT("Poetry data file %s not found\n"), buf);
|
||||
|
||||
@@ -1,137 +1,137 @@
|
||||
135
|
||||
|
||||
0
|
||||
448
|
||||
706
|
||||
886
|
||||
1046
|
||||
1354
|
||||
1754
|
||||
2127
|
||||
2806
|
||||
3376
|
||||
3992
|
||||
4381
|
||||
4620
|
||||
5195
|
||||
5918
|
||||
6165
|
||||
6801
|
||||
7497
|
||||
8216
|
||||
8687
|
||||
9145
|
||||
9398
|
||||
10065
|
||||
10397
|
||||
10631
|
||||
10881
|
||||
11290
|
||||
11589
|
||||
11981
|
||||
12126
|
||||
12807
|
||||
13441
|
||||
14112
|
||||
14568
|
||||
15238
|
||||
15927
|
||||
16617
|
||||
17092
|
||||
17415
|
||||
18121
|
||||
18775
|
||||
19327
|
||||
19870
|
||||
20557
|
||||
21198
|
||||
21657
|
||||
22441
|
||||
22949
|
||||
23526
|
||||
23701
|
||||
23954
|
||||
24362
|
||||
24535
|
||||
24743
|
||||
24921
|
||||
27139
|
||||
27335
|
||||
27576
|
||||
28162
|
||||
28342
|
||||
28766
|
||||
28935
|
||||
29132
|
||||
29339
|
||||
29543
|
||||
29765
|
||||
29989
|
||||
30422
|
||||
31079
|
||||
31624
|
||||
32028
|
||||
32667
|
||||
34127
|
||||
34595
|
||||
34937
|
||||
35071
|
||||
35295
|
||||
35482
|
||||
35745
|
||||
36172
|
||||
36665
|
||||
37076
|
||||
37225
|
||||
37812
|
||||
38323
|
||||
38810
|
||||
40525
|
||||
40914
|
||||
41585
|
||||
42287
|
||||
44104
|
||||
45220
|
||||
46627
|
||||
47212
|
||||
47952
|
||||
48559
|
||||
49044
|
||||
49535
|
||||
50201
|
||||
51482
|
||||
52736
|
||||
53914
|
||||
54701
|
||||
55477
|
||||
55990
|
||||
56254
|
||||
56527
|
||||
57020
|
||||
57428
|
||||
57625
|
||||
58263
|
||||
59074
|
||||
59747
|
||||
60702
|
||||
61439
|
||||
62934
|
||||
63483
|
||||
63698
|
||||
64019
|
||||
64311
|
||||
64531
|
||||
64687
|
||||
65222
|
||||
65419
|
||||
66021
|
||||
66876
|
||||
67342
|
||||
67664
|
||||
68721
|
||||
69524
|
||||
70788
|
||||
71483
|
||||
72201
|
||||
72922
|
||||
73604
|
||||
432
|
||||
678
|
||||
849
|
||||
1000
|
||||
1289
|
||||
1676
|
||||
2036
|
||||
2695
|
||||
3247
|
||||
3839
|
||||
4214
|
||||
4444
|
||||
5002
|
||||
5705
|
||||
5943
|
||||
6559
|
||||
7236
|
||||
7935
|
||||
8387
|
||||
8826
|
||||
9065
|
||||
9712
|
||||
10030
|
||||
10251
|
||||
10488
|
||||
10879
|
||||
11165
|
||||
11541
|
||||
11679
|
||||
12341
|
||||
12952
|
||||
13601
|
||||
14037
|
||||
14685
|
||||
15355
|
||||
16023
|
||||
16480
|
||||
16789
|
||||
17472
|
||||
18104
|
||||
18634
|
||||
19160
|
||||
19828
|
||||
20450
|
||||
20892
|
||||
21651
|
||||
22144
|
||||
22697
|
||||
22863
|
||||
23105
|
||||
23495
|
||||
23659
|
||||
23858
|
||||
24027
|
||||
26188
|
||||
26375
|
||||
26605
|
||||
27170
|
||||
27341
|
||||
27752
|
||||
27912
|
||||
28100
|
||||
28298
|
||||
28493
|
||||
28705
|
||||
28919
|
||||
29336
|
||||
29969
|
||||
30491
|
||||
30876
|
||||
31495
|
||||
32918
|
||||
33373
|
||||
33703
|
||||
33830
|
||||
34045
|
||||
34223
|
||||
34477
|
||||
34889
|
||||
35367
|
||||
35760
|
||||
35898
|
||||
36461
|
||||
36950
|
||||
37417
|
||||
39079
|
||||
39455
|
||||
40104
|
||||
40787
|
||||
42555
|
||||
43641
|
||||
45010
|
||||
45571
|
||||
46287
|
||||
46870
|
||||
47331
|
||||
47808
|
||||
48457
|
||||
49704
|
||||
50924
|
||||
52070
|
||||
52830
|
||||
53582
|
||||
54076
|
||||
54328
|
||||
54590
|
||||
55064
|
||||
55453
|
||||
55643
|
||||
56256
|
||||
57048
|
||||
57698
|
||||
58621
|
||||
59337
|
||||
60780
|
||||
61314
|
||||
61518
|
||||
61825
|
||||
62104
|
||||
62315
|
||||
62462
|
||||
62980
|
||||
63167
|
||||
63748
|
||||
64581
|
||||
65034
|
||||
65343
|
||||
66368
|
||||
67140
|
||||
68358
|
||||
69033
|
||||
69732
|
||||
70434
|
||||
71096
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
aaaa ICON "wxpoem.ico"
|
||||
wxpoem ICON "wxpoem.ico"
|
||||
|
||||
#include "wx/msw/wx.rc"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user