changes to traydict
Originally committed to SVN as r1639.
This commit is contained in:
parent
c22c36c687
commit
67b15eacd4
15 changed files with 362 additions and 107 deletions
|
@ -45,11 +45,13 @@
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderThrough="stdwx.h"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="false"
|
Detect64BitPortabilityProblems="false"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
DisableSpecificWarnings="4996"
|
DisableSpecificWarnings="4996"
|
||||||
|
ForcedIncludeFiles="stdwx.h"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
@ -123,11 +125,13 @@
|
||||||
AdditionalIncludeDirectories="D:\wxWidgets-2.8.6\lib\vc_lib\mswu"
|
AdditionalIncludeDirectories="D:\wxWidgets-2.8.6\lib\vc_lib\mswu"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderThrough="stdwx.h"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="false"
|
Detect64BitPortabilityProblems="false"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
DisableSpecificWarnings="4996"
|
DisableSpecificWarnings="4996"
|
||||||
|
ForcedIncludeFiles="stdwx.h"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
@ -178,74 +182,114 @@
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<File
|
<Filter
|
||||||
RelativePath=".\dict_window.cpp"
|
Name="Dialogs"
|
||||||
>
|
>
|
||||||
</File>
|
<File
|
||||||
<File
|
RelativePath=".\dict_window.cpp"
|
||||||
RelativePath=".\dict_window.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\dictionary.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\dictionary.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\kana_table.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\kana_table.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\main.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\main.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\res.rc"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\systray.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\systray.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\aegisub\text_file_reader.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
>
|
||||||
<Tool
|
</File>
|
||||||
Name="VCCLCompilerTool"
|
<File
|
||||||
PreprocessorDefinitions="NO_AUTODETECT_CHARSET"
|
RelativePath=".\dict_window.h"
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
>
|
||||||
<Tool
|
</File>
|
||||||
Name="VCCLCompilerTool"
|
</Filter>
|
||||||
PreprocessorDefinitions="NO_AUTODETECT_CHARSET"
|
<Filter
|
||||||
/>
|
Name="Core"
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\aegisub\text_file_reader.h"
|
|
||||||
>
|
>
|
||||||
</File>
|
<File
|
||||||
|
RelativePath=".\main.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\main.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\res.rc"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\stdwx.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
UsePrecompiledHeader="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\stdwx.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\systray.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\systray.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Utils"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\kana_table.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\kana_table.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\aegisub\text_file_reader.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions="NO_AUTODETECT_CHARSET"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions="NO_AUTODETECT_CHARSET"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\aegisub\text_file_reader.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Dictionary"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\dictionary.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\dictionary.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\dictionary_display.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\dictionary_display.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@cellosoft.com
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
@ -41,6 +41,7 @@
|
||||||
#include "dict_window.h"
|
#include "dict_window.h"
|
||||||
#include "systray.h"
|
#include "systray.h"
|
||||||
#include "dictionary.h"
|
#include "dictionary.h"
|
||||||
|
#include "dictionary_display.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ DictWindow::DictWindow()
|
||||||
searchPane.CloseButton(false);
|
searchPane.CloseButton(false);
|
||||||
|
|
||||||
// Results
|
// 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->AddPane(results,wxCENTER,_("Results"));
|
||||||
manager->Update();
|
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);
|
int bitmask = (checkKanji->GetValue() ? 1 : 0) | (checkKana->GetValue() ? 2 : 0) | (checkRomaji->GetValue() ? 4 : 0) | (checkEnglish->GetValue() ? 8 : 0);
|
||||||
|
|
||||||
// Clear text
|
// Clear text
|
||||||
results->Clear();
|
results->ResultsStart();
|
||||||
entry->SetSelection(0,entry->GetValue().Length());
|
entry->SetSelection(0,entry->GetValue().Length());
|
||||||
|
|
||||||
// Search each dictionary
|
// Search each dictionary
|
||||||
|
@ -217,17 +218,16 @@ void DictWindow::Search(wxString text) {
|
||||||
ResultSet res;
|
ResultSet res;
|
||||||
dict[i]->Search(res,text);
|
dict[i]->Search(res,text);
|
||||||
|
|
||||||
// Sort results by relevancy
|
// Sort results by relevance
|
||||||
res.results.sort();
|
res.results.sort();
|
||||||
|
|
||||||
// Print
|
// Print
|
||||||
res.Print(results,bitmask);
|
results->Print(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show start
|
// Done
|
||||||
results->ShowPosition(0);
|
results->ResultsDone();
|
||||||
results->SetSelection(0,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@cellosoft.com
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
// Prototypes
|
// Prototypes
|
||||||
class Systray;
|
class Systray;
|
||||||
class Dictionary;
|
class Dictionary;
|
||||||
|
class DictionaryDisplay;
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
@ -51,7 +52,7 @@ class Dictionary;
|
||||||
class DictWindow : public wxFrame {
|
class DictWindow : public wxFrame {
|
||||||
private:
|
private:
|
||||||
wxMenuBar *menu;
|
wxMenuBar *menu;
|
||||||
wxTextCtrl *results;
|
DictionaryDisplay *results;
|
||||||
Systray *systray;
|
Systray *systray;
|
||||||
std::vector<Dictionary*> dict;
|
std::vector<Dictionary*> dict;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@cellosoft.com
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
@ -251,13 +251,13 @@ void Dictionary::Search(ResultSet &results,wxString query) {
|
||||||
// Matches kanji?
|
// Matches kanji?
|
||||||
if (cur->kanji.Contains(query)) {
|
if (cur->kanji.Contains(query)) {
|
||||||
addThis = true;
|
addThis = true;
|
||||||
rel = GetRelevancy(query,cur->kanji,cur->english.Contains(_T("(P)")));
|
rel = GetRelevance(query,cur->kanji,cur->english.Contains(_T("(P)")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matches kana?
|
// Matches kana?
|
||||||
else if (cur->kana.Contains(query)) {
|
else if (cur->kana.Contains(query)) {
|
||||||
addThis = true;
|
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?
|
// Matches english?
|
||||||
if (cur->english.Lower().Contains(lowQuery)) {
|
if (cur->english.Lower().Contains(lowQuery)) {
|
||||||
addThis = true;
|
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?
|
// Matches wapuro romaji?
|
||||||
if (cur->romaji.Contains(lowQuery)) {
|
if (cur->romaji.Contains(lowQuery)) {
|
||||||
addThis = true;
|
addThis = true;
|
||||||
rel = GetRelevancy(lowQuery,cur->romaji,cur->english.Contains(_T("(P)")));
|
rel = GetRelevance(lowQuery,cur->romaji,cur->english.Contains(_T("(P)")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add entry
|
// Add entry
|
||||||
if (addThis) {
|
if (addThis) {
|
||||||
SearchResult res;
|
SearchResult res;
|
||||||
res.relevancy = rel;
|
res.relevance = rel;
|
||||||
res.entry = cur;
|
res.entry = cur;
|
||||||
results.results.push_back(res);
|
results.results.push_back(res);
|
||||||
cur = NULL;
|
cur = NULL;
|
||||||
|
@ -302,7 +302,7 @@ void Dictionary::Search(ResultSet &results,wxString query) {
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// Get relevancy
|
// 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
|
// Best score
|
||||||
int bestScore = 0;
|
int bestScore = 0;
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ int Dictionary::GetRelevancy(wxString substr,wxString _str,bool isPop,bool engli
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Comparison for sorting
|
// Comparison for sorting
|
||||||
bool operator < (const SearchResult &a,const SearchResult &b) {
|
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
|
// Print resultset
|
||||||
|
/*
|
||||||
void ResultSet::Print(wxTextCtrl *target,int bitmask) {
|
void ResultSet::Print(wxTextCtrl *target,int bitmask) {
|
||||||
// Get options
|
// Get options
|
||||||
bool drawKanji = (bitmask & 1) != 0;
|
bool drawKanji = (bitmask & 1) != 0;
|
||||||
|
@ -585,3 +586,4 @@ void ResultSet::Print(wxTextCtrl *target,int bitmask) {
|
||||||
// Print two carriage returns
|
// Print two carriage returns
|
||||||
target->AppendText(_T("\n\n"));
|
target->AppendText(_T("\n\n"));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,13 +27,16 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@cellosoft.com
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -58,7 +61,7 @@ public:
|
||||||
class SearchResult {
|
class SearchResult {
|
||||||
public:
|
public:
|
||||||
DictEntry *entry;
|
DictEntry *entry;
|
||||||
int relevancy;
|
int relevance;
|
||||||
};
|
};
|
||||||
bool operator < (const SearchResult &a,const SearchResult &b);
|
bool operator < (const SearchResult &a,const SearchResult &b);
|
||||||
|
|
||||||
|
@ -71,7 +74,6 @@ public:
|
||||||
wxString dicName;
|
wxString dicName;
|
||||||
|
|
||||||
std::list<SearchResult> results;
|
std::list<SearchResult> results;
|
||||||
void Print(wxTextCtrl *target,int bitmask);
|
|
||||||
bool ownData;
|
bool ownData;
|
||||||
int time;
|
int time;
|
||||||
|
|
||||||
|
@ -95,7 +97,7 @@ public:
|
||||||
|
|
||||||
void Load(wxString filename);
|
void Load(wxString filename);
|
||||||
void Search(ResultSet &results,wxString query);
|
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(wxString name,wxCheckBox *check);
|
||||||
~Dictionary();
|
~Dictionary();
|
||||||
|
|
111
traydict/dictionary_display.cpp
Normal file
111
traydict/dictionary_display.cpp
Normal file
|
@ -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 <wx/html/htmlwin.h>
|
||||||
|
#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("<table cellpadding='2' cellspacing='0' border='0'>"));
|
||||||
|
int i = 0;
|
||||||
|
for (std::list<SearchResult>::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("<tr bgcolor='%s'>"),col[(i/3) % 2]);
|
||||||
|
row += _T("<td>") + entry->kanji + _T("</td>");
|
||||||
|
row += _T("<td>") + entry->kana + _T(" </td>");
|
||||||
|
row += _T("<td>") + Dictionary::kanatable.KanaToRomaji(entry->kana) + _T(" </td>");
|
||||||
|
row += _T("<td>") + entry->english + _T("</td>");
|
||||||
|
row += _T("</tr>");
|
||||||
|
|
||||||
|
// Append string to page
|
||||||
|
AppendToPage(row);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
AppendToPage(_T("</table>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////
|
||||||
|
// 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("<html><head><style>%s</style></head><body>"),stylesheet.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////
|
||||||
|
// Done printing results
|
||||||
|
void DictionaryDisplay::ResultsDone()
|
||||||
|
{
|
||||||
|
AppendToPage(_T("</body></html>"));
|
||||||
|
HistoryClear();
|
||||||
|
Thaw();
|
||||||
|
}
|
53
traydict/dictionary_display.h
Normal file
53
traydict/dictionary_display.h
Normal file
|
@ -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 <wx/html/htmlwin.h>
|
||||||
|
#include "dictionary.h"
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////
|
||||||
|
// Dictionary result display class
|
||||||
|
class DictionaryDisplay : public wxHtmlWindow {
|
||||||
|
public:
|
||||||
|
DictionaryDisplay(wxWindow *parent);
|
||||||
|
void Print(const ResultSet &results);
|
||||||
|
void ResultsStart();
|
||||||
|
void ResultsDone();
|
||||||
|
};
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@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
|
// Check if it needs to add a macron
|
||||||
wxString last = lastSyl.Right(1);
|
wxString last = lastSyl.Right(1);
|
||||||
wxString curV = cur->hepburn;
|
wxString curV = cur->hepburn;
|
||||||
if ((last == _T("o") && curV == _T("u")) || (last == curV && last != lastSyl && last != _T("n"))) {
|
if ((last == _T("o") && curV == _T("u")) || (last == curV && last != _T("n") /*&& last != lastSyl */)) {
|
||||||
final += 0x304;
|
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;
|
vetoAdd = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wapura
|
// Wopura
|
||||||
else {
|
else {
|
||||||
if (longVowel) {
|
if (longVowel) {
|
||||||
longVowel = false;
|
longVowel = false;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,13 +27,16 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@cellosoft.com
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@cellosoft.com
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
@ -66,6 +66,7 @@ IMPLEMENT_APP(TrayDict)
|
||||||
#pragma comment(lib, "wxmsw28ud_core.lib")
|
#pragma comment(lib, "wxmsw28ud_core.lib")
|
||||||
#pragma comment(lib, "wxmsw28ud_adv.lib")
|
#pragma comment(lib, "wxmsw28ud_adv.lib")
|
||||||
#pragma comment(lib, "wxmsw28ud_aui.lib")
|
#pragma comment(lib, "wxmsw28ud_aui.lib")
|
||||||
|
#pragma comment(lib, "wxmsw28ud_html.lib")
|
||||||
#pragma comment(lib, "wxbase28ud_xml.lib")
|
#pragma comment(lib, "wxbase28ud_xml.lib")
|
||||||
#pragma comment(lib, "wxexpatd.lib")
|
#pragma comment(lib, "wxexpatd.lib")
|
||||||
#else
|
#else
|
||||||
|
@ -76,6 +77,7 @@ IMPLEMENT_APP(TrayDict)
|
||||||
#pragma comment(lib, "wxmsw28u_core.lib")
|
#pragma comment(lib, "wxmsw28u_core.lib")
|
||||||
#pragma comment(lib, "wxmsw28u_adv.lib")
|
#pragma comment(lib, "wxmsw28u_adv.lib")
|
||||||
#pragma comment(lib, "wxmsw28u_aui.lib")
|
#pragma comment(lib, "wxmsw28u_aui.lib")
|
||||||
|
#pragma comment(lib, "wxmsw28u_html.lib")
|
||||||
#pragma comment(lib, "wxbase28u_xml.lib")
|
#pragma comment(lib, "wxbase28u_xml.lib")
|
||||||
#pragma comment(lib, "wxexpat.lib")
|
#pragma comment(lib, "wxexpat.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@cellosoft.com
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
|
1
traydict/stdwx.cpp
Normal file
1
traydict/stdwx.cpp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include "stdwx.h"
|
28
traydict/stdwx.h
Normal file
28
traydict/stdwx.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// Precompiled header file
|
||||||
|
|
||||||
|
#include <wx/wxprec.h>
|
||||||
|
#include <wx/notebook.h>
|
||||||
|
#include <wx/statline.h>
|
||||||
|
#include <wx/tglbtn.h>
|
||||||
|
#include <wx/tokenzr.h>
|
||||||
|
#include <wx/wfstream.h>
|
||||||
|
#include <wx/filename.h>
|
||||||
|
#include <wx/sashwin.h>
|
||||||
|
#include <wx/file.h>
|
||||||
|
#include <wx/filedlg.h>
|
||||||
|
#include <wx/grid.h>
|
||||||
|
#include <wx/fontdlg.h>
|
||||||
|
#include <wx/clipbrd.h>
|
||||||
|
#include <wx/msgdlg.h>
|
||||||
|
#include <wx/stackwalk.h>
|
||||||
|
#include <wx/spinctrl.h>
|
||||||
|
#include <wx/wfstream.h>
|
||||||
|
#include <wx/tipdlg.h>
|
||||||
|
#include <wx/event.h>
|
||||||
|
#include <wx/string.h>
|
||||||
|
#include <wx/aui/aui.h>
|
||||||
|
#include <wx/html/htmlwin.h>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
#include <map>
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@cellosoft.com
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// 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
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// AEGISUB
|
// TRAYDICT
|
||||||
//
|
//
|
||||||
// Website: http://aegisub.cellosoft.com
|
// Website: http://aegisub.cellosoft.com
|
||||||
// Contact: mailto:zeratul@cellosoft.com
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
|
Loading…
Reference in a new issue