diff --git a/traydict/TrayDict.vcproj b/traydict/TrayDict.vcproj
index aff8e2886..3cedeb765 100644
--- a/traydict/TrayDict.vcproj
+++ b/traydict/TrayDict.vcproj
@@ -45,11 +45,13 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
- UsePrecompiledHeader="0"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="stdwx.h"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
DisableSpecificWarnings="4996"
+ ForcedIncludeFiles="stdwx.h"
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/traydict/dict_window.cpp b/traydict/dict_window.cpp
index 3ea3f7b73..c6d02b7f6 100644
--- a/traydict/dict_window.cpp
+++ b/traydict/dict_window.cpp
@@ -9,7 +9,7 @@
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
-// * Neither the name of the Aegisub Group nor the names of its contributors
+// * Neither the name of the TrayDict Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
@@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
-// AEGISUB
+// TRAYDICT
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
@@ -41,6 +41,7 @@
#include "dict_window.h"
#include "systray.h"
#include "dictionary.h"
+#include "dictionary_display.h"
#include "main.h"
@@ -120,7 +121,7 @@ DictWindow::DictWindow()
searchPane.CloseButton(false);
// Results
- results = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(280,400),wxTE_RICH2 | wxTE_MULTILINE | wxTE_DONTWRAP | wxTE_READONLY);
+ results = new DictionaryDisplay(this);
manager->AddPane(results,wxCENTER,_("Results"));
manager->Update();
@@ -207,7 +208,7 @@ void DictWindow::Search(wxString text) {
int bitmask = (checkKanji->GetValue() ? 1 : 0) | (checkKana->GetValue() ? 2 : 0) | (checkRomaji->GetValue() ? 4 : 0) | (checkEnglish->GetValue() ? 8 : 0);
// Clear text
- results->Clear();
+ results->ResultsStart();
entry->SetSelection(0,entry->GetValue().Length());
// Search each dictionary
@@ -217,17 +218,16 @@ void DictWindow::Search(wxString text) {
ResultSet res;
dict[i]->Search(res,text);
- // Sort results by relevancy
+ // Sort results by relevance
res.results.sort();
// Print
- res.Print(results,bitmask);
+ results->Print(res);
}
}
- // Show start
- results->ShowPosition(0);
- results->SetSelection(0,0);
+ // Done
+ results->ResultsDone();
}
diff --git a/traydict/dict_window.h b/traydict/dict_window.h
index 6adfb8691..c1c781325 100644
--- a/traydict/dict_window.h
+++ b/traydict/dict_window.h
@@ -9,7 +9,7 @@
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
-// * Neither the name of the Aegisub Group nor the names of its contributors
+// * Neither the name of the TrayDict Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
@@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
-// AEGISUB
+// TRAYDICT
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
@@ -44,6 +44,7 @@
// Prototypes
class Systray;
class Dictionary;
+class DictionaryDisplay;
//////////////////////////
@@ -51,7 +52,7 @@ class Dictionary;
class DictWindow : public wxFrame {
private:
wxMenuBar *menu;
- wxTextCtrl *results;
+ DictionaryDisplay *results;
Systray *systray;
std::vector dict;
diff --git a/traydict/dictionary.cpp b/traydict/dictionary.cpp
index 042abf2d8..213056e7d 100644
--- a/traydict/dictionary.cpp
+++ b/traydict/dictionary.cpp
@@ -9,7 +9,7 @@
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
-// * Neither the name of the Aegisub Group nor the names of its contributors
+// * Neither the name of the TrayDict Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
@@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
-// AEGISUB
+// TRAYDICT
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
@@ -251,13 +251,13 @@ void Dictionary::Search(ResultSet &results,wxString query) {
// Matches kanji?
if (cur->kanji.Contains(query)) {
addThis = true;
- rel = GetRelevancy(query,cur->kanji,cur->english.Contains(_T("(P)")));
+ rel = GetRelevance(query,cur->kanji,cur->english.Contains(_T("(P)")));
}
// Matches kana?
else if (cur->kana.Contains(query)) {
addThis = true;
- rel = GetRelevancy(query,cur->kana,cur->english.Contains(_T("(P)")));
+ rel = GetRelevance(query,cur->kana,cur->english.Contains(_T("(P)")));
}
}
@@ -269,20 +269,20 @@ void Dictionary::Search(ResultSet &results,wxString query) {
// Matches english?
if (cur->english.Lower().Contains(lowQuery)) {
addThis = true;
- rel = GetRelevancy(lowQuery,cur->english,cur->english.Contains(_T("(P)")),true);
+ rel = GetRelevance(lowQuery,cur->english,cur->english.Contains(_T("(P)")),true);
}
// Matches wapuro romaji?
if (cur->romaji.Contains(lowQuery)) {
addThis = true;
- rel = GetRelevancy(lowQuery,cur->romaji,cur->english.Contains(_T("(P)")));
+ rel = GetRelevance(lowQuery,cur->romaji,cur->english.Contains(_T("(P)")));
}
}
// Add entry
if (addThis) {
SearchResult res;
- res.relevancy = rel;
+ res.relevance = rel;
res.entry = cur;
results.results.push_back(res);
cur = NULL;
@@ -302,7 +302,7 @@ void Dictionary::Search(ResultSet &results,wxString query) {
/////////////////
// Get relevancy
-int Dictionary::GetRelevancy(wxString substr,wxString _str,bool isPop,bool english) {
+int Dictionary::GetRelevance(wxString substr,wxString _str,bool isPop,bool english) {
// Best score
int bestScore = 0;
@@ -384,7 +384,7 @@ int Dictionary::GetRelevancy(wxString substr,wxString _str,bool isPop,bool engli
//////////////////////////
// Comparison for sorting
bool operator < (const SearchResult &a,const SearchResult &b) {
- return (a.relevancy > b.relevancy);
+ return (a.relevance > b.relevance);
}
@@ -418,6 +418,7 @@ ResultSet::~ResultSet() {
///////////////////
// Print resultset
+/*
void ResultSet::Print(wxTextCtrl *target,int bitmask) {
// Get options
bool drawKanji = (bitmask & 1) != 0;
@@ -585,3 +586,4 @@ void ResultSet::Print(wxTextCtrl *target,int bitmask) {
// Print two carriage returns
target->AppendText(_T("\n\n"));
}
+*/
diff --git a/traydict/dictionary.h b/traydict/dictionary.h
index 8ee3e0c96..3ea7d2636 100644
--- a/traydict/dictionary.h
+++ b/traydict/dictionary.h
@@ -9,7 +9,7 @@
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
-// * Neither the name of the Aegisub Group nor the names of its contributors
+// * Neither the name of the TrayDict Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
@@ -27,13 +27,16 @@
//
// -----------------------------------------------------------------------------
//
-// AEGISUB
+// TRAYDICT
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
//
+#pragma once
+
+
///////////
// Headers
#include
@@ -58,7 +61,7 @@ public:
class SearchResult {
public:
DictEntry *entry;
- int relevancy;
+ int relevance;
};
bool operator < (const SearchResult &a,const SearchResult &b);
@@ -71,7 +74,6 @@ public:
wxString dicName;
std::list results;
- void Print(wxTextCtrl *target,int bitmask);
bool ownData;
int time;
@@ -95,7 +97,7 @@ public:
void Load(wxString filename);
void Search(ResultSet &results,wxString query);
- int GetRelevancy(wxString substr,wxString str,bool isPop,bool english=false);
+ int GetRelevance(wxString substr,wxString str,bool isPop,bool english=false);
Dictionary(wxString name,wxCheckBox *check);
~Dictionary();
diff --git a/traydict/dictionary_display.cpp b/traydict/dictionary_display.cpp
new file mode 100644
index 000000000..3098ead5d
--- /dev/null
+++ b/traydict/dictionary_display.cpp
@@ -0,0 +1,111 @@
+// Copyright (c) 2007, Rodrigo Braz Monteiro
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+// * Neither the name of the TrayDict Group nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// -----------------------------------------------------------------------------
+//
+// TRAYDICT
+//
+// Website: http://aegisub.cellosoft.com
+// Contact: mailto:zeratul@cellosoft.com
+//
+
+///////////
+// Headers
+#include
+#include "dictionary_display.h"
+#include "main.h"
+#include "../aegisub/text_file_reader.h"
+
+
+///////////////
+// Constructor
+DictionaryDisplay::DictionaryDisplay(wxWindow *parent)
+: wxHtmlWindow(parent,-1)
+{
+ SetBorders(0);
+}
+
+
+/////////////////
+// Print results
+void DictionaryDisplay::Print(const ResultSet &results)
+{
+ // Clear page
+ SetPage(_T(""));
+
+ // Colours
+ wchar_t col[][8] = {L"#FFFFFF",L"#FEFAED"};
+
+ // Go through each result
+ AppendToPage(_T("
"));
+ int i = 0;
+ for (std::list::const_iterator cur=results.results.begin();cur!=results.results.end();cur++) {
+ // Get entry
+ DictEntry *entry = (*cur).entry;
+
+ // Generate row string
+ wxString row = wxString::Format(_T("
"));
+}
+
+
+/////////////////
+// Start results
+void DictionaryDisplay::ResultsStart()
+{
+ Freeze();
+
+ // Get stylesheet path
+ wxString stylesheet;
+ TextFileReader styleFile(TrayDict::folderName + _T("traydict.css"));
+ while (styleFile.HasMoreLines()) {
+ stylesheet += styleFile.ReadLineFromFile() + _T("\n");
+ }
+
+ // Insert header
+ AppendToPage(wxString::Format(_T(""),stylesheet.c_str()));
+}
+
+
+/////////////////////////
+// Done printing results
+void DictionaryDisplay::ResultsDone()
+{
+ AppendToPage(_T(""));
+ HistoryClear();
+ Thaw();
+}
diff --git a/traydict/dictionary_display.h b/traydict/dictionary_display.h
new file mode 100644
index 000000000..48c434042
--- /dev/null
+++ b/traydict/dictionary_display.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2007, Rodrigo Braz Monteiro
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+// * Neither the name of the TrayDict Group nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// -----------------------------------------------------------------------------
+//
+// TRAYDICT
+//
+// Website: http://aegisub.cellosoft.com
+// Contact: mailto:zeratul@cellosoft.com
+//
+
+#pragma once
+
+
+///////////
+// Headers
+#include
+#include "dictionary.h"
+
+
+///////////////////////////////////
+// Dictionary result display class
+class DictionaryDisplay : public wxHtmlWindow {
+public:
+ DictionaryDisplay(wxWindow *parent);
+ void Print(const ResultSet &results);
+ void ResultsStart();
+ void ResultsDone();
+};
diff --git a/traydict/kana_table.cpp b/traydict/kana_table.cpp
index ca9b1e07e..f97ff1b26 100644
--- a/traydict/kana_table.cpp
+++ b/traydict/kana_table.cpp
@@ -9,7 +9,7 @@
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
-// * Neither the name of the Aegisub Group nor the names of its contributors
+// * Neither the name of the TrayDict Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
@@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
-// AEGISUB
+// TRAYDICT
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
@@ -396,14 +396,22 @@ wxString KanaTable::KanaToRomaji(wxString kana,int type) {
// Check if it needs to add a macron
wxString last = lastSyl.Right(1);
wxString curV = cur->hepburn;
- if ((last == _T("o") && curV == _T("u")) || (last == curV && last != lastSyl && last != _T("n"))) {
- final += 0x304;
+ if ((last == _T("o") && curV == _T("u")) || (last == curV && last != _T("n") /*&& last != lastSyl */)) {
+ wchar_t macron;
+ switch(last[0]) {
+ case L'a': macron = 257; break;
+ case L'e': macron = 275; break;
+ case L'i': macron = 299; break;
+ case L'o': macron = 333; break;
+ case L'u': macron = 363; break;
+ }
+ final = final.Left(final.Length()-1) + macron;
vetoAdd = true;
}
}
}
- // Wapura
+ // Wopura
else {
if (longVowel) {
longVowel = false;
diff --git a/traydict/kana_table.h b/traydict/kana_table.h
index 6e2b02f4a..cdaeea1cf 100644
--- a/traydict/kana_table.h
+++ b/traydict/kana_table.h
@@ -9,7 +9,7 @@
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
-// * Neither the name of the Aegisub Group nor the names of its contributors
+// * Neither the name of the TrayDict Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
@@ -27,13 +27,16 @@
//
// -----------------------------------------------------------------------------
//
-// AEGISUB
+// TRAYDICT
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
//
+#pragma once
+
+
///////////
// Headers
#include
diff --git a/traydict/main.cpp b/traydict/main.cpp
index 2102d5ac9..7ec84ca17 100644
--- a/traydict/main.cpp
+++ b/traydict/main.cpp
@@ -9,7 +9,7 @@
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
-// * Neither the name of the Aegisub Group nor the names of its contributors
+// * Neither the name of the TrayDict Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
@@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
-// AEGISUB
+// TRAYDICT
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
@@ -66,6 +66,7 @@ IMPLEMENT_APP(TrayDict)
#pragma comment(lib, "wxmsw28ud_core.lib")
#pragma comment(lib, "wxmsw28ud_adv.lib")
#pragma comment(lib, "wxmsw28ud_aui.lib")
+#pragma comment(lib, "wxmsw28ud_html.lib")
#pragma comment(lib, "wxbase28ud_xml.lib")
#pragma comment(lib, "wxexpatd.lib")
#else
@@ -76,6 +77,7 @@ IMPLEMENT_APP(TrayDict)
#pragma comment(lib, "wxmsw28u_core.lib")
#pragma comment(lib, "wxmsw28u_adv.lib")
#pragma comment(lib, "wxmsw28u_aui.lib")
+#pragma comment(lib, "wxmsw28u_html.lib")
#pragma comment(lib, "wxbase28u_xml.lib")
#pragma comment(lib, "wxexpat.lib")
#endif
diff --git a/traydict/main.h b/traydict/main.h
index 2d1a7b6e2..76f071c52 100644
--- a/traydict/main.h
+++ b/traydict/main.h
@@ -9,7 +9,7 @@
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
-// * Neither the name of the Aegisub Group nor the names of its contributors
+// * Neither the name of the TrayDict Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
@@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
-// AEGISUB
+// TRAYDICT
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
diff --git a/traydict/stdwx.cpp b/traydict/stdwx.cpp
new file mode 100644
index 000000000..8e5878c38
--- /dev/null
+++ b/traydict/stdwx.cpp
@@ -0,0 +1 @@
+#include "stdwx.h"
diff --git a/traydict/stdwx.h b/traydict/stdwx.h
new file mode 100644
index 000000000..7781ca71f
--- /dev/null
+++ b/traydict/stdwx.h
@@ -0,0 +1,28 @@
+// Precompiled header file
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include