diff -Naru wesnoth-1.9.6-org/SConstruct wesnoth-1.9.6/SConstruct --- wesnoth-1.9.6-org/SConstruct 2011-03-01 07:47:44.000000000 +0900 +++ wesnoth-1.9.6/SConstruct 2011-05-14 23:36:29.113604000 +0900 @@ -368,6 +368,7 @@ if "gcc" in env["TOOLS"]: env.AppendUnique(CCFLAGS = Split("-W -Wall"), CFLAGS = ["-std=c99"]) + env.AppendUnique(CXXFLAGS = Split("-U__STRICT_ANSI__")) if env['cxx0x']: env.AppendUnique(CXXFLAGS = "-std=c++0x") @@ -406,7 +407,7 @@ env[d] = os.path.join(env["prefix"], env[d]) if env["PLATFORM"] == 'win32': - env.Append(LIBS = ["wsock32", "intl", "z"], CCFLAGS = ["-mthreads"], LINKFLAGS = ["-mthreads"], CPPDEFINES = ["_WIN32_WINNT=0x0500"]) + env.Append(LIBS = ["wsock32", "intl", "z", "SDLSKK", "iconv", "SDL", "SDL_ttf"], CCFLAGS = ["-mthreads"], LINKFLAGS = ["-mthreads"], CPPDEFINES = ["_WIN32_WINNT=0x0500"]) if env["PLATFORM"] == 'darwin': # Mac OS X env.Append(FRAMEWORKS = "Carbon") # Carbon GUI diff -Naru wesnoth-1.9.6-org/data/gui/default/widget/text_box_default.cfg wesnoth-1.9.6/data/gui/default/widget/text_box_default.cfg --- wesnoth-1.9.6-org/data/gui/default/widget/text_box_default.cfg 2011-01-11 05:38:49.000000000 +0900 +++ wesnoth-1.9.6/data/gui/default/widget/text_box_default.cfg 2011-05-14 19:57:35.548720570 +0900 @@ -48,6 +48,7 @@ font_size = {SIZE} color = {COLOR} text = "(text)" + sdlskk_surface = "(sdlskk_surface)" [/text] #enddef diff -Naru wesnoth-1.9.6-org/data/hardwired/fonts.cfg wesnoth-1.9.6/data/hardwired/fonts.cfg --- wesnoth-1.9.6-org/data/hardwired/fonts.cfg 2011-03-25 01:29:56.000000000 +0900 +++ wesnoth-1.9.6/data/hardwired/fonts.cfg 2011-05-14 18:19:59.171876400 +0900 @@ -1,51 +1,10 @@ #textdomain wesnoth [fonts] - # This is marked as translatable, to allow translators to - # provide different font orders: one just has to install the - # missing fonts without needing to change the gmo files - order=_ "DejaVuSans.ttf,Andagii.ttf,wqy-zenhei.ttc,Junicode-Regular.ttf" - family_order=_ "DejaVu Sans,Andagii,WenQuanYi Zen Hei,Junicode" + order=_ "msgothic.ttc" + family_order=_ "MS UI Gothic" [font] - name="DejaVuSans.ttf" - codepoints="32-126,160-745,748-750,755,759,768-847,849-851,855-856,858,860-866,880-887,890-894,900-906,908,910-929,931-1317,1329-1366,1369-1375,1377-1415,1417-1418,1456-1475,1478-1479,1488-1514,1520-1524,1542-1543,1545-1546,1548,1557,1563,1567,1569-1594,1600-1621,1623,1626,1632-1648,1652,1657-1727,1734,1740,1742,1749,1776-1785,1984-2023,2027-2037,2040-2042,3647,3713-3714,3716,3719-3720,3722,3725,3732-3735,3737-3743,3745-3747,3749,3751,3754-3755,3757-3769,3771-3773,3776-3780,3782,3784-3789,3792-3801,3804-3805,4256-4293,4304-4348,5121-5127,5129-5147,5149-5173,5175-5194,5196-5202,5204-5309,5312-5354,5356-5383,5392-5438,5440-5456,5458-5482,5492-5509,5514-5526,5536-5551,5598,5601,5702-5703,5742-5750,5760-5788,7424-7531,7543-7544,7547,7549,7557,7579-7615,7620-7625,7680-7931,7936-7957,7960-7965,7968-8005,8008-8013,8016-8023,8025,8027,8029,8031-8061,8064-8116,8118-8132,8134-8147,8150-8155,8157-8175,8178-8180,8182-8190,8192-8292,8298-8305,8308-8334,8336-8348,8352-8373,8376-8377,8400-8401,8406-8407,8411-8412,8417,8448-8457,8459-8521,8523,8526,8528-8581,8585,8592-8981,8984-8985,8988-8993,8996-9004,9013,9015-9022,9025-9028,9031-9033,9035-9037,9040,9042-9044,9047-9052,9054-9056,9059-9061,9064-9065,9067-9072,9075-9082,9085,9088-9091,9095-9099,9108-9109,9115-9134,9166-9167,9187,9189,9192,9250-9251,9312-9321,9472-9884,9888-9912,9920-9923,9954,9985-9988,9990-9993,9996-10023,10025-10059,10061,10063-10066,10070,10072-10078,10081-10132,10136-10159,10161-10175,10181-10182,10208,10214-10219,10224-10623,10627-10628,10702-10709,10731,10746-10747,10752-10754,10764-10780,10799,10877-10912,10926-10938,11001-11002,11008-11034,11039-11044,11091-11092,11360-11383,11385-11391,11520-11557,11568-11621,11631,11800,11810-11813,11822,19904-19967,42564-42567,42572-42573,42576-42577,42580-42583,42594-42606,42634-42637,42644-42645,42760-42774,42779-42783,42786-42815,42822-42827,42830-42835,42838-42839,42852-42857,42875-42876,42880-42887,42889-42894,42896-42897,43002-43007,57344-57373,61184-61209,61440-61443,61960,61962,61973-61975,61978-61979,62047,62464-62502,62504,62917,63172-63176,63185,63188,64256-64262,64275-64279,64285-64335,64338-64419,64426-64429,64467-64470,64473-64474,64488-64489,64508-64511,65024-65039,65056-65059,65136-65140,65142-65276,65279,65529-65533,66304-66334,66336-66339,119552-119638,119808-119892,119894-119963,120120-120121,120123-120126,120128-120132,120134,120138-120144,120146-120171,120224-120485,120488-120779,120782-120831,127024-127123,127136-127150,127153-127166,127169-127183,127185-127199,128045-128046,128049,128053,128513-128528,128530-128532,128534,128536,128538,128540-128542,128544-128547,128549,128552-128555,128557,128560-128563,128565-128576" + name="msgothic.ttc" [/font] - [font] - name="Andagii.ttf" - codepoints="32,183,66640-66687" - [/font] - [font] - name="wqy-zenhei.ttc" - #generated by a script provided by FangQ - #ref: http://wenq.org/forum/viewtopic.php?f=6&t=790 - codepoints="33-96,98-128,161-191,193-256,261-261,269-269,271-271,287-287,289-289,296-296,301-303,309-309,313-314,333-334,339-339,341-344,348-348,350-352,360-360,363-364,373-373,377-378,452-452,454-454,456-456,458-458,460-460,462-462,464-464,466-466,591-591,639-639,677-677,707-707,709-712,720-720,725-727,729-729,897-914,916-916,918-924,929-957,959-960,978-992,1025-1042,1044-1055,1057-1090,1092-1103,1105-1120,4353-4353,4357-4362,4365-4365,4385-4393,4395-4397,4399-4400,4406-4406,4408-4408,4410-4412,4415-4415,4417-4417,4426-4435,4437-4440,4444-4447,4449-4458,4481-4481,4483-4491,4493-4493,4496-4503,4505-4506,4509-4518,4520-4521,4529-4530,4533-4533,4535-4536,4542-4542,4544-4544,4546-4546,4548-4550,4552-4552,4554-4556,4558-4561,4563-4563,4565-4567,4570-4576,4583-4608,8195-8196,8199-8200,8202-8205,8208-8208,8229-8229,8235-8240,8250-8251,8255-8256,8289-8289,8300-8300,8348-8351,8372-8372,8375-8375,8458-8458,8461-8461,8471-8471,8475-8475,8477-8477,8501-8501,8506-8506,8510-8511,8514-8517,8524-8525,8549-8560,8565-8576,8583-8592,8652-8652,8654-8654,8705-8707,8710-8710,8714-8715,8719-8719,8721-8721,8725-8725,8728-8729,8733-8734,8736-8736,8739-8740,8745-8748,8754-8754,8756-8761,8763-8763,8765-8765,8768-8768,8782-8782,8788-8788,8792-8792,8817-8818,8821-8822,8825-8828,8831-8832,8839-8839,8843-8843,8857-8858,8861-8862,8865-8865,8891-8891,8974-8974,9277-9277,9313-9440,9462-9568,9580-9600,9611-9615,9617-9631,9635-9636,9641-9642,9645-9646,9655-9661,9663-9664,9679-9682,9685-9685,9688-9690,9695-9696,9723-9726,9730-9730,9732-9732,9745-9746,9751-9751,9754-9755,9769-9776,9822-9822,9824-9824,9841-9856,11905-11909,11911-12000,12013-12224,12235-12256,12289-12315,12317-12320,12326-12328,12337-12338,12343-12383,12385-12416,12418-12421,12428-12479,12481-12512,12514-12571,12577-12591,12595-12686,12690-12704,12713-12716,12737-12768,12797-12800,12804-12864,12893-12897,12901-12960,12976-13008,13013-13024,13026-13056,13121-13128,13154-13157,13168-13248,13251-13280,13282-13312,19905-40896,40925-40928,44033-55200,55229-55232,63745-64000,64002-64011,64014-64014,64016-64016,64019-64048,64051-64054,64058-64059,64062-64062,64064-64112,64118-64192,64199-64200,64210-64224,65032-65033,65057-65072,65089-65095,65097-65100,65102-65120,65141-65144,65146-65152,65281-65311,65313-65344,65346-65376,65520-65521,65530-65536,65568-65568,119553-119616,119626-119648,119663-119680,132441-132441,194562-194563,194565-194569,194571-194572,194575-194578,194581-194588,194590-194599,194601-194603,194605-194619,194621-194630,194632-194658,194660-194660,194662-194665,194667-194670,194672-194675,194677-194679,194682-194686,194689-194692,194694-194695,194699-194701,194704-194704,194706-194709,194713-194716,194718-194721,194723-194727,194729-194747,194749-194749,194752-194753,194756-194760,194762-194766,194769-194769,194771-194773,194775-194776,194778-194781,194783-194788,194790-194790,194794-194797,194799-194799,194801-194801,194803-194803,194805-194808,194810-194812,194814-194816,194818-194818,194820-194820,194822-194825,194827-194830,194833-194834,194836-194837,194839-194841,194843-194848,194854-194854,194856-194856,194858-194858,194860-194860,194862-194866,194869-194869,194871-194872,194875-194876,194878-194881,194885-194887,194889-194890,194893-194893,194896-194898,194902-194902,194904-194907,194912-194913,194915-194915,194918-194920,194922-194922,194928-194930,194932-194932,194934-194936,194938-194938,194941-194942,194945-194952,194954-194961,194963-194965,194970-194971,194973-194974,194978-194989,194996-194996,194998-195000,195005-195010,195012-195014,195017-195020,195022-195025,195031-195031,195033-195034,195036-195037,195039-195042,195046-195046,195051-195053,195056-195056,195058-195058,195060-195066,195068-195070,195076-195081,195083-195083,195089-195089,195092-195094,195097-195100,195102-195102" - [/font] - [font] - name="Junicode-Regular.ttf" - codepoints="5792-5872" - [/font] -#ifdef FOR_COMPATIBILITY_SAKE - # - # The old entries below are only left for compatibility sake that is if someone - # wants to keep using those fonts anyway. In general sazanami-gothic.ttf *and* - # wqy-zenhei-gb2312.ttf were replaced by wqy-zenhei.ttc (yes, .ttc, not .ttf...) - # The entries above have to be removed beforehand, since they have priority over - # the codepoint ranges below. - # - [font] - name="sazanami-gothic.ttf" - # Being large for codepoints: include characters - # page-per-page, and not on a per-character basis, or else the - # list would be huge. - codepoints="32-64,91-96,123-126,305,321-322,331,338-339,402,593,602,658,710-711,714-715,728,730,732,913-929,931-937,945-969,977,981,1025,1040-1103,1105,12288-12543,12800-40959,63744-64255,65280-65439,65537-65991" - [/font] - [font] - name="wqy-zenhei-gb2312.ttf" - # list generated via ./utils/codeextract zh_CN | codelist - # please do update it regulary; using the same definition for - # the default ascii chars that is used with sazanami-gothic - codepoints="32-64,91-96,123-126,183,196,220,225-226,228,230,233,235,243,246,252,8211-8212,8216-8217,8220-8221,8230,9472,9792,9794,12288-12290,12298-12299,19968-19969,19971,19975-19979,19981-19982,19984-19985,19987-19988,19990,19992,19994-19997,20002,20004-20005,20007,20010,20013,20016,20018,20020,20025-20027,20029-20030,20035,20037,20040-20041,20043-20044,20046-20048,20052,20056,20061-20065,20070,20080-20081,20083,20102,20104-20105,20107-20108,20110-20111,20113-20114,20116-20117,20122-20123,20129-20130,20132,20134-20135,20139-20142,20146,20149,20154,20160-20161,20165-20167,20170-20171,20173-20174,20179-20180,20182-20185,20195-20197,20202-20204,20208,20210,20214-20215,20219,20221,20223,20225,20234,20237,20239-20241,20247-20250,20255-20256,20260,20262,20266,20271-20272,20276,20280,20284-20285,20294,20301-20305,20307,20309,20312-20316,20320,20323,20329,20339,20347-20348,20351,20356,20358,20360,20363,20365,20367,20379,20381,20384,20390-20391,20398-20399,20405,20415,20419-20420,20439-20440,20445,20449,20457,20462-20463,20465,20493,20498,20505-20506,20511,20518,20538,20540,20542,20551,20556,20559,20570,20572,20581,20598-20599,20607-20608,20613,20621,20648,20658-20659,20667,20687,20698,20725,20731,20754,20769,20799-20801,20803-20806,20808-20809,20811,20813,20817,20826,20837,20839-20841,20843-20845,20848-20849,20851-20857,20859,20861,20869,20872,20876-20877,20882,20887,20889,20891-20892,20896,20900-20901,20908,20912,20914-20915,20917-20919,20923,20928,20932,20934,20937,20940,20943,20945,20957,20960-20961,20973,20975,20982,20984-20987,20991-20992,20995,20998-20999,21009-21010,21015,21017-21019,21021,21024,21028,21033,21035,21038,21040,21046-21047,21050-21051,21057-21058,21066,21069,21073,21076,21095,21097-21098,21103,21106,21128,21147,21149-21153,21155,21160-21163,21169-21171,21183,21187,21191,21193,21195,21202,21208,21213,21215,21220,21246-21247,21253-21254,21256,21269-21271,21273,21280-21281,21290,21305-21307,21311,21313,21315,21319-21320,21322,21326-21327,21329-21331,21333-21335,21338,21340,21344-21346,21351,21355,21360-21361,21363-21365,21367-21368,21371,21380-21382,21385,21387-21388,21402,21407,21414,21435,21442,21448-21453,21457,21460,21462-21465,21467,21472,21475-21478,21482-21484,21486-21488,21490-21491,21493-21497,21505,21507-21508,21512-21513,21516-21518,21520-21521,21523,21526-21527,21531,21534-21535,21542-21543,21545,21547-21548,21551,21553,21556-21557,21560-21561,21563,21566,21568,21571,21574,21576,21578,21584,21589,21592,21596,21602,21608,21619,21621,21624,21627-21629,21632,21638,21643-21644,21648,21650,21652-21654,21657,21670,21675-21676,21679,21683,21695-21697,21703-21704,21709-21710,21713,21719,21725,21727,21733-21734,21736-21738,21741-21742,21746,21756,21766-21767,21769,21780,21796,21804,21806-21807,21809,21822,21827,21830,21834,21855,21861-21863,21880,21888,21890,21892,21897-21898,21903,21908,21912,21916-21917,21927,21943,21956-21957,21970,21980,21987,21999,22007,22024-22025,22030,22040,22047,22065-22066,22068,22070,22079,22094,22103,22114,22120-22121,22123-22124,22158,22179,22218,22228,22234-22235,22238,22240,22242,22244,22253,22256,22260,22266,22269-22270,22278,22280,22283,22296,22303,22307,22312,22320,22330,22336,22343,22346,22349,22351-22353,22359,22362-22363,22365,22367-22369,22374,22402,22404,22411,22418,22427,22432,22434,22438,22446,22467,22475,22478,22495,22521-22522,22530,22534,22549,22561,22581,22604,22609,22612,22622,22635,22659,22675,22681,22686-22687,22696,22721,22737,22763,22766-22768,22771,22774,22788,22791,22797,22799,22806,22810,22812,22815,22821,22823,22825-22827,22830,22833,22836,22840-22842,22852,22855-22857,22859,22863,22865,22868,22870-22871,22880,22882,22885,22899-22900,22905,22909,22914,22916,22919,22930,22934,22937,22949,22952,22963,22969,22971,22982,22987,22992,22995-22996,23016,23039,23041,23047,23068,23089,23094,23146,23156,23241,23376,23380,23383-23385,23395-23396,23398,23401,23408,23418,23421,23425,23427,23431-23433,23435-23436,23439,23447-23448,23450-23454,23457-23460,23467,23472,23475,23478,23481,23485-23487,23490,23492,23494-23495,23500,23504,23506-23507,23519,23521,23528,23536,23544-23548,23551,23553,23556,23558-23559,23561-23563,23567,23569,23572,23574,23576,23578,23581,23588,23601,23608,23610,23612-23614,23616,23618,23621,23624,23627,23631,23633,23637,23646,23648,23653,23663,23665,23679,23681-23682,23700,23702-23703,23706-23707,23721,23725,23736,23769,23777,23782,23789,23792,23803,23815,23822,23830,23835,23849,23853,23869,23884,23994,24005,24029-24030,24033-24034,24037-24041,24043,24046,24049-24050,24052,24065-24067,24069-24070,24072,24076,24080,24092-24093,24102-24103,24109-24110,24120,24133,24149,24178-24180,24182,24184,24187-24189,24191,24196,24198-24199,24207-24208,24211-24213,24215,24217,24220,24222-24223,24230-24231,24237,24247-24248,24265-24266,24310-24311,24314,24320,24322-24324,24330,24335,24339,24341,24343,24351-24352,24357-24358,24361,24367,24369,24377-24378,24402-24403,24405,24418,24420,24425,24432-24433,24439,24441,24443-24444,24448-24449,24452-24453,24456,24458-24459,24466,24471-24472,24481,24488,24490,24494,24503,24509,24515,24517-24518,24524-24525,24530,24535-24537,24544,24548,24551,24555,24565,24573,24575-24578,24590,24594,24597-24598,24604-24605,24608,24613,24615,24618,24623,24635,24651,24656,24658,24661,24665,24674,24680-24682,24685,24687-24688,24691,24694,24696,24700,24703,24708,24713,24717,24724,24735-24736,24739,24742,24744,24748,24751,24754,24756,24764,24773,24778-24779,24785,24789,24796,24800,24807-24809,24811,24813-24815,24819,24825,24840,24847,24853,24858,24863,24868,24871,24895,24904,24908,24910,24913,24917,24930,24935-24936,24944,24950-24951,24974,24980,25022,25026,25032,25062,25096,25102-25106,25110,25112,25114-25115,25119,25130,25134,25136,25139-25140,25143,25151-25153,25159,25163,25165-25166,25169,25171-25172,25176,25179,25187,25191,25193,25195-25200,25203,25206,25209,25214-25216,25225-25226,25233,25235,25237,25239-25240,25242-25243,25250,25252-25253,25259,25265,25269,25273,25276-25277,25285,25289,25291,25293,25298,25300,25302,25304-25305,25307-25308,25311,25314,25317-25318,25320-25321,25324,25327,25331-25332,25335,25340,25342-25343,25345-25346,25351,25353,25361,25366,25370,25377,25379,25381,25384,25386,25391,25402,25405,25413,25417,25422,25429,25438-25439,25442-25443,25454,25463,25480-25481,25484,25490,25504,25506,25509,25511-25514,25523,25527,25549,25551-25552,25554,25569,25581,25588,25605,25615,25620,25628,25630,25644-25645,25658,25670-25671,25674,25688,25703,25705,25720,25745-25746,25749,25758,25764,25773-25774,25776,25797,25805,25810,25830,25840,25856,25874,25884,25903,25910,25913,25915,25918-25919,25925,25928,25932,25935,25937,25945,25950,25954-25955,25958,25964,25968,25970,25972,25991,26007,26009,26012,26017,26021,26023,26025,26029,26031-26032,26041,26045,26049,26053,26059,26063,26071,26080,26082,26085-26089,26097,26102-26103,26106,26114,26118,26126-26127,26131,26143-26144,26149,26151-26152,26157,26159,26165,26172,26174,26179,26187,26195,26197,26202,26212,26216,26222-26224,26228,26234,26242,26247,26262-26263,26292,26329,26332,26352,26354,26356,26364,26366-26368,26376-26377,26379,26381,26391,26395,26397,26399,26408,26410-26412,26415,26421,26426,26429,26432,26434-26435,26438,26441,26446-26449,26454,26463,26465,26469,26479-26480,26494-26495,26497,26500,26512,26519,26522,26524,26538,26543,26550-26551,26564,26575-26576,26579-26580,26597,26607,26609,26612,26631,26635,26639,26641,26646-26647,26657,26679-26681,26684-26685,26690-26691,26694,26696,26723,26725,26728-26729,26753,26790,26797,26800,26816,26829,26834,26837,26840,26847,26862,26869,26893,26925,26970,27004,27010,27084,27133,27138,27169,27178,27225,27233,27424-27427,27431,27442,27450,27454,27463,27465,27468,27489-27495,27513,27515-27516,27523,27530-27531,27533,27542,27573,27578,27583,27585,27589,27595,27597,27599,27602,27604-27605,27607,27609,27611,27627,27663,27665,27667-27668,27675,27700,27704,27712-27714,27719,27721,27741,27743-27745,27748,27779,27785,27788,27792,27794,27801,27807,27809,27814,27825,27827,27833,27835-27836,27838-27839,27844,27849-27850,27861,27867,27870,27874,27877,27880,27882,27888,27891,27899,27901,27905,27915,27922,27927,27931,27934,27946,27954,27963-27964,27966,27969,27973-27974,27979,27982,27987,28009-28010,28014,28020,28023-28024,28034,28040-28041,28044,28053,28065,28067,28070,28079,28082,28107-28108,28113,28118,28120,28129,28145,28151,28153,28155,28165,28170,28174,28176,28180,28183,28192-28193,28195,28197,28201,28207,28212,28216,28218,28227,28246,28251,28286-28287,28291,28293,28304,28316,28330,28335,28346,28363,28369,28371-28372,28378,28385,28389,28392-28393,28404,28418,28422,28431,28435-28436,28448,28457,28459,28487,28504,28508,28525-28526,28558,28608,28626,28693,28748,28779,28781,28783-28784,28789,28796,28798,28809,28814,28818,28822,28843-28846,28856-28860,28865-28866,28872,28895,28900,28902-28903,28908-28909,28937,28949,28954,28961,28976,28982,29006,29028,29031,29053,29066,29071,29076,29087,29100,29123,29157,29190,29226,29228,29233,29237-29238,29245-29246,29255-29256,29260,29273,29275,29282,29287,29289,29298,29301,29305-29306,29359,29366-29367,29369,29378,29399,29401,29408-29409,29417,29420-29422,29425,29436,29454,29462,29467-29468,29473,29482,29486,29502-29503,29527,29554,29575,29579,29595,29609,29615-29616,29618,29623,29640,29645,29664,29669,29677,29699,29702,29730,29747-29748,29790-29791,29916,29926,29942,29976,29978,29983,29992,30000-30002,30005,30007,30011,30021,30028,30031,30036,30041,30044,30053,30058,30070,30072,30086,30095,30097,30103,30123,30127,30130,30140,30142,30149,30162,30165,30171,30174,30196,30239,30246,30294,30315,30331,30333-30334,30340,30342-30343,30353,30355,30382,30408,30410,30417,30420,30422-30424,30427,30431,30433,30436,30446,30452,30456,30460,30462,30465,30475,30495-30496,30504,30524,30526,30528-30529,30555,30561,30563,30572,30591,30596,30604,30606,30609-30610,30629,30631,30636,30683,30691,30693,30697,30701-30702,30707,30719,30721,30733,30740,30768,30772,30776,30784,30828,30830,30861-30862,30865,30879,30887,30896,30906,30910,30917,30952,30977,31034,31036,31038,31040,31048,31062-31063,31069-31070,31074,31077,31080,31085,31095-31096,31104-31105,31109,31119,31163,31165,31168-31169,31171,31177,31179,31181,31185-31186,31192,31199,31209,31215-31216,31227,31229,31232,31243,31245-31246,31283,31291-31292,31302,31348,31350-31351,31354,31359,31361,31363-31364,31378,31382-31384,31388-31389,31391,31435,31446,31449,31454-31456,31461,31469,31471,31487,31494,31505,31508,31526,31528,31532,31548,31561,31563,31569,31572,31574,31609,31614,31616,31639,31649,31661,31665,31687,31709,31735,31751,31821,31859,31867,31881,31890,31895-31896,31914,31918,31934,31946,31957,31961,31967,31995,32032,32034,32039,32043,32047,32066,32147,32244,32321,32416,32418,32422-32423,32426,32431,32434-32435,32437,32439,32441-32442,32445,32447,32451-32456,32461,32463,32465,32467,32469,32472-32473,32476-32479,32487,32489-32490,32493,32496,32499-32501,32508,32511-32512,32516,32531-32532,32534,32536,32538,32541,32544,32553,32564,32566,32570,32593,32597,32599,32602,32610,32617-32618,32622,32626,32631,32650,32654,32660,32670,32673,32676,32709,32724,32728,32763-32764,32768-32769,32771,32773,32780-32781,32784,32791,32793,32819,32822,32824,32827,32829,32842-32844,32852,32856,32858,32874,32899,32902,32905,32907-32908,32918,32928-32930,32932-32933,32937,32942-32943,32946,32960-32961,32963,32966,32972,32982,32988,32990,32993,33016,33021,33030,33033,33039,33041,33050,33073,33080,33098,33104,33108-33109,33125,33136,33150-33152,33179,33192,33218,33222,33247,33251,33258,33261,33267-33268,33285,33287,33292-33293,33298,33310,33322,33324,33328,33337,33351,33368,33391-33392,33394-33395,33402,33406,33410,33436,33452,33454-33455,33457,33469,33485,33487,33492,33509-33510,33521,33538-33539,33541,33545,33564,33579,33590,33606,33609,33616,33618,33633,33635-33636,33647,33655,33673,33678,33707,33713,33719,33725,33735,33740,33756,33778,33796,33804,33829,33832,33853,33879,33889,33900,33914,33922,33945,33988,34013,34028,34067,34109,34164,34180,34249,34255,34276,34321,34382-34385,34388,34394,34402,34411,34417,34429,34432-34434,34451,34468,34479,34490,34502-34503,34507,34523,34526,34532,34542,34583-34584,34593,34597,34612,34638,34649,34656,34701,34746,34758,34770,34837,34850,34880,34885,34892,34900,34903,34913,34915,34917,34920,34928,34935,34955,34957,34966,34987,34989,35009-35010,35013,35028-35029,35064-35065,35199,35201,35206,35265-35266,35268-35270,35273-35274,35278,35282,35299,35302,35328,35449,35465,35475,35498,35504,35584,35686,35695,35745-35746,35748,35752-35753,35757-35760,35762-35763,35766-35768,35770,35773-35775,35777,35780-35782,35784-35785,35789,35793,35797,35799,35802-35803,35805-35806,35809,35813-35815,35821,35823,35825,35828-35832,35834-35835,35838,35841,35843,35845,35848,35850-35851,35853-35854,35859-35860,35867-35868,35874-35875,35878,35880,35884-35885,35889,35892,35895,35912,35937,35946-35947,35980,36000,36125,36127,36129-36136,36138-36143,36145,36148-36149,36152-36156,36158-36159,36162-36164,36171-36172,36174-36176,36180,36182,36187,36190,36194,36198,36203,36208,36212,36214-36215,36229,36234-36235,36255,36259,36275,36291,36299,36305,36314,36317,36319,36328,36330,36335,36339,36341,36367,36382,36386,36393-36394,36405,36418,36420,36424,36434,36481,36495,36523,36527,36530,36538,36557,36710,36712,36716,36718-36720,36724,36731,36733,36739,36741-36742,36744-36745,36753,36755,36764,36766-36767,36776-36777,36784-36785,36793,36798,36801-36802,36805,36807-36808,36814,36816-36817,36820,36824-36825,36827-36831,36838,36842-36843,36848,36855,36857,36861,36864-36867,36870,36873-36874,36879-36880,36882,36884,36887,36890,36893,36895-36896,36898-36899,36910,36920,36923-36924,36926,36930,36935,36941-36942,36944,36947-36948,36951,36963,36965,36968,36973-36974,36981,36991-36992,36995-36996,37011,37027,37030,37034,37051,37057,37066,37073,37089,37096,37117,37145,37195,37197,37202,37213,37228,37239-37240,37247,37257,37266,37319,37322,37324-37327,37329,37555,38024-38025,38045,38047,38050,38053,38062,38065,38067,38072,38075,38081,38096,38112,38125,38130,38134,38136,38138,38142,38144-38145,38149,38152,38155,38160,38169,38177-38178,38180,38182,38190-38191,38203,38215,38220,38230,38236,38243,38262,38271,38275,38376,38378,38381-38383,38386,38388,38391,38393,38395,38400-38401,38405,38417,38420,38431,38449-38454,38459,38463,38468-38470,38472,38475-38477,38480,38491,38497-38498,38500,38505-38506,38512,38517-38519,38534,38543-38544,38548,38552-38553,38556,38567,38582,38590,38592,38596-38599,38613,38626,38632,38634,38646-38647,38654,38656,38662-38663,38665,38669,38684,38706,38712,38738,38745,38750,38752,38754,38774,38829,38886-38887,38889,38899,38914,38936,39029-39030,39033-39035,39037-39039,39042,39044-39046,39048,39050,39057,39062-39064,39066,39068-39069,39072,39076,39118,39123,39128,39131,39134-39135,39184,39269,39277-39278,39280-39281,39285-39286,39295,39297,39302,39304,39318,39532-39533,39535,39537,39542,39547-39548,39550-39551,39554,39556,39564,39569,39575,39578,39584,39592,39607-39608,39621,39635,39640,39740,39745-39746,39749,39751,39759,39764,40060,40063,40065,40092,40104,40158,40479,40481,40483,40486,40511,40555,40560,40594-40595,40614,40635,40637-40638,40644,40654-40655,40657,40664,40670,40687,40723,40736,40763,40784,40831,40836,40842,40844,40857,65281,65288-65289,65292-65293,65304,65306-65307,65311" - [/font] -#endif [/fonts] diff -Naru wesnoth-1.9.6-org/data/sdlskk/sdlskk.cfg wesnoth-1.9.6/data/sdlskk/sdlskk.cfg --- wesnoth-1.9.6-org/data/sdlskk/sdlskk.cfg 1970-01-01 09:00:00.000000000 +0900 +++ wesnoth-1.9.6/data/sdlskk/sdlskk.cfg 2011-05-14 19:57:35.548720570 +0900 @@ -0,0 +1,20 @@ +#textdomain wesnoth + +[sdlskk] + font="msgothic.ttc" + family="MS UI Gothic" +# font="meiryo.ttc" +# family="Meiryo UI" + + forecolor_r=1 + forecolor_g=1 + forecolor_b=1 + backcolor_r=64 + backcolor_g=224 + backcolor_b=208 + + rule_table="rule_table" + + user_dic="user-skkdic" + dic_order="wesnoth-skkdic,SKK-JISYO.L.unannotated" +[/sdlskk] diff -Naru wesnoth-1.9.6-org/data/sdlskk/wesnoth-skkdic wesnoth-1.9.6/data/sdlskk/wesnoth-skkdic --- wesnoth-1.9.6-org/data/sdlskk/wesnoth-skkdic 1970-01-01 09:00:00.000000000 +0900 +++ wesnoth-1.9.6/data/sdlskk/wesnoth-skkdic 2011-05-14 19:57:35.552720269 +0900 @@ -0,0 +1,3 @@ +えるふ /エルフ/ +httt /王位継承者/ +low /Wesmereの伝説/ diff -Naru wesnoth-1.9.6-org/doc/manual/manual.ja.sdlskk.html wesnoth-1.9.6/doc/manual/manual.ja.sdlskk.html --- wesnoth-1.9.6-org/doc/manual/manual.ja.sdlskk.html 1970-01-01 09:00:00.000000000 +0900 +++ wesnoth-1.9.6/doc/manual/manual.ja.sdlskk.html 2011-05-14 20:09:16.461279000 +0900 @@ -0,0 +1,136 @@ + + + + + +Battle for Wesnoth 日本語版ガイド + + +
+

Battle for Wesnoth 日本語版ガイド


+ +
+

概要

+

Battle for Wesnoth の国際化対応のレベルは非常に高いものですが、それでも日本人がプレイする上で不都合な点はいくつか存在します。
+この日本語版は、いずれ本家がまっとうな方法で対応してくれるまでのつなぎとして、日本人が Battle for Wesnoth をよりプレイしやすいよう若干の改良を加えたものです。

+ +

http://sourceforge.jp/projects/wesnoth-ja/ にて公開されています。

+ +

以下にこの日本語版 (wesnoth-1.9.6-sdlskk-20110514) の特徴について順に述べます。
+なお以前の日本語版 (wesnoth-1.9.2-sdlskk-20101107) を利用されていた方への新しいトピックはありません。単にベースを 1.9.2 から 1.9.6 に更新しただけのものです。

+
+ +
+

1. SDLSKK 対応

+

Battle for Wesnoth の Windows 版は、IME による日本語入力ができません。これは主に現バージョンの SDL の制限によるものです。マルチプレイ時のチャットがローマ字でしか行えないというのはかなりストレスのたまるものでした。

+

この問題を解消するため、SDLSKK ライブラリを組み込みました。IME による直接入力ではないものの、SKK に準じた操作で日本語入力が行えます。

+ +
+

操作方法

+

SKK に準じますので、詳しくは専門の Web ページを参照してください。憶えておくと便利なキーを以下にまとめます。

+
+
SHIFT+SPACE
+SDLSKK による入力の開始・終了を切り替えます。これだけ憶えておけば、最低限ひらがな入力だけはできます。 +
+
SPACE
+変換入力中であれば漢字変換を行います。すでに漢字変換中であれば次の候補を表示します。もし変換候補が出尽くした場合は単語登録モードになります。単語登録モードをキャンセルするときは単に Enter を押せば OK です。 +
+
x
+漢字変換中であれば前の候補を表示します。SPACE を押しすぎて候補を通り過ぎたときに使います。日本語キーボードであれば [変換] キーでも同様の動作をする、かも。 +
+
q
+カタカナとひらがなの入力切り替えを行います。変換入力中であればカタカナ変換を行います。日本語キーボードであれば [無変換] キーでも同様の動作をする、かも。
+なお単語登録モードをまっとうに活かすため、wesnoth-1.8.4-sdlskk-20100915 の Enter による自動 q 機能は廃止されました。 +
+
l (小文字のエル)
+日本語モードから半角英数入力モードに移ります。日本語キーボードであれば [ローマ字] キー (ALT+[カタカナひらがな]) でも同様の動作をする、かも。 +
+
CTRL+j
+日本語モードに移ります。日本語キーボードであれば [ローマ字] キー (ALT+[カタカナひらがな]) でも同様の動作をする、かも。 +
+
/ (スラッシュ)
+英単語変換入力を行います。/elf[SPACE] で「エルフ」と入力できるので、qeruhu とか Eruhuq とかより場合によってはスマートに入力できます。 +
+
+

SKK の最も特徴的な点として、変換したい箇所の開始と終了を大文字で入力する必要がある、ということが挙げられます。たとえば「エルフのシェードたん萌え」と入力したいなら、Eruhu[SPACE]noShe-doqtanMoE[SPACE] と入力します。「誰か助けて、もうソース読みたくない」なら DareKaTasuKete,mouSo-suqYoMitakunai と入力します。

+
+ +
+

設定ファイル

+

data/sdlskk/sdlskk.cfg には以下のエントリがあります。

+
+
font および family
+表示に使用するフォントファイル名とフォントファミリ名を指定します。フォントは Wesnoth の Fonts ディレクトリに置いておくか、またはシステムにインストールされている必要があります。デフォルトでは MS UI ゴシック を使用します。 +
+
forecolor_r/g/b および backcolor_r/g/b
+表示に使用する前景色と背景色を指定します。デフォルトでは昔懐かしい DOS の FEP を彷彿とさせるどぎつい水色反転になっています。 +
+
rule_table
+ローマ字入力規則などの設定ファイル名を指定します。「ヘボン式や訓令式なんてくだらねぇぜ、ローマ字だってオレ流を通す!」みたいな方は自由に変更してください。 +
+
user_dic
+ユーザ辞書ファイル名を指定します。ユーザ辞書はユーザデータディレクトリの下 (Documents\My Games\Wesnoth1.8\data\sdlskk 等) に出力されます。
+ちなみにこの設定ファイル自体や辞書などもユーザデータディレクトリの下に置くことができます。 +
+
dic_order
+辞書ファイル名をカンマ区切りで指定します。annotation のない UTF-8 変換済みの SKK 用辞書を指定できます。前に書いたほうが変換候補として優先されます (ユーザ辞書はこれらよりさらに優先されます) 。デフォルトで SKK-JISYO.L とともに指定されている wesnoth-skkdic はまだサンプルレベルの内容です。日本語への翻訳で登場した単語なんかをここにまとめておけば入力が楽になるだろうなぁ、みたいな妄想と淡い期待が込められています。 +
+
+

もし「他の機能はいいけどこの SDLSKK 機能だけウザい、氏ねばいいのに」とか心ない言葉が胸をよぎる場合はこの設定ファイル自体を削除すれば SDLSKK 機能は働かなくなります。GanbaTteKuMiKoNdanonil...

+
+ +
+ +
+

2. フォントまわりの改善

+ +
+

ふつーな感じの日本語化済み

+

プログラム本体がせっかくほぼ完璧な日本語表示能力を持っているのに、公式パッケージからなぜか日本語フォントが外され、さらに wqy-zenhei.ttc が追加されたために、インストール直後の起動画面はとても残念なものになってしまっています。

+

MS UI ゴシックを表示するよう設定した fonts.cfg が最初からインストールされるようにしたので、誰でもインストール直後からふつーな感じでプレイできます。

+
+ +
+

システムフォントの参照

+

Wesnoth で使用するフォントは基本的に fonts ディレクトリに置かれていなければなりませんでした。data\hardwired\fonts.cfg を変更しただけでは MS UI ゴシックを表示することはできず、fonts ディレクトリにフォントファイルをコピー (ないしリンク) する必要がありました。

+

Windows\Fonts ディレクトリをまず検索するようにしたので、システムにインストール済みのフォントであればわざわざコピーしたりしなくても、data\hardwired\fonts.cfg に記述して使用できます。

+
+ +
+

フォントファミリの反映

+

これまで、ボタンなどに使用されている gui 名前空間のウィジェットにはフォントファミリの設定が反映されていませんでしたが、ちょこっと手を加えてみました。

+
+ +
+ +
+

3. 曜日表示の修正

+

データロードダイアログで曜日が化ける日本語 Windows 特有の問題を修正しました。(wesnoth-1.8.4-sdlskk-20100915 で行われた修正のままです)

+
+ +
+

4. アンインストールの修正

+

アンインストールの際、ディレクトリが正しく削除されない問題を修正してみました。

+
+ +
+

5. MinGW クロスビルド環境への移行

+

日本語化とは直接関係しませんが、いろいろと重要なことです。

+ +
+

公式サーバへの接続性改善

+

wesnoth-1.8.4-sdlskk-20100915 には公式サーバのうち server2 にしかうまくつながらない問題がありました。同様に VC++ で 1.9.0 をビルドすると server2 にだけうまくつながらないという問題が発生します。VC++ ランタイムと Wesnoth が用いるプロトコルとネットワークライブラリの整合性に齟齬があり、公式サーバと相性問題が起きていたと考えられます。

+

MinGW によるクロスビルド環境に移行することで、この相性問題は解消されました。

+
+ +
+

ビルド環境仮想マシンの公開

+

wesnoth-1.8.5-sdlskk-20101019 パッケージの作成に使用した Ubuntu 10.10 日本語 Remix 環境の VMware 仮想マシンが公開済みです。
+本配布パッケージもその環境を Ubuntu 11.04 へアップグレードしたものを使って作成されました。

+

各 OS 用に無償で配布されている VMware Player を使って動作させることができますので、これで誰でも手軽にパッケージを更新して配布してくれちゃうことが可能になります。

+
+ +
+ +
+ diff -Naru wesnoth-1.9.6-org/packaging/windows/SConscript wesnoth-1.9.6/packaging/windows/SConscript --- wesnoth-1.9.6-org/packaging/windows/SConscript 2011-01-03 07:06:20.000000000 +0900 +++ wesnoth-1.9.6/packaging/windows/SConscript 2011-05-14 20:05:24.343655000 +0900 @@ -1,9 +1,20 @@ # vi: syntax=python:et:ts=4 from os.path import join +from os import environ from glob import glob import SCons.Node Import("env") +import re, sys +config_h_re = re.compile(r"^.*#define\s*(\S*)\s*\"(\S*)\".*$", re.MULTILINE) +build_config = dict( config_h_re.findall(File("../../src/wesconfig.h").get_contents()) ) + +try: + version = build_config["VERSION"] +except KeyError: + print "Couldn't determin the Wesnoth version number, bailing out!" + sys.exit(1) + binaries = ["wesnoth"] for bin in binaries: #icon = env.Command(bin + "-icon.ico", join("../../icons", bin + "-icon.png"), "$IM_CONVERT $SOURCE $TARGET") @@ -15,6 +26,9 @@ res = [] env[bin + "_res"] = res +def hege(flags): + env["wesnoth_res"] = [env.RES("wesnoth.rc", CPPPATH=[], CPPFLAGS=flags)] + def WindowsInstaller(env, files): files = map(Entry, Flatten(files)) env["NSIS_INSTALL_FILES"] = "" @@ -36,6 +50,9 @@ env["NSIS_UNINSTALL_FILES"] += "Delete $INSTDIR\\" + file.name + "\n " env.ScanReplace("#/Wesnoth.nsi", "#/packaging/windows/Wesnoth.nsi.in") - env.Alias("windows-installer", [files, "#/Wesnoth.nsi"], "makensis ${SOURCES[-1]}") + env["patch"] = "SDLSKK" + env["reldate"] = "20110514" + + env.Alias("windows-installer", [files, "#/Wesnoth.nsi"], environ["HOME"] + "/.wine/drive_c/Program\ Files/NSIS/makensis.exe ${SOURCES[-1]}") env.AddMethod(WindowsInstaller) diff -Naru wesnoth-1.9.6-org/packaging/windows/Wesnoth.nsi.in wesnoth-1.9.6/packaging/windows/Wesnoth.nsi.in --- wesnoth-1.9.6-org/packaging/windows/Wesnoth.nsi.in 2011-01-03 07:06:20.000000000 +0900 +++ wesnoth-1.9.6/packaging/windows/Wesnoth.nsi.in 2011-05-14 19:57:35.552720269 +0900 @@ -3,11 +3,11 @@ !define MULTIUSER_EXECUTIONLEVEL Highest !define MULTIUSER_MUI !define MULTIUSER_INSTALLMODE_COMMANDLINE - !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "Software\Battle for Wesnoth\%version" + !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "Software\Battle for Wesnoth\%version %patch %reldate" !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "" - !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\Battle for Wesnoth\%version" + !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\Battle for Wesnoth\%version %patch %reldate" !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "" - !define MULTIUSER_INSTALLMODE_INSTDIR "Battle for Wesnoth %version" + !define MULTIUSER_INSTALLMODE_INSTDIR "Battle for Wesnoth %version %patch %reldate" !include "MultiUser.nsh" !include "MUI2.nsh" !include "nsDialogs.nsh" @@ -18,7 +18,7 @@ ;Name and file Name "Battle for Wesnoth" - OutFile "wesnoth-%version-win32.exe" + OutFile "wesnoth-%version-win32-%patch-%reldate.exe" ;-------------------------------- ;Variables @@ -46,7 +46,7 @@ ;Remember the installer language !define MUI_LANGDLL_REGISTRY_ROOT "SHCTX" - !define MUI_LANGDLL_REGISTRY_KEY "Software\Battle for Wesnoth\%version" + !define MUI_LANGDLL_REGISTRY_KEY "Software\Battle for Wesnoth\%version %patch %reldate" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" ;-------------------------------- @@ -60,9 +60,9 @@ ;Start Menu Folder Page Configuration !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" - !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Battle for Wesnoth\%version" + !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Battle for Wesnoth\%version %patch %reldate" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" - !define MUI_STARTMENUPAGE_DEFAULTFOLDER "Battle for Wesnoth %version" + !define MUI_STARTMENUPAGE_DEFAULTFOLDER "Battle for Wesnoth %version %patch %reldate" !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder @@ -166,20 +166,20 @@ SetOutPath "$INSTDIR" ;Store installation folder - WriteRegStr SHCTX "Software\Battle for Wesnoth\%version" "" $INSTDIR + WriteRegStr SHCTX "Software\Battle for Wesnoth\%version %patch %reldate" "" $INSTDIR ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" ;Add uninstall information - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version" "DisplayName" "Battle for Wesnoth %version" - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version" "DisplayIcon" "$\"$INSTDIR\wesnoth.exe$\"" - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S" - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version" "URLInfoAbout" "www.wesnoth.org" - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version" "DisplayVersion" "%version" - WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version" "NoModify" 1 - WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version" "NoRepair" 1 + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version %patch %reldate" "DisplayName" "Battle for Wesnoth %version %patch %reldate" + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version %patch %reldate" "DisplayIcon" "$\"$INSTDIR\wesnoth.exe$\"" + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version %patch %reldate" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version %patch %reldate" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S" + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version %patch %reldate" "URLInfoAbout" "www.wesnoth.org" + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version %patch %reldate" "DisplayVersion" "%version %patch %reldate" + WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version %patch %reldate" "NoModify" 1 + WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version %patch %reldate" "NoRepair" 1 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application @@ -198,6 +198,7 @@ CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Changelog.lnk" "$INSTDIR\changelog.txt" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Player's changelog.lnk" "$INSTDIR\players_changelog.txt" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\License.lnk" "$INSTDIR\COPYING.txt" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\{ŃKCh.lnk" "$INSTDIR\manual\manual.ja.sdlskk.html" !insertmacro MUI_STARTMENU_WRITE_END @@ -264,12 +265,16 @@ Delete "$INSTDIR\wesnoth_editor-icon.ico" RMDir /r "$INSTDIR\manual" + Delete "$INSTDIR\stdout.txt" + Delete "$INSTDIR\stderr.txt" + Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR" !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder + Delete "$SMPROGRAMS\$StartMenuFolder\{ŃKCh.lnk" Delete "$SMPROGRAMS\$StartMenuFolder\License.lnk" Delete "$SMPROGRAMS\$StartMenuFolder\Player's changelog.lnk" Delete "$SMPROGRAMS\$StartMenuFolder\Changelog.lnk" @@ -280,8 +285,8 @@ Delete "$SMPROGRAMS\$StartMenuFolder\Battle for Wesnoth.lnk" RMDir "$SMPROGRAMS\$StartMenuFolder" - DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version" - DeleteRegKey /ifempty SHCTX "Software\Battle for Wesnoth\%version" + DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Battle for Wesnoth %version %patch %reldate" + DeleteRegKey /ifempty SHCTX "Software\Battle for Wesnoth\%version %patch %reldate" DeleteRegKey /ifempty SHCTX "Software\Battle for Wesnoth" SectionEnd diff -Naru wesnoth-1.9.6-org/packaging/windows/wesnoth.rc wesnoth-1.9.6/packaging/windows/wesnoth.rc --- wesnoth-1.9.6-org/packaging/windows/wesnoth.rc 2011-01-03 07:06:20.000000000 +0900 +++ wesnoth-1.9.6/packaging/windows/wesnoth.rc 2011-05-14 20:05:36.542316000 +0900 @@ -1,2 +1,41 @@ WESNOTH_ICON ICON DISCARDABLE "wesnoth-icon.ico" +#include +#include + +#define _STRDEF(s) # s +#define STRDEF(s) _STRDEF(s) +#define VALDEF(s) s + +#define VERSION_CSV 1,9,6 +#define RELEASE 5963 +#define VERSION_STR "1.9.6" +#define RELEASE_STR STRDEF(RELEASE) +#define RELDATE_STR "20110514" + +VS_VERSION_INFO VERSIONINFO +FILEVERSION VERSION_CSV, RELEASE +PRODUCTVERSION VERSION_CSV, 0 +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEOS VOS__WINDOWS32 +FILETYPE VFT_APP +{ + BLOCK "StringFileInfo" + { + BLOCK "041103A4" + { + VALUE "CompanyName", "Developed under the GNU General Public License" "\000" + VALUE "FileDescription", "The Battle for Wesnoth with SDLSKK " RELDATE_STR "\000" + VALUE "FileVersion", VERSION_STR "." RELEASE_STR "\000" + VALUE "InternalName", "wesnoth\000" + VALUE "LegalCopyright", "Designed by David White and first released in June 2003" "\000" + VALUE "OriginalFilename", "wesnoth.exe" "\000" + VALUE "ProductName", "Battle for Wesnoth" "\000" + VALUE "ProductVersion", VERSION_STR "\000" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 1041, 932 + } +} diff -Naru wesnoth-1.9.6-org/src/CMakeLists.txt wesnoth-1.9.6/src/CMakeLists.txt --- wesnoth-1.9.6-org/src/CMakeLists.txt 2011-04-25 16:19:34.000000000 +0900 +++ wesnoth-1.9.6/src/CMakeLists.txt 2011-05-14 23:41:51.209566000 +0900 @@ -20,6 +20,7 @@ include_directories( ${GETTEXT_INCLUDE_DIR} ) include_directories( ${LIBDBUS_INCLUDE_DIRS} ) include_directories( ${LIBINTL_INCLUDE_DIR} ) +include_directories( ${SDLSKK_INCLUDE_DIR} ) #optional dependencies if(SDLIMAGE_INCLUDE_DIR) @@ -83,6 +84,7 @@ ${FONTCONFIG_LIBRARIES} ${LIBDBUS_LIBRARIES} ${LIBINTL_LIBRARIES} + ${SDLSKK_LIBRARIES} ) if(MSVC) @@ -633,6 +635,7 @@ widgets/textbox.cpp widgets/widget.cpp wml_exception.cpp + sdlskk.cpp ) if(ENABLE_GAME AND ENABLE_TESTS) @@ -659,6 +662,7 @@ if(ENABLE_TESTS) set(wesnoth_SRC game.cpp + ../packaging/windows/wesnoth.rc ) set(wesnoth_LIB wesnoth-game @@ -667,6 +671,7 @@ set(wesnoth_SRC game.cpp ${wesnoth-main_SRC} + ../packaging/windows/wesnoth.rc ) set(wesnoth_LIB wesnoth-core diff -Naru wesnoth-1.9.6-org/src/SConscript wesnoth-1.9.6/src/SConscript --- wesnoth-1.9.6-org/src/SConscript 2011-04-25 16:19:34.000000000 +0900 +++ wesnoth-1.9.6/src/SConscript 2011-05-14 23:21:20.895161000 +0900 @@ -122,6 +122,7 @@ widgets/textbox.cpp widgets/widget.cpp wml_exception.cpp + sdlskk.cpp """) libwesnoth_sources.extend([ client_env.Object("font.cpp", EXTRA_DEFINE = client_env['fribidi'] and "HAVE_FRIBIDI" or None), diff -Naru wesnoth-1.9.6-org/src/construct_dialog.cpp wesnoth-1.9.6/src/construct_dialog.cpp --- wesnoth-1.9.6-org/src/construct_dialog.cpp 2011-02-13 01:20:24.000000000 +0900 +++ wesnoth-1.9.6/src/construct_dialog.cpp 2011-05-14 19:57:35.556719978 +0900 @@ -687,6 +687,7 @@ if((((!info.key_down && (info.key[SDLK_RETURN] || info.key[SDLK_KP_ENTER])) || info.double_clicked) && (type_ == YES_NO || type_ == OK_CANCEL || type_ == OK_ONLY || type_ == CLOSE_ONLY))) { + if (!use_text_input || !(info.key[SDLK_RETURN] || info.key[SDLK_KP_ENTER]) || (text_widget_->skk.is_empty() && !text_widget_->skk.just_decided())) return (use_menu ? menu_->selection() : 0); } diff -Naru wesnoth-1.9.6-org/src/dialogs.cpp wesnoth-1.9.6/src/dialogs.cpp --- wesnoth-1.9.6-org/src/dialogs.cpp 2011-03-13 16:49:21.000000000 +0900 +++ wesnoth-1.9.6/src/dialogs.cpp 2011-05-14 19:57:35.556719978 +0900 @@ -446,7 +446,19 @@ const savegame::save_info& save = (*info_)[index_]; tm* tm_l = localtime(&save.time_modified); if (tm_l) { +#ifdef _WIN32 + const char* wd[] = { + "%Y\xe5\xb9\xb4%m\xe6\x9c\x88%d\xe6\x97\xa5(\xe6\x97\xa5) %H:%M", + "%Y\xe5\xb9\xb4%m\xe6\x9c\x88%d\xe6\x97\xa5(\xe6\x9c\x88) %H:%M", + "%Y\xe5\xb9\xb4%m\xe6\x9c\x88%d\xe6\x97\xa5(\xe7\x81\xab) %H:%M", + "%Y\xe5\xb9\xb4%m\xe6\x9c\x88%d\xe6\x97\xa5(\xe6\xb0\xb4) %H:%M", + "%Y\xe5\xb9\xb4%m\xe6\x9c\x88%d\xe6\x97\xa5(\xe6\x9c\xa8) %H:%M", + "%Y\xe5\xb9\xb4%m\xe6\x9c\x88%d\xe6\x97\xa5(\xe9\x87\x91) %H:%M", + "%Y\xe5\xb9\xb4%m\xe6\x9c\x88%d\xe6\x97\xa5(\xe5\x9c\x9f) %H:%M"}; + const size_t res = strftime(time_buf, sizeof(time_buf), wd[tm_l->tm_wday], tm_l); +#else const size_t res = strftime(time_buf,sizeof(time_buf),_("%a %b %d %H:%M %Y"),tm_l); +#endif if(res == 0) { time_buf[0] = 0; } @@ -538,7 +550,22 @@ format_string = _("%H:%M"); } else if(days_apart > 0 && days_apart <= current_time.tm_wday) { // save is from this week - format_string = _("%A, %H:%M"); +#ifdef _WIN32 + const char* wd[] = { + "\xe6\x97\xa5\xe6\x9b\x9c\xe6\x97\xa5, %H:%M", + "\xe6\x9c\x88\xe6\x9b\x9c\xe6\x97\xa5, %H:%M", + "\xe7\x81\xab\xe6\x9b\x9c\xe6\x97\xa5, %H:%M", + "\xe6\xb0\xb4\xe6\x9b\x9c\xe6\x97\xa5, %H:%M", + "\xe6\x9c\xa8\xe6\x9b\x9c\xe6\x97\xa5, %H:%M", + "\xe9\x87\x91\xe6\x9b\x9c\xe6\x97\xa5, %H:%M", + "\xe5\x9c\x9f\xe6\x9b\x9c\xe6\x97\xa5, %H:%M"}; + char buf[40]; + if (strftime(buf, sizeof(buf), wd[save_time.tm_wday], &save_time) == 0) + buf[0] = 0; + return buf; +#else + /format_string = _("%A, %H:%M"); +#endif } else { // save is from current year format_string = _("%b %d"); diff -Naru wesnoth-1.9.6-org/src/filesystem.cpp wesnoth-1.9.6/src/filesystem.cpp --- wesnoth-1.9.6-org/src/filesystem.cpp 2011-01-02 00:57:50.000000000 +0900 +++ wesnoth-1.9.6/src/filesystem.cpp 2011-05-14 19:57:35.560719717 +0900 @@ -480,9 +480,9 @@ //allow absolute path override game_config::preferences_dir = path; } else { - BOOL (*SHGetSpecialFolderPath)(HWND, LPTSTR, int, BOOL); + BOOL (__stdcall *SHGetSpecialFolderPath)(HWND, LPTSTR, int, BOOL); HMODULE module = LoadLibrary("shell32"); - SHGetSpecialFolderPath = (BOOL (*)(HWND, LPTSTR, int, BOOL))GetProcAddress(module, "SHGetSpecialFolderPathA"); + SHGetSpecialFolderPath = (BOOL (__stdcall *)(HWND, LPTSTR, int, BOOL))GetProcAddress(module, "SHGetSpecialFolderPathA"); if(SHGetSpecialFolderPath) { LOG_FS << "Using SHGetSpecialFolderPath to find My Documents\n"; char my_documents_path[MAX_PATH]; diff -Naru wesnoth-1.9.6-org/src/font.cpp wesnoth-1.9.6/src/font.cpp --- wesnoth-1.9.6-org/src/font.cpp 2011-02-28 00:19:50.000000000 +0900 +++ wesnoth-1.9.6/src/font.cpp 2011-05-14 19:57:35.564719486 +0900 @@ -57,6 +57,11 @@ #include #endif +#ifdef _WIN32 +#include +static std::string fonts_path; +#endif + // Signed int. Negative values mean "no subset". typedef int subset_id; @@ -199,7 +204,7 @@ return chunks; } -static TTF_Font* open_font(const std::string& fname, int size) +static TTF_Font* open_font(const std::string& fname, int size, int index = 0) { std::string name; if(!game_config::path.empty()) { @@ -209,8 +214,17 @@ if(!file_exists(name)) { name = fname; if(!file_exists(name)) { +#ifdef _WIN32 + if (!fonts_path.empty()) { + name = fonts_path + "/" + fname; + if (!file_exists(name)) { +#endif /*_WIN32*/ ERR_FT << "Failed opening font: '" << name << "': No such file or directory\n"; return NULL; +#ifdef _WIN32 + } + } +#endif /*_WIN32*/ } } } @@ -219,14 +233,23 @@ name = "fonts/" + fname; if(!file_exists(name)) { if(!file_exists(fname)) { +#ifdef _WIN32 + if (!fonts_path.empty()) { + name = fonts_path + "/" + fname; + if (!file_exists(name)) { +#endif /*_WIN32*/ ERR_FT << "Failed opening font: '" << name << "': No such file or directory\n"; return NULL; +#ifdef _WIN32 + } + } +#endif /*_WIN32*/ } name = fname; } } - TTF_Font* font = TTF_OpenFont(name.c_str(),size); + TTF_Font* font = TTF_OpenFontIndex(name.c_str(), size, index); if(font == NULL) { ERR_FT << "Failed opening font: TTF_OpenFont: " << TTF_GetError() << "\n"; return NULL; @@ -249,6 +272,24 @@ if(font == NULL) return NULL; + const std::vector families = utils::split(font::get_font_families()); + bool match = false; + for (int familyindex = 0;;) { + char* familyname = TTF_FontFaceFamilyName(font); + for (std::vector::const_iterator family = families.begin(); family != families.end(); ++family) { + match = (strcmpi(familyname, (*family).c_str()) == 0); + if (match) break; + } + if (match) break; + + TTF_CloseFont(font); + font = open_font(font_names[id.subset], id.size, ++familyindex); + if (!font) { + font = open_font(font_names[id.subset], id.size); + break; + } + } + TTF_SetFontStyle(font,TTF_STYLE_NORMAL); LOG_FT << "Inserting font...\n"; @@ -409,16 +450,28 @@ if(!file_exists(game_config::path + "/fonts/" + itor->name)) { if(!file_exists("fonts/" + itor->name)) { if(!file_exists(itor->name)) { +#ifdef _WIN32 + if (fonts_path.empty() || !file_exists(fonts_path + "/" + itor->name)) { +#endif /*_WIN32*/ WRN_FT << "Failed opening font file '" << itor->name << "': No such file or directory\n"; continue; +#ifdef _WIN32 + } +#endif /*_WIN32*/ } } } } else { if(!file_exists("fonts/" + itor->name)) { if(!file_exists(itor->name)) { +#ifdef _WIN32 + if (fonts_path.empty() || !file_exists(fonts_path + "/" + itor->name)) { +#endif /*_WIN32*/ WRN_FT << "Failed opening font file '" << itor->name << "': No such file or directory\n"; continue; +#ifdef _WIN32 + } +#endif /*_WIN32*/ } } } @@ -1260,6 +1313,28 @@ if (!fonts_config) return false; +#ifdef _WIN32 + fonts_path = ""; + { + BOOL (__stdcall *SHGetSpecialFolderPath)(HWND, LPTSTR, int, BOOL); + HMODULE module = LoadLibrary("shell32"); + SHGetSpecialFolderPath = (BOOL (__stdcall *)(HWND, LPTSTR, int, BOOL))GetProcAddress(module, "SHGetSpecialFolderPathA"); + if (SHGetSpecialFolderPath) { + LOG_FT << "Using SHGetSpecialFolderPath to find Fonts\n"; + char buf[MAX_PATH]; + if (SHGetSpecialFolderPath(NULL, buf, 0x0014, 0)) { + fonts_path = std::string(buf); + boost::algorithm::replace_all(fonts_path, std::string("\\"), std::string("/")); + } else { + WRN_FT << "SHGetSpecialFolderPath failed\n"; + } + } else { + LOG_FT << "Failed to load SHGetSpecialFolderPath function\n"; + } + FreeLibrary(module); + } +#endif /*_WIN32*/ + std::set known_fonts; foreach (const config &font, fonts_config.child_range("font")) { known_fonts.insert(font["name"]); @@ -1299,5 +1374,9 @@ } } +TTF_Font* open_font_index(const std::string& fname, int size, int index) +{ + return open_font(fname, size, index); +} } diff -Naru wesnoth-1.9.6-org/src/font.hpp wesnoth-1.9.6/src/font.hpp --- wesnoth-1.9.6-org/src/font.hpp 2011-02-13 01:20:24.000000000 +0900 +++ wesnoth-1.9.6/src/font.hpp 2011-05-14 19:57:35.564719486 +0900 @@ -213,6 +213,8 @@ enum CACHE { CACHE_LOBBY, CACHE_GAME }; void cache_mode(CACHE mode); +TTF_Font* open_font_index(const std::string& fname, int size, int index); + } #endif diff -Naru wesnoth-1.9.6-org/src/game.cpp wesnoth-1.9.6/src/game.cpp --- wesnoth-1.9.6-org/src/game.cpp 2011-04-17 16:49:10.000000000 +0900 +++ wesnoth-1.9.6/src/game.cpp 2011-05-14 19:57:35.564719486 +0900 @@ -78,6 +78,13 @@ #include "serialization/string_utils.hpp" #include "sha1.hpp" #include "version.hpp" +#include "sdlskk.hpp" +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#include +#include "SDL_syswm.h" +#endif //#ifdef _WIN32 //#include @@ -2225,6 +2232,12 @@ return 1; } + res = sdlskk::load_config(); + if(res == false) { + std::cerr << "could not re-initialize SDLSKK for the current language\n"; + return 1; + } + loadscreen::start_stage("refresh addons"); refresh_addon_version_info_cache(); @@ -2238,6 +2251,20 @@ LOG_CONFIG << "time elapsed: "<< (SDL_GetTicks() - start_ticks) << " ms\n"; +#ifdef _WIN32 + if (HMODULE module = LoadLibrary("imm32")) { + HIMC (__stdcall *ImmAssociateContext)(HWND, HIMC); + ImmAssociateContext = (HIMC (__stdcall *)(HWND, HIMC))GetProcAddress(module, "ImmAssociateContext"); + if (ImmAssociateContext) { + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + if (SDL_GetWMInfo(&info)) + ImmAssociateContext(info.window, 0); + } + FreeLibrary(module); + } +#endif /*_WIN32*/ + for (;;) { // reset the TC, since a game can modify it, and it may be used diff -Naru wesnoth-1.9.6-org/src/gui/auxiliary/canvas.cpp wesnoth-1.9.6/src/gui/auxiliary/canvas.cpp --- wesnoth-1.9.6-org/src/gui/auxiliary/canvas.cpp 2011-04-15 03:39:25.000000000 +0900 +++ wesnoth-1.9.6/src/gui/auxiliary/canvas.cpp 2011-05-14 19:57:35.568719292 +0900 @@ -32,6 +32,7 @@ #include "gui/widgets/helper.hpp" #include "../../text.hpp" #include "wml_exception.hpp" +#include "../../sdlskk.hpp" namespace gui2 { @@ -1201,6 +1202,8 @@ /** The maximum height for the text. */ tformula maximum_height_; + + tformula sdlskk_surface_; }; ttext::ttext(const config& cfg) @@ -1216,6 +1219,7 @@ , text_markup_(cfg["text_markup"], false) , maximum_width_(cfg["maximum_width"], -1) , maximum_height_(cfg["maximum_height"], -1) + , sdlskk_surface_(cfg["sdlskk_surface"]) { /*WIKI @@ -1277,6 +1281,8 @@ // the other formulas. const t_string text = text_(variables); + surface skksurf = sdlskk::string_to_surface(sdlskk_surface_(variables)); + if (!skksurf || !text.empty()) { if(text.empty()) { DBG_GUI_D << "Text: no text to render, leave.\n"; return; @@ -1297,6 +1303,7 @@ : PANGO_ELLIPSIZE_END); surface surf = text_renderer.render(); + if (!skksurf || surf->w) { if(surf->w == 0) { DBG_GUI_D << "Text: Rendering '" << text << "' resulted in an empty canvas, leave.\n"; @@ -1343,6 +1350,16 @@ SDL_Rect dst = ::create_rect(x, y, canvas->w, canvas->h); blit_surface(surf, 0, canvas, &dst); + } // (!skksurf || surf->w) + } // (!skksurf || !text.empty()) + if (skksurf) { + game_logic::map_formula_callable local_variables(variables); + const int offset = variables.query_value("cursor_offset").as_int(); + const unsigned x = x_(local_variables); + const unsigned y = y_(local_variables); + SDL_Rect dst = { x + offset, y, canvas->w, canvas->h }; + blit_surface(skksurf, 0, canvas, &dst); + } } } // namespace diff -Naru wesnoth-1.9.6-org/src/gui/dialogs/lobby_main.cpp wesnoth-1.9.6/src/gui/dialogs/lobby_main.cpp --- wesnoth-1.9.6-org/src/gui/dialogs/lobby_main.cpp 2011-02-08 05:57:31.000000000 +0900 +++ wesnoth-1.9.6/src/gui/dialogs/lobby_main.cpp 2011-05-14 19:57:35.568719292 +0900 @@ -1657,6 +1657,7 @@ , twindow& window) { if (key == SDLK_RETURN || key == SDLK_KP_ENTER) { + if (chat_input_->decide_skk()) send_message_button_callback(window); handled = true; halt = true; diff -Naru wesnoth-1.9.6-org/src/gui/widgets/container.hpp wesnoth-1.9.6/src/gui/widgets/container.hpp --- wesnoth-1.9.6-org/src/gui/widgets/container.hpp 2011-04-11 01:48:33.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/container.hpp 2011-05-14 19:57:35.568719292 +0900 @@ -142,6 +142,17 @@ return result ? result : grid_.find(id, must_be_active); } + twidget* find_active_skk() + { + twidget* result = tcontrol::find_active_skk(); + return result ? result : grid_.find_active_skk(); + } + const twidget* find_active_skk() const + { + const twidget* result = tcontrol::find_active_skk(); + return result ? result : grid_.find_active_skk(); + } + /** Inherited from tcontrol. */ void set_active(const bool active); diff -Naru wesnoth-1.9.6-org/src/gui/widgets/control.hpp wesnoth-1.9.6/src/gui/widgets/control.hpp --- wesnoth-1.9.6-org/src/gui/widgets/control.hpp 2011-04-11 01:48:33.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/control.hpp 2011-05-14 19:57:35.568719292 +0900 @@ -171,6 +171,11 @@ && (!must_be_active || get_active())) ? this : NULL; } + virtual twidget* find_active_skk() + { return get_active() ? twidget::find_active_skk() : 0; } + virtual const twidget* find_active_skk() const + { return get_active() ? twidget::find_active_skk() : 0; } + /** * Inherited from twidget. * diff -Naru wesnoth-1.9.6-org/src/gui/widgets/generator.cpp wesnoth-1.9.6/src/gui/widgets/generator.cpp --- wesnoth-1.9.6-org/src/gui/widgets/generator.cpp 2011-01-02 00:57:50.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/generator.cpp 2011-05-15 00:17:42.540799000 +0900 @@ -605,6 +605,30 @@ return NULL; } +twidget* tindependent::find_active_skk() +{ + for (size_t i = 0; i < get_item_count(); ++i) { + if (is_selected(i)) { + if (twidget* widget = item(i).find_active_skk()) { + return widget; + } + } + } + return NULL; +} +const twidget* tindependent::find_active_skk() const +{ + for (size_t i = 0; i < get_item_count(); ++i) { + if (is_selected(i)) { + if (const twidget* widget = item(i).find_active_skk()) { + return widget; + } + } + } + return NULL; +} + + void tindependent::set_visible_area(const SDL_Rect& area) { /* diff -Naru wesnoth-1.9.6-org/src/gui/widgets/generator_private.hpp wesnoth-1.9.6/src/gui/widgets/generator_private.hpp --- wesnoth-1.9.6-org/src/gui/widgets/generator_private.hpp 2011-04-11 01:48:33.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/generator_private.hpp 2011-05-14 19:57:35.568719292 +0900 @@ -439,6 +439,9 @@ const twidget* find(const std::string& id, const bool must_be_active) const; + twidget* find_active_skk(); + const twidget* find_active_skk() const; + /***** ***** ***** ***** keyboard functions ***** ***** ***** *****/ /** Inherited from tgenerator_. */ diff -Naru wesnoth-1.9.6-org/src/gui/widgets/grid.cpp wesnoth-1.9.6/src/gui/widgets/grid.cpp --- wesnoth-1.9.6-org/src/gui/widgets/grid.cpp 2011-04-11 01:48:33.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/grid.cpp 2011-05-14 19:57:35.572719142 +0900 @@ -625,6 +625,15 @@ *this, id, must_be_active); } +twidget* tgrid::find_active_skk() +{ + return tgrid_implementation::find_active_skk(*this); +} +const twidget* tgrid::find_active_skk() const +{ + return tgrid_implementation::find_active_skk(*this); +} + bool tgrid::has_widget(const twidget* widget) const { foreach(const tchild& child, children_) { diff -Naru wesnoth-1.9.6-org/src/gui/widgets/grid.hpp wesnoth-1.9.6/src/gui/widgets/grid.hpp --- wesnoth-1.9.6-org/src/gui/widgets/grid.hpp 2011-04-11 01:48:33.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/grid.hpp 2011-05-14 19:57:35.572719142 +0900 @@ -266,6 +266,9 @@ const twidget* find(const std::string& id, const bool must_be_active) const; + twidget* find_active_skk(); + const twidget* find_active_skk() const; + /** Inherited from twidget.*/ bool has_widget(const twidget* widget) const; diff -Naru wesnoth-1.9.6-org/src/gui/widgets/grid_private.hpp wesnoth-1.9.6/src/gui/widgets/grid_private.hpp --- wesnoth-1.9.6-org/src/gui/widgets/grid_private.hpp 2011-01-02 00:57:50.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/grid_private.hpp 2011-05-14 19:57:35.572719142 +0900 @@ -108,6 +108,21 @@ return 0; } + template + static W* find_active_skk(typename tconst_duplicator::type& grid) + { + W* widget = grid.twidget::find_active_skk(); + if (!widget) { + typedef typename tconst_duplicator::type hack; + foreach (hack& child, grid.children_) { + widget = child.widget(); + if (!widget) continue; + if (widget = widget->find_active_skk()) break; + } + } + return widget; + } + /** * Helper function to do the resizing of a row. * diff -Naru wesnoth-1.9.6-org/src/gui/widgets/scrollbar_container.cpp wesnoth-1.9.6/src/gui/widgets/scrollbar_container.cpp --- wesnoth-1.9.6-org/src/gui/widgets/scrollbar_container.cpp 2011-02-13 18:54:37.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/scrollbar_container.cpp 2011-05-14 19:57:35.572719142 +0900 @@ -444,6 +444,15 @@ ::find(*this, id, must_be_active); } +twidget* tscrollbar_container::find_active_skk() +{ + return tscrollbar_container_implementation::find_active_skk(*this); +} +const twidget* tscrollbar_container::find_active_skk() const +{ + return tscrollbar_container_implementation::find_active_skk(*this); +} + bool tscrollbar_container::disable_click_dismiss() const { assert(content_grid_); diff -Naru wesnoth-1.9.6-org/src/gui/widgets/scrollbar_container.hpp wesnoth-1.9.6/src/gui/widgets/scrollbar_container.hpp --- wesnoth-1.9.6-org/src/gui/widgets/scrollbar_container.hpp 2011-01-02 00:57:50.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/scrollbar_container.hpp 2011-05-14 19:57:35.572719142 +0900 @@ -138,6 +138,9 @@ /** Inherited from tcontrol.*/ const twidget* find(const std::string& id, const bool must_be_active) const; + twidget* find_active_skk(); + const twidget* find_active_skk() const; + /** Inherited from tcontainer_. */ bool disable_click_dismiss() const; diff -Naru wesnoth-1.9.6-org/src/gui/widgets/scrollbar_container_private.hpp wesnoth-1.9.6/src/gui/widgets/scrollbar_container_private.hpp --- wesnoth-1.9.6-org/src/gui/widgets/scrollbar_container_private.hpp 2011-01-02 00:57:50.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/scrollbar_container_private.hpp 2011-05-14 19:57:35.572719142 +0900 @@ -96,6 +96,16 @@ return result; } + + template + static W* find_active_skk(typename tconst_duplicator::type& scrollbar_container) + { + W* result = scrollbar_container.tcontainer_::find_active_skk(); + if (!result && scrollbar_container.content_grid_) { + result = scrollbar_container.content_grid_->find_active_skk(); + } + return result; + } }; } // namespace gui2 diff -Naru wesnoth-1.9.6-org/src/gui/widgets/text.cpp wesnoth-1.9.6/src/gui/widgets/text.cpp --- wesnoth-1.9.6-org/src/gui/widgets/text.cpp 2011-01-02 00:57:50.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/text.cpp 2011-05-14 19:57:35.572719142 +0900 @@ -30,6 +30,7 @@ ttext_::ttext_() : tcontrol(COUNT) + , skk() , state_(ENABLED) , text_() , selection_start_(0) @@ -188,6 +189,10 @@ /** @todo implement the ctrl key. */ DBG_GUI_E << LOG_SCOPE_HEADER << '\n'; + if (skk.is_active() && !skk.is_empty()) { + handle_key_skk(handled, SDLK_LEFT); + return; + } handled = true; const int offset = selection_start_ - 1 + selection_length_; if(offset >= 0) { @@ -200,6 +205,10 @@ /** @todo implement the ctrl key. */ DBG_GUI_E << LOG_SCOPE_HEADER << '\n'; + if (skk.is_active() && !skk.is_empty()) { + handle_key_skk(handled, SDLK_RIGHT); + return; + } handled = true; const size_t offset = selection_start_ + 1 + selection_length_; if(offset <= text_.get_length()) { @@ -211,6 +220,10 @@ { DBG_GUI_E << LOG_SCOPE_HEADER << '\n'; + if (skk.is_active() && !skk.is_empty()) { + handle_key_skk(handled, SDLK_HOME); + return; + } handled = true; if(modifier & KMOD_CTRL) { goto_start_of_data((modifier & KMOD_SHIFT) != 0); @@ -223,6 +236,10 @@ { DBG_GUI_E << LOG_SCOPE_HEADER << '\n'; + if (skk.is_active() && !skk.is_empty()) { + handle_key_skk(handled, SDLK_END); + return; + } handled = true; if(modifier & KMOD_CTRL) { goto_end_of_data((modifier & KMOD_SHIFT) != 0); @@ -235,6 +252,10 @@ { DBG_GUI_E << LOG_SCOPE_HEADER << '\n'; + if (skk.is_active() && !skk.is_empty()) { + handle_key_skk(handled, SDLK_BACKSPACE); + return; + } handled = true; if(selection_length_ != 0) { delete_selection(); @@ -247,6 +268,10 @@ { DBG_GUI_E << LOG_SCOPE_HEADER << '\n'; + if (skk.is_active() && !skk.is_empty()) { + handle_key_skk(handled, SDLK_DELETE); + return; + } handled = true; if(selection_length_ != 0) { delete_selection(); @@ -256,16 +281,66 @@ } void ttext_::handle_key_default( - bool& handled, SDLKey /*key*/, SDLMod /*modifier*/, Uint16 unicode) + bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode) { DBG_GUI_E << LOG_SCOPE_HEADER << '\n'; + handle_key_skk(handled, key, modifier, unicode); + if (handled) return; + if(unicode >= 32 && unicode != 127) { handled = true; insert_char(unicode); } } +void ttext_::handle_key_skk(bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode) +{ + if (skk.is_activate_key(key, modifier)) { + skk.activate(!skk.is_active()); + handled = true; + } else if (skk.is_active()) { + skk.reset_decided(); + if ((key == SDLK_RETURN || key == SDLK_KP_ENTER) && skk.is_basic()) { + wide_string s = utils::string_to_wstring(skk.get_string()); + if (!s.empty()) { + for (wide_string::const_iterator c = s.begin(); c != s.end(); ++c) { + insert_char(*c); + } + handled = true; + } + } else { + skk.input_event(skk.gen_event(key, modifier, unicode)); + handled = true; + } + } + if (handled) { + update_canvas(); + set_dirty(); + } +} + +bool ttext_::decide_skk() +{ + bool handled = false; + handle_key_skk(handled, SDLK_RETURN); + return !handled; +} + +bool ttext_::is_focused() const +{ + return (state_ == FOCUSSED); +} + +twidget* ttext_::find_active_skk() +{ + return (is_focused() && skk.is_active()) ? this : 0; +} +const twidget* ttext_::find_active_skk() const +{ + return (is_focused() && skk.is_active()) ? this : 0; +} + void ttext_::signal_handler_middle_button_click( const event::tevent event, bool& handled) { @@ -294,6 +369,9 @@ const unsigned copypaste_modifier = KMOD_CTRL; #endif + if (skk.is_active() && !skk.is_empty()) { + handle_key_skk(handled, key, modifier, unicode); + } else switch(key) { case SDLK_LEFT : @@ -413,6 +491,7 @@ DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; set_state(FOCUSSED); + update_canvas(); } void ttext_::signal_handler_lose_keyboard_focus(const event::tevent event) @@ -420,6 +499,7 @@ DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; set_state(ENABLED); + update_canvas(); } } // namespace gui2 diff -Naru wesnoth-1.9.6-org/src/gui/widgets/text.hpp wesnoth-1.9.6/src/gui/widgets/text.hpp --- wesnoth-1.9.6-org/src/gui/widgets/text.hpp 2011-01-02 00:57:50.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/text.hpp 2011-05-14 19:57:35.572719142 +0900 @@ -19,6 +19,7 @@ //#include "gui/auxiliary/event/dispatcher.hpp" #include "gui/widgets/control.hpp" #include "../../text.hpp" +#include "sdlskk.hpp" #include @@ -70,6 +71,13 @@ text_changed_callback_ = cb; } + sdlskk::manager skk; + void handle_key_skk(bool& handled, SDLKey key, SDLMod modifier = KMOD_NONE, Uint16 unicode = 0); + bool decide_skk(); + bool is_focused() const; + virtual twidget* find_active_skk(); + virtual const twidget* find_active_skk() const; + protected: /** diff -Naru wesnoth-1.9.6-org/src/gui/widgets/text_box.cpp wesnoth-1.9.6/src/gui/widgets/text_box.cpp --- wesnoth-1.9.6-org/src/gui/widgets/text_box.cpp 2011-01-02 00:57:50.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/text_box.cpp 2011-05-14 19:57:35.572719142 +0900 @@ -161,6 +161,7 @@ const int max_width = get_text_maximum_width(); const int max_height = get_text_maximum_height(); + std::string sdlskk_surface = is_focused() ? sdlskk::surface_to_string(skk.get_surface()) : ""; foreach(tcanvas& tmp, canvas()) { @@ -176,6 +177,8 @@ tmp.set_variable("selection_offset", variant(start_offset)); tmp.set_variable("selection_width", variant(end_offset - start_offset )); tmp.set_variable("text_wrap_mode", variant(ellipse_mode)); + + tmp.set_variable("sdlskk_surface", variant(sdlskk_surface)); } } @@ -330,6 +333,7 @@ set_font_size(conf->text_font_size); set_font_style(conf->text_font_style); + skk.set_font_size(conf->text_font_size); update_offsets(); } diff -Naru wesnoth-1.9.6-org/src/gui/widgets/tree_view_node.hpp wesnoth-1.9.6/src/gui/widgets/tree_view_node.hpp --- wesnoth-1.9.6-org/src/gui/widgets/tree_view_node.hpp 2011-04-11 01:48:33.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/tree_view_node.hpp 2011-05-14 19:57:35.572719142 +0900 @@ -151,6 +151,17 @@ return result ? result : grid_.find(id, must_be_active); } + twidget* find_active_skk() + { + twidget* result = twidget::find_active_skk(); + return result ? result : grid_.find_active_skk(); + } + const twidget* find_active_skk() const + { + const twidget* result = twidget::find_active_skk(); + return result ? result : grid_.find_active_skk(); + } + /** * The "size" of the widget. * diff -Naru wesnoth-1.9.6-org/src/gui/widgets/widget.hpp wesnoth-1.9.6/src/gui/widgets/widget.hpp --- wesnoth-1.9.6-org/src/gui/widgets/widget.hpp 2011-04-11 01:48:33.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/widget.hpp 2011-05-14 19:57:35.576718905 +0900 @@ -304,6 +304,11 @@ const bool /*must_be_active*/) const { return id_ == id ? this : 0; } + virtual twidget* find_active_skk() + { return 0; } + virtual const twidget* find_active_skk() const + { return 0; } + /** * Does the widget contain the widget. * diff -Naru wesnoth-1.9.6-org/src/gui/widgets/window.cpp wesnoth-1.9.6/src/gui/widgets/window.cpp --- wesnoth-1.9.6-org/src/gui/widgets/window.cpp 2011-04-10 01:00:26.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/window.cpp 2011-05-14 19:57:35.576718905 +0900 @@ -1296,8 +1296,10 @@ DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; if(!enter_disabled_ && (key == SDLK_KP_ENTER || key == SDLK_RETURN)) { + if (!find_active_skk()) { set_retval(OK); handled = true; + } } else if(key == SDLK_ESCAPE && !escape_disabled_) { set_retval(CANCEL); handled = true; diff -Naru wesnoth-1.9.6-org/src/gui/widgets/window.hpp wesnoth-1.9.6/src/gui/widgets/window.hpp --- wesnoth-1.9.6-org/src/gui/widgets/window.hpp 2011-03-07 03:27:54.000000000 +0900 +++ wesnoth-1.9.6/src/gui/widgets/window.hpp 2011-05-14 19:57:35.576718905 +0900 @@ -278,6 +278,12 @@ const twidget* find(const std::string& id, const bool must_be_active) const { return tcontainer_::find(id, must_be_active); } + + twidget* find_active_skk() + { return tcontainer_::find_active_skk(); } + const twidget* find_active_skk() const + { return tcontainer_::find_active_skk(); } + #if 0 /** @todo Implement these functions. */ /** diff -Naru wesnoth-1.9.6-org/src/leader_list.cpp wesnoth-1.9.6/src/leader_list.cpp --- wesnoth-1.9.6-org/src/leader_list.cpp 2011-04-22 06:37:13.000000000 +0900 +++ wesnoth-1.9.6/src/leader_list.cpp 2011-05-14 19:57:35.576718905 +0900 @@ -145,11 +145,11 @@ if (*i == unit_race::FEMALE) { gender_ids_.push_back("female"); genders_.push_back(IMAGE_PREFIX + utg.image() + get_RC_suffix(utg.flag_rgb()) + - COLUMN_SEPARATOR + _("Female ♀")); + COLUMN_SEPARATOR + _("Female \u2640")); } else { gender_ids_.push_back("male"); genders_.push_back(IMAGE_PREFIX + utg.image() + get_RC_suffix(utg.flag_rgb()) + - COLUMN_SEPARATOR + _("Male ♂")); + COLUMN_SEPARATOR + _("Male \u2642")); } } if (gender_combo_ != NULL) { diff -Naru wesnoth-1.9.6-org/src/marked-up_text.cpp wesnoth-1.9.6/src/marked-up_text.cpp --- wesnoth-1.9.6-org/src/marked-up_text.cpp 2011-01-16 18:48:53.000000000 +0900 +++ wesnoth-1.9.6/src/marked-up_text.cpp 2011-05-14 19:57:35.576718905 +0900 @@ -53,7 +53,7 @@ unit_type_color = { 245, 230, 193, 255 }, race_color = { 166, 146, 117, 255 }; -const std::string weapon_numbers_sep = "–", weapon_details_sep = "–"; +const std::string weapon_numbers_sep = "\u2013", weapon_details_sep = "\u2013"; std::string::const_iterator parse_markup(std::string::const_iterator i1, std::string::const_iterator i2, diff -Naru wesnoth-1.9.6-org/src/menu_events.cpp wesnoth-1.9.6/src/menu_events.cpp --- wesnoth-1.9.6-org/src/menu_events.cpp 2011-04-14 04:52:52.000000000 +0900 +++ wesnoth-1.9.6/src/menu_events.cpp 2011-05-14 19:57:35.576718905 +0900 @@ -641,6 +641,7 @@ textbox_info_.show(gui::TEXTBOX_MESSAGE,_("Message:"), has_friends() ? is_observer() ? _("Send to observers only") : _("Send to allies only") : "", preferences::message_private(), *gui_); + textbox_info_.box()->skk.activate(true); } void menu_handler::whisper() diff -Naru wesnoth-1.9.6-org/src/multiplayer_connect.cpp wesnoth-1.9.6/src/multiplayer_connect.cpp --- wesnoth-1.9.6-org/src/multiplayer_connect.cpp 2011-04-10 00:59:56.000000000 +0900 +++ wesnoth-1.9.6/src/multiplayer_connect.cpp 2011-05-14 19:57:35.580718667 +0900 @@ -217,9 +217,9 @@ gender_name_pseudolist.push_back("-"); } else { if (gender_ == "female") - gender_name_pseudolist.push_back( _("Female ♀") ); + gender_name_pseudolist.push_back( _("Female \u2640") ); else if (gender_ == "male") - gender_name_pseudolist.push_back( _("Male ♂") ); + gender_name_pseudolist.push_back( _("Male \u2642") ); else if (gender_ == "random") gender_name_pseudolist.push_back( _("gender^Random") ); else gender_name_pseudolist.push_back("?"); @@ -261,9 +261,9 @@ gender_name_pseudolist.push_back("?"); } else { if (gender_ == "female") - gender_name_pseudolist.push_back( _("Female ♀") ); + gender_name_pseudolist.push_back( _("Female \u2640") ); else if (gender_ == "male") - gender_name_pseudolist.push_back( _("Male ♂") ); + gender_name_pseudolist.push_back( _("Male \u2642") ); else if (gender_ == "random") gender_name_pseudolist.push_back( _("gender^Random") ); else gender_name_pseudolist.push_back("?"); diff -Naru wesnoth-1.9.6-org/src/multiplayer_ui.cpp wesnoth-1.9.6/src/multiplayer_ui.cpp --- wesnoth-1.9.6-org/src/multiplayer_ui.cpp 2011-02-20 11:59:29.000000000 +0900 +++ wesnoth-1.9.6/src/multiplayer_ui.cpp 2011-05-14 19:57:35.580718667 +0900 @@ -490,8 +490,10 @@ //On enter, adds the current chat message to the chat textbox. if((event.keysym.sym == SDLK_RETURN || event.keysym.sym == SDLK_KP_ENTER) && !entry_textbox_.text().empty()) { + if (entry_textbox_.decide_skk()) { chat_handler::do_speak(entry_textbox_.text()); entry_textbox_.clear(); + } // nick tab-completion } else if(event.keysym.sym == SDLK_TAB ) { std::string text = entry_textbox_.text(); diff -Naru wesnoth-1.9.6-org/src/play_controller.cpp wesnoth-1.9.6/src/play_controller.cpp --- wesnoth-1.9.6-org/src/play_controller.cpp 2011-05-07 04:04:20.000000000 +0900 +++ wesnoth-1.9.6/src/play_controller.cpp 2011-05-14 19:57:35.580718667 +0900 @@ -988,6 +988,7 @@ } else if(event.key.keysym.sym == SDLK_TAB) { tab(); } else if(event.key.keysym.sym == SDLK_RETURN || event.key.keysym.sym == SDLK_KP_ENTER) { + if (menu_handler_.get_textbox().box()->decide_skk()) enter_textbox(); } } diff -Naru wesnoth-1.9.6-org/src/sdlskk.cpp wesnoth-1.9.6/src/sdlskk.cpp --- wesnoth-1.9.6-org/src/sdlskk.cpp 1970-01-01 09:00:00.000000000 +0900 +++ wesnoth-1.9.6/src/sdlskk.cpp 2011-05-14 19:57:35.580718667 +0900 @@ -0,0 +1,409 @@ +/* vim:set encoding=utf-8: */ +/* + Copyright (C) 2003 - 2010 by David White + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + or at your option any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY. + + See the COPYING file for more details. +*/ + +#define GETTEXT_DOMAIN "wesnoth-lib" + +#include "global.hpp" + +#include "config.hpp" +#include "filesystem.hpp" +#include "font.hpp" +#include "log.hpp" +#include "serialization/parser.hpp" +#include "serialization/preprocessor.hpp" +#include "serialization/string_utils.hpp" +#include +#include "sdlskk.hpp" +#ifdef _WIN32 +#include +#endif /*_WIN32*/ + +static lg::log_domain log_skk("sdlskk"); +#define DBG_SK LOG_STREAM(debug, log_skk) +#define LOG_SK LOG_STREAM(info, log_skk) +#define WRN_SK LOG_STREAM(warn, log_skk) +#define ERR_SK LOG_STREAM(err, log_skk) + +namespace sdlskk { + +t_string fontname, familyname; +int familyindex; +SDL_Color forecolor, backcolor; +SDLSKK_RomKanaRuleTable* rule_table = NULL; +std::string user_dic; +SDLSKK_Dictionary* dic = NULL; +SDLSKK_Keybind* keybind = NULL; +bool standby = false; + +bool load_config() +{ + standby = false; + if (rule_table) { + SDLSKK_RomKanaRuleTable_delete(rule_table); + rule_table = NULL; + } + if (dic) { + SDLSKK_Dict_delete_all(dic); + dic = NULL; + } + if (keybind) { + SDLSKK_Keybind_delete(keybind); + keybind = NULL; + } + + std::string filename = get_wml_location("~sdlskk/sdlskk.cfg"); + if (filename.empty()) { + filename = get_wml_location("sdlskk/sdlskk.cfg"); + if (filename.empty()) { + WRN_SK << "Could not find sdlskk.cfg.\n"; + return true; + } + } + + config cfg_root; + try { + scoped_istream stream = preprocess_file(filename); + read(cfg_root, *stream); + } catch (config::error &e) { + ERR_SK << "Could not read sdlskk.cfg:\n" << e.message << '\n'; + return false; + } + + config &conf = cfg_root.child("sdlskk"); + if (!conf) + { + ERR_SK << "Missing sdlskk section.\n"; + return false; + } + + fontname = conf["font"]; + familyname = conf["family"]; + if (!familyname.empty()) { + for (familyindex = 0;; familyindex++) { + TTF_Font* fnt = font::open_font_index(fontname, 14, familyindex); + if (!fnt) { + ERR_SK << "Failed opening font: '" << fontname << "': No such family '" << familyname << "': familyindex=" << familyindex << ": " << TTF_GetError() << " \n"; + return false; + } + ERR_SK << "Check for family: '" << TTF_FontFaceFamilyName(fnt) << "'\n"; + bool match = (strcmpi(TTF_FontFaceFamilyName(fnt), familyname.c_str()) == 0); + TTF_CloseFont(fnt); + if (match) break; + } + } + + try { + forecolor.r = static_cast(boost::lexical_cast(conf["forecolor_r"])); + forecolor.g = static_cast(boost::lexical_cast(conf["forecolor_g"])); + forecolor.b = static_cast(boost::lexical_cast(conf["forecolor_b"])); + } catch (...) { + ERR_SK << "Invalid forecolor.\n"; + return false; + } + try { + backcolor.r = static_cast(boost::lexical_cast(conf["backcolor_r"])); + backcolor.g = static_cast(boost::lexical_cast(conf["backcolor_g"])); + backcolor.b = static_cast(boost::lexical_cast(conf["backcolor_b"])); + } catch (...) { + ERR_SK << "Invalid backcolor.\n"; + return false; + } + + std::string user_data_dir = get_user_data_dir() + "/data/sdlskk"; + create_directory_if_missing(user_data_dir); + SDLSKK_set_encoding(SDLSKK_UTF8); + keybind = SDLSKK_Keybind_new(); + SDLSKK_Keybind_set_default_key(keybind); + + { + std::string f = conf["rule_table"]; + if (f.empty()) { + ERR_SK << "Invalid rule_table.\n"; + return false; + } + std::string p = get_wml_location("~sdlskk/" + f); + if (p.empty()) { + p = get_wml_location("sdlskk/" + f); + if (p.empty()) { + ERR_SK << "Could not find rule_table: '" << f << "'\n"; + return false; + } + } + rule_table = SDLSKK_RomKanaRuleTable_new(const_cast(p.c_str())); + } + + dic = SDLSKK_Dict_new(); + + { + std::string f = conf["user_dic"]; + if (f.empty()) { + ERR_SK << "Invalid user_dic.\n"; + return false; + } + user_dic = user_data_dir + "/" + f; + if (file_exists(user_dic)) { + SDLSKK_Dict_load(dic, const_cast(user_dic.c_str()), 1); + } + } + + const std::vector dic_order = utils::split(conf["dic_order"]); + for (std::vector::const_iterator f = dic_order.begin(); f != dic_order.end(); ++f) { + std::string p = get_wml_location("~sdlskk/" + *f); + if (p.empty()) { + p = get_wml_location("sdlskk/" + *f); + if (p.empty()) { + ERR_SK << "Could not find dic: '" << *f << "'\n"; + return false; + } + } + SDLSKK_Dict_load(dic, const_cast(p.c_str()), 0); + } + + standby = true; + return true; +} + +std::string surface_to_string(const surface& surf) +{ + if (!surf) return ""; + + std::ostringstream ss; + + ss << ' ' << surf->flags; + ss << ' ' << static_cast(surf->format->BitsPerPixel); + ss << ' ' << surf->format->Rmask << ' ' << surf->format->Gmask << ' ' << surf->format->Bmask << ' ' << surf->format->Amask; + ss << ' ' << surf->w << ' ' << surf->h; + SDL_LockSurface(surf); + Uint8* p = static_cast(surf->pixels); + for (int i = 0; i < surf->pitch * surf->h; i++) { + ss << ' ' << static_cast(*p++); + } + SDL_UnlockSurface(surf); + + return ss.str(); +} + +surface string_to_surface(const std::string& str) +{ + if (str.empty()) return NULL; + + std::istringstream ss(str); + SDL_Surface wsurf; + SDL_PixelFormat wformat; + Uint16 w; + + ss >> wsurf.flags; + ss >> w; wformat.BitsPerPixel = static_cast(w); + ss >> wformat.Rmask >> wformat.Gmask >> wformat.Bmask >> wformat.Amask; + ss >> wsurf.w >> wsurf.h; + + surface surf = SDL_CreateRGBSurface(wsurf.flags, wsurf.w, wsurf.h, wformat.BitsPerPixel, wformat.Rmask, wformat.Gmask, wformat.Bmask, wformat.Amask); + SDL_LockSurface(surf); + Uint8* p = static_cast(surf->pixels); + for (int i = 0; i < surf->pitch * surf->h; i++) { + ss >> w; *p++ = static_cast(w); + } + SDL_UnlockSurface(surf); + + return surf; +} + +manager::manager(int font_size) +{ + if (standby) { + fnt = font::open_font_index(fontname, font_size, familyindex); + context = SDLSKK_Context_new(dic, rule_table, keybind, 0); + } + is_active_ = false; + just_decided_ = false; +} + +manager::~manager() +{ + if (standby) { + SDLSKK_Context_delete(context); + TTF_CloseFont(fnt); + SDLSKK_Dict_save_user_dict(dic, const_cast(user_dic.c_str())); + } +} + +void manager::set_font_size(int font_size) +{ + if (standby) { + TTF_CloseFont(fnt); + fnt = font::open_font_index(fontname, font_size, familyindex); + } +} + +bool manager::is_active() const +{ + return is_active_; +} + +bool manager::is_empty() const +{ + if (is_active_) + { + if (SDLSKK_Context_get_basic_mode(context)) + { + char buf[1024]; + if (*SDLSKK_Context_get_str(context, buf, sizeof(buf)) == 0) + return true; + } + return false; + } + return true; +} + +bool manager::activate(bool active) +{ + if (standby) { + if (is_active_ != active) + { + if (is_active_) + SDLSKK_Context_clear(context); + is_active_ = active; + } + } + return is_active_; +} + +void manager::clear() +{ + if (standby) { + SDLSKK_Context_clear(context); + } + is_active_ = false; + just_decided_ = false; +} + +surface manager::get_surface() +{ + if (!is_active_) return NULL; + + surface skk_surf = SDLSKK_Context_render_display_str(context, fnt, forecolor); + + SDL_Rect rc; + SDL_GetClipRect(skk_surf, &rc); + + surface skk_surf_painted = create_neutral_surface(rc.w, rc.h); + SDL_FillRect(skk_surf_painted, NULL, SDL_MapRGB(skk_surf_painted->format, backcolor.r, backcolor.g, backcolor.b)); + SDL_BlitSurface(skk_surf, NULL, skk_surf_painted, NULL); + return skk_surf_painted; +} + +void manager::draw(surface &surf, int x, int y) +{ + if (is_active_) { + surface skk_surf = SDLSKK_Context_render_display_str(context, fnt, forecolor); + + SDL_Rect rc; + SDL_GetClipRect(skk_surf, &rc); + + surface skk_surf_painted = create_compatible_surface(surf, rc.w, rc.h); + SDL_FillRect(skk_surf_painted, NULL, SDL_MapRGB(skk_surf_painted->format, backcolor.r, backcolor.g, backcolor.b)); + SDL_BlitSurface(skk_surf, NULL, skk_surf_painted, NULL); + skk_surf = skk_surf_painted; + + rc.x = x; + rc.y = y; + + SDL_BlitSurface(skk_surf, NULL, surf, &rc); + } +} + +std::string manager::get_string() +{ + std::string result; + + just_decided_ = false; + if (standby) { + char buf[1024]; + SDLSKK_Context_get_str(context, buf, sizeof(buf)); + + result = buf; + just_decided_ = (*buf != 0); + + SDLSKK_Context_clear(context); + } + + return result; +} + +void manager::input_event(const SDL_Event& event) +{ + SDL_Event ev = const_cast(event); +#ifdef _WIN32 + if (ev.key.keysym.sym == SDLK_UNKNOWN) { + BYTE keystate[256]; + if (GetKeyboardState(keystate)) { + if(keystate[VK_CONVERT] & 0x80) { // Henkan + // back to previous Henkan-kouho + ev = gen_event(SDLK_x, KMOD_NONE, L'x'); + } else if(keystate[VK_NONCONVERT] & 0x80) { // Muhenkan + // toggle hiragana/katakana + ev = gen_event(SDLK_q, KMOD_NONE, L'q'); + } else if(keystate[0xF5/*VK_OEM_BACKTAB*/] & 0x80) {// Roma-ji : VK_OEM_COPY ga douji hassei suru node Hiragana yori mae ni hantei shinaito naran + // entering Hankaku-Eisu-mode + ev = gen_event(SDLK_l, KMOD_NONE, L'l'); + } else if(keystate[0xF2/*VK_OEM_COPY*/] & 0x80) { // Hiragana : Hankaku-Eisu no toki Roma-ji suruto nazeka kokoni : osoraku Windows ga nanika kanri shiteru + // return to Nihongo-mode + ev = gen_event(SDLK_j, static_cast(KMOD_CTRL), 0); + } + //else for (int i = 0; i < 256; i++) if (keystate[i] & 0x80) ERR_SK << "find: " << i << "\n"; + } + } else if (ev.key.keysym.sym == SDLK_BACKQUOTE) // SDLSKK ga konran suru + return; +#endif /*_WIN32*/ + SDLSKK_Context_input_event(context, &ev); +} + +bool manager::is_activate_key(SDLKey key, SDLMod modifier) const +{ + if (key == SDLK_SPACE && (modifier & KMOD_SHIFT)) + return true; +#ifdef _WIN32 + if (key == SDLK_BACKQUOTE && (modifier & KMOD_ALT)) // ALT nashi dato nazeka repeat suru + return true; +#endif /*_WIN32*/ + return false; +} + +bool manager::is_basic() const +{ + return (SDLSKK_Context_get_basic_mode(context) != 0); +} + +bool manager::just_decided() const +{ + return just_decided_; +} + +void manager::reset_decided() +{ + just_decided_ = false; +} + +SDL_Event manager::gen_event(SDLKey key, SDLMod modifier, Uint16 unicode) const +{ + SDL_Event event; + event.key.type = SDL_KEYDOWN; + event.key.keysym.sym = key; + event.key.keysym.mod = modifier; + event.key.keysym.unicode = unicode; + event.key.keysym.scancode = 0; + return event; +} + +} diff -Naru wesnoth-1.9.6-org/src/sdlskk.hpp wesnoth-1.9.6/src/sdlskk.hpp --- wesnoth-1.9.6-org/src/sdlskk.hpp 1970-01-01 09:00:00.000000000 +0900 +++ wesnoth-1.9.6/src/sdlskk.hpp 2011-05-14 19:57:35.580718667 +0900 @@ -0,0 +1,54 @@ +/* + Copyright (C) 2003 - 2010 by David White + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + or at your option any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY. + + See the COPYING file for more details. +*/ +#ifndef SDLSKK_HPP_INCLUDED +#define SDLSKK_HPP_INCLUDED + +#include "SDL.h" +#include "SDL_ttf.h" +#include "sdlskk.h" + +namespace sdlskk { + +bool load_config(); +std::string surface_to_string(const surface& surf); +surface string_to_surface(const std::string& str); + +struct manager { + manager(int font_size = 14); + ~manager(); + + void set_font_size(int font_size); + bool is_active() const; + bool is_empty() const; + bool activate(bool active); + void clear(); + surface get_surface(); + void draw(surface &surf, int x, int y); + std::string get_string(); + void input_event(const SDL_Event& event); + bool is_activate_key(SDLKey key, SDLMod modifier) const; + bool is_basic() const; + bool just_decided() const; + void reset_decided(); + SDL_Event gen_event(SDLKey key, SDLMod modifier = KMOD_NONE, Uint16 unicode = 0) const; + +private: + TTF_Font* fnt; + SDLSKK_Context* context; + bool is_active_; + bool just_decided_; +}; + +} + +#endif diff -Naru wesnoth-1.9.6-org/src/serialization/string_utils.cpp wesnoth-1.9.6/src/serialization/string_utils.cpp --- wesnoth-1.9.6-org/src/serialization/string_utils.cpp 2011-04-25 16:19:38.000000000 +0900 +++ wesnoth-1.9.6/src/serialization/string_utils.cpp 2011-05-14 23:43:25.933637000 +0900 @@ -33,10 +33,10 @@ namespace utils { -const std::string unicode_minus = "−"; -const std::string unicode_en_dash = "–"; -const std::string unicode_em_dash = "—"; -const std::string unicode_figure_dash = "‒"; +const std::string unicode_minus = "\u2212"; +const std::string unicode_en_dash = "\u2013"; +const std::string unicode_em_dash = "\u2014"; +const std::string unicode_figure_dash = "\u2012"; const std::string unicode_multiplication_sign = "×"; bool isnewline(const char c) diff -Naru wesnoth-1.9.6-org/src/widgets/textbox.cpp wesnoth-1.9.6/src/widgets/textbox.cpp --- wesnoth-1.9.6-org/src/widgets/textbox.cpp 2011-02-13 01:20:24.000000000 +0900 +++ wesnoth-1.9.6/src/widgets/textbox.cpp 2011-05-14 19:57:35.580718667 +0900 @@ -21,6 +21,7 @@ #include "clipboard.hpp" #include "log.hpp" #include "video.hpp" +#include "../serialization/string_utils.hpp" static lg::log_domain log_display("display"); #define WRN_DP LOG_STREAM(warn, log_display) @@ -37,6 +38,7 @@ show_cursor_(true), show_cursor_at_(0), text_image_(NULL), wrap_(false), line_height_(0), yscroll_(0), alpha_(alpha), alpha_focus_(alpha_focus) + , skk(font_size) { // static const SDL_Rect area = d.screen_area(); // const int height = font::draw_text(NULL,area,font_size,font::NORMAL_COLOR,"ABCD",0,0).h; @@ -126,6 +128,7 @@ set_dirty(true); update_text_cache(true); handle_text_changed(text_); + skk.clear(); } void textbox::draw_cursor(int pos, CVideo &video) const @@ -200,6 +203,13 @@ draw_cursor((cursor_pos_ == 0 ? 0 : cursor_pos_ - 1), video()); update_rect(loc); + + { + int cur = is_selection() ? std::min(selstart_,selend_) : cursor_; + int x = loc.x + text_pos_ + char_x_[cur]; + int y = loc.y + yscroll_ + char_y_[cur]; + skk.draw(surf, x, y); + } } void textbox::set_editable(bool value) @@ -376,6 +386,19 @@ return false; } +bool textbox::decide_skk() +{ + if (!skk.is_empty()) + { + SDL_Event event; + event.key.type = SDL_KEYDOWN; + event.key.keysym.sym = SDLK_RETURN; + handle_event(event); + return false; + } + return true; +} + void textbox::handle_event(const SDL_Event& event) { scrollarea::handle_event(event); @@ -467,6 +490,36 @@ const int c = key.sym; const int old_cursor = cursor_; + bool ate = false; + if (skk.is_activate_key(key.sym, modifiers)) { + skk.activate(!skk.is_active()); + ate = true; + } else if (skk.is_active()) { + if (skk.is_empty() && (c == SDLK_UP || c == SDLK_DOWN || c == SDLK_LEFT || c == SDLK_RIGHT || + c == SDLK_DELETE || c == SDLK_BACKSPACE || c == SDLK_END || c == SDLK_HOME || + c == SDLK_PAGEUP || c == SDLK_PAGEDOWN || + ((c == SDLK_e || c == SDLK_a || c == SDLK_u || c == SDLK_v || c == SDLK_c) && (modifiers & KMOD_CTRL)) )) { + } else { + skk.reset_decided(); + if ((c == SDLK_RETURN || c == SDLK_KP_ENTER) && skk.is_basic()) { + wide_string s = utils::string_to_wstring(skk.get_string()); + if (!s.empty()) { + if (is_selection()) + erase_selection(); + changed = true; + for (wide_string::const_iterator c = s.begin(); c != s.end(); ++c) { + text_.insert(text_.begin() + cursor_, *c); + ++cursor_; + } + } + } else { + skk.input_event(event); + } + ate = true; + } + } + if (!ate) { + if(c == SDLK_LEFT && cursor_ > 0) --cursor_; @@ -574,6 +627,8 @@ } } + } // if (!ate) { + if(is_selection() && (selend_ != cursor_)) selstart_ = selend_ = -1; diff -Naru wesnoth-1.9.6-org/src/widgets/textbox.hpp wesnoth-1.9.6/src/widgets/textbox.hpp --- wesnoth-1.9.6-org/src/widgets/textbox.hpp 2011-01-02 00:57:50.000000000 +0900 +++ wesnoth-1.9.6/src/widgets/textbox.hpp 2011-05-14 19:57:35.580718667 +0900 @@ -20,6 +20,7 @@ #include "font.hpp" #include "scrollarea.hpp" +#include "sdlskk.hpp" namespace gui { @@ -41,6 +42,9 @@ void set_wrap(bool val); + sdlskk::manager skk; + bool decide_skk(); + protected: virtual void draw_contents(); virtual void set_inner_location(SDL_Rect const &);